Nagios の設定
はじめに
「OpenMicroServer への Nagios の導入について」では nagios と nagios-plugins のインストールを行いました。ここでは Nagios の設定について説明します。
ここでは nagios のバージョンは 2.11 と 2.5 とします。2.11 と 2.5 に固有な場合はそれぞれ (2.11) と (2.5) と注記します。共通な場合は何も示しません。
設定ファイル
設定ファイルのサンプルは、ディレクトリ /usr/local/nagios/etc/ にあります。バージョン 2.5 ではファイル名の末尾に `-sample’が付いています。 これらのサンプルを元に設定を行います。
設定ファイルが正しく記述できているかは以下のコマンドを実行することで確認できます。
# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Total Errors が 0 であれば正しいです。さもなければ表示されるメッセージを読んで修正します。
Total Warnings が 0 でなくとも Nagios を起動することはできます。表示されるメッセージを読んで、必要があれば修正してください。
nagios.cfg (2.11)
ファイル nagios.cfg をコピーして nagios.cfg-dist を作ります。
# cp nagios.cfg nagios.cfg-dist
変更点
参照するファイルのコメント・アウトを以下の通りはずします。
cfg_file=/usr/local/nagios/etc/hostgroups.cfg cfg_file=/usr/local/nagios/etc/hosts.cfg cfg_file=/usr/local/nagios/etc/services.cfg
CGI コマンド・インタフェースを使えるようにします。
check_external_commands=1
フラップ検知機能を有効にします。
enable_flap_detection=1
nagios.cfg (2.5)
ファイル nagios.cfg-sample をコピーして nagios.cfg を作ります。
# cp nagios.cfg-sample nagios.cfg
変更点
設定が重複するので ファイル minimal.cfg を参照しないよう、以下の通りコメント・アウトします。
#cfg_file=/usr/local/nagios/etc/minimal.cfg
参照するファイルのコメント・アウトを以下の通りはずします。
cfg_file=/usr/local/nagios/etc/contactgroups.cfg cfg_file=/usr/local/nagios/etc/contacts.cfg cfg_file=/usr/local/nagios/etc/hostgroups.cfg cfg_file=/usr/local/nagios/etc/hosts.cfg cfg_file=/usr/local/nagios/etc/services.cfg cfg_file=/usr/local/nagios/etc/timeperiods.cfg cfg_file=/usr/local/nagios/etc/servicesgroups.cfg
CGI コマンド・インタフェースを使えるようにします。
check_external_commands=1
フラップ検知機能を有効にします。
enable_flap_detection=1
cgi.cfg
(2.11) ファイル cgi.cfg をコピーして cgi.cfg-dist を作ります。
# cp cgi.cfg cgi.cfg-dist
(2.5) ファイル cgi.cfg-sample をコピーして cgi.cfg を作ります。
# cp cgi.cfg-sample cgi.cfg
変更点
Nagios のプロセスをチェックするために以下の通りコメント・アウトをはずします。
nagios_check_command=/usr/local/nagios/libexec/check_nagios /usr/local/nagios/var/status.dat 5 '/usr/local/nagios/bin/nagios'
コマンド htpasswd で登録した(「OpenMicroServer への Nagios の導入について」)ユーザ nagios に権限を与えるために以下の通り設定します。
authorized_for_system_information=nagios authorized_for_configuration_information=nagios authorized_for_system_commands=nagios authorized_for_all_services=nagios authorized_for_all_hosts=nagios authorized_for_all_service_commands=nagios authorized_for_all_host_commands=nagios
resource.cfg
(2.11) ファイル resource.cfg をコピーして resource.cfg-dist を作ります。
# cp resource.cfg-sample resource.cfg
(2.5) ファイル resource.cfg-sample をコピーして resource.cfg を作ります。
# cp resource.cfg-sample resource.cfg
変更点
ファイル services.cfg でユーザ user1 とパスワード plathome を直接に記述しないようにするため、以下の通り設定します。
$USER3$=user1 $USER4$=plathome
localhost.cfg (2.11)
ファイル localhost.cfg をコピーして localhost.cfg-dist を作ります。
変更点
contact の定義において以下の通り変更します。
contact_name nagios email admin@example.com
contactgroupt の定義において以下の通り変更します。
members nagios
timeperiods.cfg (2.5)
ファイル bigger.cfg-sample の `TIMEPERIOD DEFINITIONS’ をコピーして timeperiods.cfg を作ります。
################################################################################
# TIMEPERIOD DEFINITIONS
################################################################################
# '24x7' timeperiod definition
define timeperiod{
timeperiod_name 24x7
alias 24 Hours A Day, 7 Days A Week
sunday 00:00-24:00
monday 00:00-24:00
tuesday 00:00-24:00
wednesday 00:00-24:00
thursday 00:00-24:00
friday 00:00-24:00
saturday 00:00-24:00
}
# 'workhours' timeperiod definition
define timeperiod{
timeperiod_name workhours
alias "Normal" Working Hours
monday 09:00-17:00
tuesday 09:00-17:00
wednesday 09:00-17:00
thursday 09:00-17:00
friday 09:00-17:00
}
# 'nonworkhours' timeperiod definition
define timeperiod{
timeperiod_name nonworkhours
alias Non-Work Hours
sunday 00:00-24:00
monday 00:00-09:00,17:00-24:00
tuesday 00:00-09:00,17:00-24:00
wednesday 00:00-09:00,17:00-24:00
thursday 00:00-09:00,17:00-24:00
friday 00:00-09:00,17:00-24:00
saturday 00:00-24:00
}
# 'none' timeperiod definition
define timeperiod{
timeperiod_name none
alias No Time Is A Good Time
}
contacts.cfg (2.5)
ファイル minimal.cfg-sample の `CONTACTS’ をコピーして contacts.cfg を作ります。
異常時に送られるメールの通知先を admin@example.com とします。
###############################################################################
###############################################################################
#
# CONTACTS
#
###############################################################################
###############################################################################
# In this simple config file, a single contact will receive all alerts.
# This assumes that you have an account (or email alias) called
# "nagios-admin" on the local host.
define contact{
contact_name nagios
alias Nagios Admin
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r
host_notification_options d,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
email admin@example.com
}
contactgroups.cfg (2.5)
ファイル minimal.cfg-sample の `CONTACTS GROUPS’をコピーして contactgroups.cfg を作ります。
contacts.cfg で設定した通知先名称 nagios を members に入れます。
###############################################################################
###############################################################################
#
# CONTACT GROUPS
#
###############################################################################
###############################################################################
# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.
define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagios
}
hosts.cfg (2.11)
監視対象ホストの IP アドレスを 192.168.0.1、192.168.0.100 とします。プラグイン check_nt の監視対象ホストとするため、後者の OS は Windows (2000 など)です。
################################################################################
# HOST DEFINITIONS
################################################################################
define host{
use linux-server
host_name targethost
address 192.168.0.1
check_command check-host-alive
contact_groups admins
}
define host{
use linux-server
host_name windows
address 192.168.0.100
check_command check-host-alive
contact_groups admins
}
hosts.cfg (2.5)
ファイル bigger.cfg-sample の `HOST DEFINITIONS’ の generic-host の部分をコピーして hosts.cfg を作ります。
監視対象ホストの IP アドレスを 192.168.0.1、192.168.0.100 とします。プラグイン check_nt の監視対象ホストとするため、後者の OS は Windows (2000 など)です。
################################################################################
# HOST DEFINITIONS
################################################################################
# Generic host definition template
define host{
name generic-host ; The name of this host template - referenced in other host definitions, used for template recursion/resolution
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
notification_period 24x7
notification_options d,u,r,f
max_check_attempts 10
notification_interval 480
register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
define host{
use generic-host
host_name targethost
address 192.168.0.1
check_command check-host-alive
contact_groups admins
}
define host{
use generic-host
host_name windows
address 192.168.0.100
check_command check-host-alive
contact_groups admins
}
hostgroups.cfg
ファイル hosts.cfg で設定した監視対象ホスト targethost をホストグループ example の members に入れます。
define hostgroup{
hostgroup_name example
alias 192.168.0.0/24
members targethost
}
services.cfg
(2.5)ファイル hosts.cfg の generic-host と同様に generic-service を定義します。
define service{
name generic-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_period 24x7
check_period 24x7
notification_options w,u,c,r,f
is_volatile 1
contact_groups admins
max_check_attempts 3
retry_check_interval 1
normal_check_interval 3
notification_interval 120
register 0
}
追加の定義はプラグイン毎に説明します。
servicesgroups.cfg (2.5)
define servicegroup{
servicegroup_name PING
alias PING service
members targethost,PING
}
commands.cfg (2.11)
ファイル commands.cfg をコピーして commands.cfg-dist を作ります。
# cp commands.cfg commands.cfg-dist
追加の定義はプラグイン毎に説明します。
checkcommands.cfg (2.5)
ファイル checkcommands.cfg-sample をコピーして checkcommands.cfg を作ります。
# cp checkcommands.cfg-sample checkcommands.cfg
追加の定義はプラグイン毎に説明します。
misccommands.cfg (2.5)
ファイル misccommands.cfg-sample をコピーして misccommands.cfg を作ります。
# cp misccommands.cfg-sample misccommands.cfg
変更点はありません。
監視対象サービスの設定
プラグイン毎に commands.cfg (2.11)、checkcommands.cfg (2.5) と services.cfg とでの定義をまとめます。これらの例はプラグインの動作検証に使ったものです。
services.cfg で
use generic-service
と記述している行はバージョン 2.5 の場合です。バージョン 2.11 の場合は
use local-service
と記述してください。
プラグインの使用方法は、以下の例の通り、オプション −−help を付けて実行することにより知ることができます。
# /usr/local/nagios/libexec/check_by_ssh --help
check_by_ssh
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_by_ssh
command_line $USER1$/check_by_ssh -l $ARG1$ -H $HOSTADDRESS$ -C $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description BY_SSH
check_command check_by_ssh!nagios!"~nagios/libexec/check_swap -w 90% -c 70%"
}
監視対象ホスト targethost にてプラグイン check_swap を実行します。ここで、OS のユーザ nagios にパスフレーズ無しで SSH 接続できなければなりません。
check_dhcp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_dhcp
command_line $USER1$/check_dhcp -s $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description DHCP
check_command check_dhcp
}
DHCP サーバが利用できるかチェックします。
check_dig
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_dig
command_line $USER1$/check_dig -H $HOSTADDRESS$ -l $ARG1$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description DIG
check_command check_dig!example.com
}
監視対象ホスト targethost のネーム・サーバに example.com を問合せます。
check_disk
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description DISK
check_command check_disk!10%!5%
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのディスクのルート・パーティションの空き容量が 5% 以下なら状態 CRITICAL を、10% 以下なら状態 WARNING を返します。
check_disk_smb
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_disk_smb
command_line $USER1$/check_disk_smb -H $HOSTADDRESS$ -s $ARG1$ -u $USER3$ -p $USER4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description DISK_SMB
check_command check_disk_smb!share
}
監視対象ホスト targethost の Samba の共有名 share の空き容量をチェックします。Samba のユーザは $USER3$、そのパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。
check_dns
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_dns
command_line $USER1$/check_dns -H $ARG1$ -s $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description DNS
check_command check_dns!host.example.com.
}
監視対象ホスト targethost のネーム・サーバに対して host.example.com. を問合せます。
check_file_age
commands.cfg (2.11), checkcommands.cfg
(2.5)
define command{
command_name check_file_age
command_line $USER1$/check_file_age -w $ARG1$ -c $ARG2$ -f $ARG3$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description FILE_AGE
check_command check_file_age!240!600!/path/file
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのファイル /path/file の更新時刻が 600 秒より経過しているなら状態 CRITICAL を、240 秒より経過しているなら状態 WARNING を返します。
check_fping
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_fping
command_line $USER1$/check_fping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -n $ARG3$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description FPING
check_command check_fping!300.0,30%!500.0,50%!3
}
監視対象ホスト targethost へのコマンド fping(1) の応答(ICMP パケット数 3)が、RTA(Round Trip Average travel time) が 500ms 以上、パケット・ロスが 50% 以上なら状態 CRITICAL を、RTA が 300ms 以上、パケット・ロスが 30% 以上なら状態 WARNING を返します。
check_http
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_http
command_line $USER1$/check_http -H $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description HTTP
check_command check_http
}
監視対象ホスト targethost の HTTP サーバに接続を試みます。
check_icmp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_icmp
command_line $USER1$/check_icmp $ARG1$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description ICMP
check_command check_icmp!targethost windows
}
監視対象ホスト targethost と windows の PING 監視を行います。複数のホストを指定できます。
check_ifoperstatus
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_ifoperstatus
command_line $USER1$/check_ifoperstatus -H $HOSTADDRESS$ -C $ARG1$ -d $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description IFOPERSTATUS
check_command check_ifoperstatus!public!eth0
}
監視対象ホスト targethost の SNMP コミュニティ public にネットワーク・インタフェース eth0 の状態を問合せます。
check_ifstatus
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_ifstatus
command_line $USER1$/check_ifstatus -C $ARG1$ -H $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description IFSTATUS
check_command check_ifstatus!public
}
監視対象ホスト targethost の SNMP コミュニティ public の状態をチェックします。
check_ldap
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_ldap
command_line $USER1$/check_ldap -H $HOSTADDRESS$ -b $ARG1$ -D $ARG2$ -P $USER4$ -3
}
services.cfg
define service{
use generic-service
host_name targethost
service_description LDAP
check_command check_ldap!dc=example,dc=com!cn=Manager,dc=example,dc=com
}
監視対象ホスト targethost の LDAP サーバに、プロトコル・バージョン 3、LDAP base dc=example,dc=com、LDAP bind DN cn=Manager,dc=example,dc=com で問合せます。ここで LDAP サーバのパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。
check_load
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description LOAD
check_command check_local_load!15,10,5!30,25,20
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのロード・アベレージの一分間平均,五分間平均,十五分間平均がそれぞれ、30,25,20 以上なら状態 CRITICAL を, 15,10,5 以上なら状態 WARNING を返します。
check_log
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_log
command_line $USER1$/check_log -F $ARG1$ -O $ARG2$ -q $ARG3$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description LOG
check_command check_log!/var/log/messages!/var/log/messages.old!'foo'
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのファイル /var/log/messages に文字列 foo を検索します。ファイル /var/log/messages.old は、検索後の/var/log/messages のコピーです。したがって重要なファイルを誤って指定すると /var/log/messges で上書きされてしまいます。
check_mailq
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_mailq
command_line $USER1$/check_mailq -w $ARG1$ -c $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description MAILQ
check_command check_mailq!100!300
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのメール・キューに存在するメッセージ数が 300 以上なら状態 CRITICAL を、100 以上なら状態 WARNING を返します。
check_mrtg
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_mrtg
command_line $USER1$/check_mrtg -F $ARG1$ -a $ARG2$ -v $ARG3$ -w $ARG4$ -c $ARG5$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description MRTG
check_command check_mrtg!/home/www/data/mrtg/targethost.example.com_1.log!AVG!1!131072!262144
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストの MRTG のログ・ファイル /home/www/data/mrtg/targethost.example.com_1.log に基づいて、受信の平均値が 2Mbps より多ければ状態 CRITICAL を、1Mbps より多ければ状態 WARNING を返します。
check_mrtgtraf
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description MRTGTRAF
check_command check_mrtgtraf!/home/www/data/mrtg/targethost.example.com_1.log!AVG!131072,131072!262144,262144
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストの MRTG のログ・ファイル /home/www/data/mrtg/targethost.example.com_1.log に基づいて、受信,送信の平均値が 2Mbps より多ければ状態 CRITICAL を、1Mbps より多ければ状態 WARNING を返します。
check_mysql
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_mysql
command_line $USER1$/check_mysql -d $ARG1$ -H $HOSTADDRESS$ -u $ARG2$ -p $USER4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description MYSQL
check_command check_mysql!nagios!nagios
}
監視対象ホスト targethost の MySQL サーバのデータベース nagios に MySQL ユーザ nagios で接続します。ここで MySQL ユーザ nagios のパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。
check_mysql_query
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_mysql_query
command_line $USER1$/check_mysql_query -q $ARG1$ -d $ARG2$ -H $HOSTADDRESS$ -u $ARG3$ -p $USER4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description MYSQL_QUERY
check_command check_mysql_query!'SELECT * FROM plugins'!nagios!nagios
}
監視対象ホスト targethost の MySQL サーバのデータベース nagios に MySQL ユーザ nagios で接続し、テーブル plugins に対して `SELECT * FROM plugins’ と問合せます。ここで MySQL ユーザ nagios のパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。
MySQL からの返り値は数値でなければなりません。
check_nagios
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_nagios
command_line $USER1$/check_nagios -e $ARG1$ -F /usr/local/nagios/var/nagios.log -C /usr/local/nagios/bin/nagios
}
services.cfg
define service{
use generic-service
host_name targethost
service_description NAGIOS
check_command check_nagios!5
}
Nagios サーバの nagios のプロセスをチェックします。
check_nt
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -v $ARG1$
}
services.cfg
define service{
use generic-service
host_name windows
service_description NT
check_command check_nt!CLIENTVERSION
}
監視対象ホスト windows (Windows PC) の NSClient サービスに CLIENTVERSION の値を問合せます。
check_ntp
ccommands.cfg (2.11), heckcommands.cfg (2.5)
define command{
command_name check_ntp
command_line $USER1$/check_ntp -H $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description NTP
check_command check_ntp
}
監視対象ホスト targethost に対してコマンド ntpdate(8) を実行します。
check_pgsql
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_pgsql
command_line $USER1$/check_pgsql -H $HOSTADDRESS$ -d $ARG1$ -l $ARG2$ -p $USER4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description PGSQL
check_command check_pgsql!nagios!postgres
}
監視対象ホスト targethost の PostgreSQL サーバのデータベース nagios に PostgreSQL ユーザ postgres で接続します。ここで PostgreSQL ユーザ postgres のパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。
check_ping
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p $ARG3$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description PING
check_command check_ping!300.0,30%!500.0,50%!3
}
監視対象ホスト targethost へのコマンド ping(8) の応答(ICMP パケット数 3)が、RTA(round trip average travel time) が 500ms 以上、パケット・ロスが 50% 以上なら状態 CRITICAL を、RTA が 300ms 以上、パケット・ロスが 30% 以上なら状態 WARNING を返します。
check_procs
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_local_procs
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description PROCS
check_command check_local_procs!10!20!Z
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストの Zombie プロセス数が 20 より多ければ状態 CRITICAL を、10 より多ければ状態 WARNING を返します。
check_radius
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_radius
command_line /usr/bin/sudo $USER1$/check_radius -H $HOSTADDRESS$ -F $ARG1$ -u $USER3$ -p $USER4$ -P 1812 -t $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description RADIUS
check_command check_radius!/usr/local/etc/radiusclient/radiusclient.conf!10
}
監視対象ホスト targethost の RADIUS サーバ(ポート番号 1812)に接続します(タイムアウト 10 秒)。ここで、ユーザは $USER3$、そのパスワードは $USER4$ として参照され、それらは resources.cfg で設定されています。radiusclient の設定ファイルは /usr/local/etc/radiusclient/radiusclient.conf です。
sudo(8) の設定: /etc/sudoers
nagios ALL=(root) NOPASSWD: /usr/local/nagios/libexec/check_radius
check_rpc
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_rpc
command_line $USER1$/check_rpc -H $HOSTADDRESS$ -C $ARG1$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description RPC
check_command check_rpc!portmap
}
監視対象ホスト targethost で portmap が動作しているかチェックします。
check_smtp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_smtp
command_line $USER1$/check_smtp -H $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description SMTP
check_command check_smtp
}
監視対象ホスト targethost に SMTP 接続を試みます。
check_snmp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -l $ARG3$ -u $ARG4$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description SNMP
check_command check_snmp!public!.1.3.6.1.4.1.2021.11.9.0,.1.3.6.1.4.1.2021.11.10.0,.1.3.6.1.4.1.2021.11.11.0!'CPU usage (user system idle)'!'%,%,%'
}
監視対象ホスト targethost の SNMT コミュニティ public に CPU 使用率を問合せます。
check_ssh
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_ssh
command_line $USER1$/check_ssh -H $HOSTADDRESS$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description SSH
check_command check_ssh
}
監視対象ホスト targethost に SSH 接続を試みます。
check_swap
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_swap
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description SWAP
check_command check_swap!50%!30%
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストの空きスワップ領域が 30% 以下なら状態 CRITICAL を、50% 以下なら状態 WARNING を返します。
check_tcp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description TCP
check_command check_tcp!873
}
監視対象ホスト targethost のポート番号 873 に TCP 接続します。
check_udp
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_udp
command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description UDP
check_command check_udp!873
}
監視対象ホスト targethost のポート番号 873 に UDP 接続します。
check_users
commands.cfg (2.11), checkcommands.cfg (2.5)
define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
services.cfg
define service{
use generic-service
host_name targethost
service_description USERS
check_command check_local_users!10!30
}
プラグイン check_by_ssh や NRPE 経由で監視対象とするホストのログインしているユーザ数が 30 以上なら状態 CRITICAL を、10 以上 なら状態 WARNING を返します。
