0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

nagios -vコマンドを検証してみた

Posted at

はじめに

nagios -vを使ったことがなかったため、検証してみました。

nagios -vとは何か

ヘルプ記事を参照したところ、
「-v, --verify-config Verify all configuration data (-v -v for more info)」と記載されているため、
すべてのコンフィグファイルを検証する様です。

$ nagios -h

Nagios Core 4.4.6
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2020-04-28
License: GPL

Website: https://www.nagios.org
Usage: nagios [options] <main_config_file>

Options:

  -v, --verify-config          Verify all configuration data (-v -v for more info)
  -s, --test-scheduling        Shows projected/recommended check scheduling and other
                               diagnostic info based on the current configuration files.
  -T, --enable-timing-point    Enable timed commentary on initialization
  -x, --dont-verify-paths      Deprecated (Don't check for circular object paths)
  -p, --precache-objects       Precache object configuration
  -u, --use-precached-objects  Use precached object config file
  -d, --daemon                 Starts Nagios in daemon mode, instead of as a foreground process
  -W, --worker /path/to/socket Act as a worker for an already running daemon

Visit the Nagios website at https://www.nagios.org/ for bug fixes, new
releases, online documentation, FAQs, information on subscribing to
the mailing lists, and commercial support options for Nagios.

検証しました

nagiosのwebインターフェースの画面
image.png

nagios -vを実行しました。

# nagios -v /etc/nagios/nagios.cfg

以下のエビデンスでも確認出来るように、ホストが2つ、サービスが9つチェックされているため、
nagiosのWEBインタフェースに表示されているホストとserviceがすべてチェックされている様です。
上記のコマンドを実行したら、/etc/nagios/配下のコンフィグファイルがすべてチェックされることが分かりました。

image.png

まとめ

nagios -vコマンドは、nagiosのコンフィグファイルの文法等のチェックで使用されるものだと思います。
httpdであれば、「httpd -t」に相当するものだと思います。

nagiosのコンフィグファイル変更後のフローは以下になります。
(1)コンフィグファイル変更する。
(2)nagios -v /etc/nagios/nagios.cfgをコマンドを実行して、コンフィグファイルをすべてチェックする。
(3)(2)で問題なければ、nagiosのサービスを再起動することで、変更後のコンフィグファイルを反映させる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?