nagios:*:506:506::0:0:nagios user:/:/sbin/nologin |
nagios:*:506: |
INIT_OPTS=-o root -g wheel |
hoge# ./configure --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include |
hoge# make all . . . hoge# make install install-init install-commandmode install-config |
hoge# ./configure hoge# make . . . hoge# make install |
ScriptAlias /nagios/cgi-bin/ "/usr/local/nagios/sbin/" <Directory "/usr/local/nagios/sbin"> AllowOverride AuthConfig Options ExecCGI Order allow,deny Allow from all </Directory> Alias /nagios/ "/usr/local/nagios/share/" <Directory "/usr/local/nagios/share"> AllowOverride AuthConfig Order allow,deny Allow from all </Directory> |
hoge# ee /usr/local/nagios/sbin/.htaccess |
AuthName "Please enter username and password" AuthType basic AuthUserFile /var/www/.htpasswd AuthGroupFile /dev/null <Limit GET POST> require valid-user </Limit> |
hoge# cp /usr/local/nagios/sbin/.htaccess /usr/local/nagios/share/. |
hoge# htpasswd -c /var/www/.htpasswd ユーザー名 hoge# New password: hoge# Re-type new password: hoge# Adding password for user ユーザー名 |
hoge# /usr/local/sbin/apachectl restart |
hoge# cd /usr/local/nagios/etc/ hoge# cp cgi.cfg-sample cgi.cfg hoge# cp checkcommands.cfg-sample checkcommands.cfg hoge# cp contacts.cfg-sample contacts.cfg hoge# cp hosts.cfg-sample hosts.cfg hoge# cp misccommands.cfg-sample misccommands.cfg hoge# cp nagios.cfg-sample nagios.cfg hoge# cp resource.cfg-sample resource.cfg hoge# cp services.cfg-sample services.cfg hoge# cp timeperiods.cfg-sample timeperiods.cfg |
authorized_for_system_information=nagiosadmin,admin authorized_for_configuration_information=nagiosadmin,admin authorized_for_system_commands=nagiosadmin,admin authorized_for_all_services=nagiosadmin,admin authorized_for_all_hosts=nagiosadmin,admin authorized_for_all_service_commands=nagiosadmin,admin authorized_for_all_host_commands=nagiosadmin,admin |
#log_file=/usr/local/nagios/var/nagios.log log_file=/var/log/nagios.log #cfg_file=/usr/local/nagios/etc/contactgroups.cfg cfg_file=/usr/local/nagios/etc/contacts.cfg #cfg_file=/usr/local/nagios/etc/dependencies.cfg #cfg_file=/usr/local/nagios/etc/escalations.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 |
# 'nagios' contact definition define contact{ contact_name admin #Apache の認証ユーザー名 alias Nagios Admin service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r service_notification_commands notify-by-email,notify-by-epager host_notification_commands host-notify-by-email,host-notify-by-epager email hoge@xxx.xxx.net メールアドレス pager hoge@xxx.xxx.jp その他アドレス } #以下の行を新たに追加 define contactgroup { contactgroup_name xxxhost-admin #好きな名前のグループを作成 alias xxxhost Administrators #上に合わせて適当に・・・ members admin #認証ログインするユーザー名(管理者?)設定した名前を記入 } |
# Generic host definition template define host{ name generic-host ;テンプレート名 notifications_enabled 1 ;通知の有無 event_handler_enabled 1 ;イベントハンドラの有無 flap_detection_enabled 1 ;状態反転の検出 process_perf_data 1 ;パフォーマンス統計 retain_status_information 1 ;状態情報の保存 retain_nonstatus_information 1 ;状態以外の情報の保存 register 0 ;このオプションにてtemplateと認識させる } # 'abchost' host definition define host{ use generic-host ; Name of host template to use host_name abchost ;監視するホストの名前 alias router ;ここは適当に address 192.168.XX.02 ;ここは、そのホストのアドレスを記入 check_command check-host-alive max_check_attempts 10 ;最大リトライ回数 notification_interval 300 ;通知間隔 notification_period 24x7 ;通知時間帯 notification_options d,u,r ;通知オプション # parent gateway } # 'abchost2' host definition define host{ use generic-host ; Name of host template to use host_name abchost2 ;監視するホストの名前 alias host2 ;ここは適当に address 192.168.1.xx ;ここは適切に check_command check-host-alive max_check_attempts 10 notification_interval 300 notification_period 24x7 notification_options d,u,r #parents ieserver ;親子関係 } #以下、ホストのグループを設定します define hostgroup { hostgroup_name all alias all contact_groups xxxhost-admin #contacts.cfgで設定したcontactgroup_name members abchost,abchost2 #ここで設定した監視ホスト } |
# Generic service definition template 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 register 0 } # Service definition define service{ use generic-service ; Name of service template to use host_name abchost ;hosts.cfgで設定した監視するホスト service_description SMTP ;監視するサービス is_volatile 0 check_period 24x7 ;監視する時間帯 max_check_attempts 3 ;リトライ回数 normal_check_interval 3 ;検知間隔 retry_check_interval 1 ;リトライ間隔 contact_groups xxxhost-admin ;問題発生時の連絡先(contacts.cfgで設定したcontactgroup_name) notification_interval 120 ;通知間隔 notification_period 24x7 ;通知時間帯 notification_options w,u,c,r check_command check_smtp ;(チェックに用いるコマンド、checkcommands.cfgで定義した名前) } . . . 長いので省略 |
hoge# /usr/local/nagios/bin/nagios -v nagios.cfg hoge# Total Warnings: 0 hoge# Total Errors: 0 hoge# Things look okay - No serious problems were detected during the pre-flight check |
hoge# /usr/local/etc/rc.d/nagios start |