Modified: 28 May 2006
日本語訳の解説ページ
http://nagios.x-trans.jp/Nagios-doc/JAPANESE/toc.html
うまく動作しないときログをとる方法 (28 May 2006)
他のサーバーのリソース監視する方法 - Linux: CentOS3 (28 May 2006)
他のサーバーのリソース監視する方法 - Linux: Redhat7.3 (7 January 2006)
他のサーバーのリソース監視する方法 - Windows (7 January 2006)
新しいサービスコマンドを追加する方法 (7 January 2006)
携帯電話へメール通知する方法 (6 January 2006)
複数人に通知する方法 (14 February 2006)
通知メールの内容を編集する方法 (6 January 2006)
設定ファイルをチェックする方法 (6 January 2006)
起動/停止/再起動の方法 (6 January 2006)
IMAPのチェックをしたいですが、サービスコマンドが用意されていないので自分で追加してみました。
まず、プラグインの存在をチェックします。
"/usr/local/nagios/libexec"を確認します。それらしきファイル("check_imap ")が見つかりました。
$ ls check_breeze check_flexlm check_log check_oracle check_ssh negate check_by_ssh check_ftp check_mailq check_overcr check_swap urlize check_dhcp check_http check_mrtg check_ping check_tcp utils.pm check_dig check_icmp check_mrtgtraf check_pop check_time utils.sh check_disk check_ifoperstatus check_nagios check_procs check_udp check_disk_smb check_ifstatus check_nntp check_real check_udp2 check_dns check_imap check_nt check_rpc check_ups check_dummy check_ircd check_ntp check_sensors check_users check_file_age check_load check_nwstat check_smtp check_wave $check_imapの仕様を確認してみます。
$ ./check_imap -h check_IMAP (nagios-plugins 1.4.2) 1.66 Copyright (c) 1999 Ethan Galstad <nagios@nagios.org> Copyright (c) 1999-2004 Nagios Plugin Development Team <nagiosplug-devel@lists.sourceforge.net> This plugin tests IMAP connections with the specified host. Usage: check_IMAP -H host -p port [-w <warning time>] [-c <critical time>] [-s <send string>] [-e <expect string>] [-q <quit string>] [-m <maximum bytes>] [-d <delay>] [-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j] [-D <days to cert expiry>] [-S <use SSL>] Options: -h, --help Print detailed help screen -V, --version Print version information -H, --hostname=ADDRESS Host name or IP Address -p, --port=INTEGER Port number (default: none) -4, --use-ipv4 Use IPv4 connection -6, --use-ipv6 Use IPv6 connection -s, --send=STRING String to send to the server -e, --expect=STRING String to expect in server response -q, --quit=STRING String to send server to initiate a clean close of the connection -r, --refuse=ok|warn|crit Accept tcp refusals with states ok, warn, crit (default: crit) -M, --mismatch=ok|warn|crit Accept expected string mismatches with states ok, warn, crit (default: warn) -j, --jail Hide output from TCP socket -m, --maxbytes=INTEGER Close connection once more than this number of bytes are received -d, --delay=INTEGER Seconds to wait between sending string and polling for response -w, --warning=DOUBLE Response time to result in warning status (seconds) -c, --critical=DOUBLE Response time to result in critical status (seconds) -t, --timeout=INTEGER Seconds before connection times out (default: 10) -v, --verbose Show details for command-line debugging (Nagios may truncate output) Send email to nagios-users@lists.sourceforge.net if you have questions regarding use of this software. To submit patches or suggest improvements, send email to nagiosplug-devel@lists.sourceforge.net $"/usr/local/nagios/etc/checkcommands.cfg"に、以下を追加します。
: # 'check_imap' command definition define command{ command_name check_imap command_line $USER1$/check_imap -H $HOSTADDRESS$ } :"/usr/local/nagios/etc/services.cfg"に、以下を追加します。
: ### IMAP Service ### define service{ use generic-service2 host_name mailserver service_description IMAP check_command check_imap } :
"contacts.cfg"の"pager" で指定できます。
define contact{ contact_name nagios : email notify@tomo.ac pager notify@docomo.ne.jp }
まず、"contacts.cfg"に新しい通知先と通知条件を登録します。
define contact{ contact_name nagios3 :追加した"contact_name"を、"contactgroups.cfg"の"contactgroup"にメンバー追加します。
define contactgroup{ contactgroup_name admins2 alias Administrators2 members nagios2,nagios3 }define contact{ contact_name nagios1
以下のコマンドでチェックできます。以下のように、"0"が表示されればOKです。
"Total Warnings: 0"
"Total Errors: 0"
$ nagios -v nagios.cfg Nagios 1.3 Copyright (c) 1999-2004 Ethan Galstad (nagios@nagios.org) Last Modified: 11-17-2005 License: GPL Reading configuration data... Running pre-flight check on configuration data... Checking services... Checked 34 services. Checking hosts... Checked 24 hosts. Checking host groups... Checked 2 host groups. Checking contacts... Checked 2 contacts. Checking contact groups... Checked 2 contact groups. Checking service escalations... Checked 0 service escalations. Checking host group escalations... Checked 0 host group escalations. Checking service dependencies... Checked 0 service dependencies. Checking host escalations... Checked 0 host escalations. Checking host dependencies... Checked 0 host dependencies. Checking commands... Checked 22 commands. Checking time periods... Checked 4 time periods. Checking for circular paths between hosts... Checking for circular service execution dependencies... Checking global event handlers... Checking obsessive compulsive service processor command... Checking misc settings... Total Warnings: 0 Total Errors: 0 Things look okay - No serious problems were detected during the pre-flight check $
"misccommands.cfg"を編集して行います。
起動の方法
# service nagios start停止の方法
# service nagios stop再起動の方法
# service nagios restart設定を反映させる方法
# service nagios reload