Top/Nagios/プラグイン/check_dns

check_dnsはてなブックマーク

DNSサーバをチェックするプラグイン。

以下

DNSサーバ192.168.0.2
チェックするドメインexample.com
正しいIP172.16.0.1

と仮定。

対象

リモート (or ローカル)

アーカイブ内での位置

plugins/check_dns

実行

指定DNSサーバで example.com のIPが引けないとき、 CRITICAL。

/usr/local/nagios/libexec/check_dns -s 192.168.0.2 -H example.com

aオプションで正しいIPを指定できる。

/usr/local/nagios/libexec/check_dns -s 192.168.0.2 -H example.com -a 172.16.0.1

checkcommands.cfgでの定義

vi /usr/local/nagios/etc/checkcommands.cfg
# 'check_dns' command definition
define command{
        command_name    check_dns
        command_line    $USER1$/check_dns -s $HOSTADDRESS$ -H $ARG1$
        }

サービスの定義

define service{
        use                             generic-service
        host_name                       hoge
        service_description             DNS example.com
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           5
        retry_check_interval            1
        notification_interval           240
        notification_period             24x7
        notification_options            c,r
        check_command                   check_dns!example.com
        contact_groups                  linux-admins
        }

備考

Hオプションとsオプションの指定の方法が通常のプラグインと異なるため*1
check_dig を使う方がいいかもしれない。
ただしこちらにはaオプションに相当するものがないので注意。

Amazon

*1 通常Hオプションにはサービス提供ホストを指定する
差分 一覧