LoginSignup
0
0

More than 5 years have passed since last update.

古のNagiosでURL監視

Posted at

やりたいこと

特定URLのレスポンスコードを監視したい
例)
http://example.com/example_path へアクセスしてステータスコード200であれば正常
それ以外のステータスコードであれば異常とみなしエスカレーションする

設定

  • まずコマンドの型を定義します

@command.cfg

define command{
        command_name    check_http_url
        command_line    $USER1$/check_http -H $ARG1$ -u $ARG2$ -e $ARG3$
        }

引数の説明:
-H 対象のアドレス(ドメイン)
-u ドメイン以降のパス
-e ステータスコード

  • 次に実際の監視コマンドとして定義します。 上記で定義した型に従い、各引数の値を感嘆符で区切って記述します

@services.cfg

define service{
        use                             generic-service
        host_name                       example.com
        service_description             HTTP URL
        [省略] 
        check_command                   check_http_url!example.com!/example_path!200
        }

このあとnagiosのconfigtestを実施し問題ないようであればreloadを実施、上記で設定した監視が開始されます。

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