Nagios 4 : しきい値の設定2016/09/15 |
|
しきい値の設定です。
デフォルトで有効になっている監視項目はしきい値も設定されていますが、変更する場合は以下のように設定します。 |
|
| [1] | しきい値は、デフォルトのものについては、監視設定ファイルに定義してあります。 Nagios サーバーのローカルホストの監視設定ファイル中で、それぞれの監視項目は「define service」で括られている部分が該当し、 「check_command」で指定されたコマンドに「!」で続くパラメーターがしきい値になります。 例えば、ルートパーティションのディスク使用量の監視は以下のように設定されています。 |
|
[root@dlp ~]#
vi /etc/nagios/objects/localhost.cfg # Define a service to check the disk space of the root partition # on the local machine. Warning if > 20% free, critical if # > 10% free space on partition. # 上の説明にもある通り、空き容量が 20% を切ると Warning, 10% を切ると Critical # しきい値を変更する場合はこの値を変更する
define service{
use local-service
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}
[root@dlp ~]# systemctl restart nagios |
| [2] | プラグインを追加した場合等で、自身でコマンド定義からしきい値まで設定する場合は以下のような流れになります。 (例は check_ntp_time プラグイン追加時) |
|
# 追加したプラグインのオプション等の使用方法を調べる [root@dlp ~]# /usr/lib64/nagios/plugins/check_ntp_time -h
...
...
-w, --warning=THRESHOLD
Offset to result in warning status (seconds)
-c, --critical=THRESHOLD
...
...
# 最終行に追記
define command{
command_name check_ntp_time
command_line $USER1$/check_ntp_time -H $ARG1$ -w $ARG2$ -c $ARG3$
}
# 最終行に追記 ( NTPサーバーとの時間が1秒差で Warning, 2秒差で Critical )
define service{
use local-service
host_name localhost
service_description NTP_TIME
check_command check_ntp_time!ntp1.jst.mfeed.ad.jp!1!2
notifications_enabled 1
}
systemctl restart nagios |
| [3] | しきい値を超えると以下のようなメールが設定したメールアドレスへ送信されます。 |
Subject: ** PROBLEM Service Alert: localhost/Root Partition is CRITICAL ** User-Agent: Heirloom mailx 12.4 7/29/08 Content-Type: text/plain; charset=us-ascii From: nagios@dlp.srv.world Status: R ***** Nagios ***** Notification Type: PROBLEM Service: Root Partition Host: localhost Address: 127.0.0.1 State: CRITICAL Date/Time: Wed Feb 25 07:49:12 JST 2015 Additional Info: DISK CRITICAL - free space: / 13232 MB (9% inode=15%): |
| Sponsored Link |
|
|