http://www.nagios.org/
現状では, 新しいバージョンのnagiosは~x86になっているので,
/etc/portage/package.keywordsに
以下を書き込む.
net-analyzer/nagios ~x86 net-analyzer/nagios-core ~x86 net-analyzer/nagios-imagepack ~x86 net-analyzer/nagios-nrpe ~x86 net-analyzer/nagios-nsca ~x86 net-analyzer/nagios-plugins ~x86
その上で,
emerge -uD nagios
を実行. /etc/conf.d/apache2でAPACHE2_OPTSに
-D NAGIOS
を付け加えてApache2を再起動するとNagiosが起動される.
/usr/nagios/sbinと/usr/nagios/libexecに.htaccessでアクセス制限を
かけるのを忘れないように.
/etc/nagiosにいれる設定ファイルはgzip圧縮されて
/usr/share/doc/nagios-core-2.0/sample-configs/
に保存されている.
設定ファイルの例:
********** cgi.cfg **********
main_config_file=/etc/nagios/nagios.cfg physical_html_path=/usr/nagios/share url_html_path=/nagios show_context_help=0 use_authentication=1 authorized_for_system_information=hi-lo authorized_for_configuration_information=hi-lo authorized_for_system_commands=hi-lo authorized_for_all_services=hi-lo authorized_for_all_hosts=hi-lo authorized_for_all_service_commands=hi-lo authorized_for_all_host_commands=hi-lo default_statusmap_layout=5 default_statuswrl_layout=4 ping_syntax=/bin/ping -n -U -c 5 $HOSTADDRESS$ refresh_rate=90
********** nagios.cfg **********
log_file=/var/nagios/nagios.log cfg_file=/etc/nagios/checkcommands.cfg cfg_file=/etc/nagios/misccommands.cfg cfg_file=/etc/nagios/contacts.cfg cfg_file=/etc/nagios/hosts.cfg cfg_file=/etc/nagios/services_abstract.cfg cfg_file=/etc/nagios/services_host_a.cfg cfg_file=/etc/nagios/services_host_a.cfg cfg_file=/etc/nagios/timeperiods.cfg object_cache_file=/var/nagios/objects.cache resource_file=/etc/nagios/resource.cfg status_file=/var/nagios/status.dat nagios_user=nagios nagios_group=nagios check_external_commands=1 command_check_interval=-1 command_file=/var/nagios/rw/nagios.cmd comment_file=/var/nagios/comments.dat downtime_file=/var/nagios/downtime.dat lock_file=/var/nagios/nagios.lock temp_file=/var/nagios/nagios.tmp event_broker_options=-1 log_rotation_method=w log_archive_path=/var/nagios/archives use_syslog=1 log_notifications=1 log_service_retries=1 log_host_retries=1 log_event_handlers=1 log_initial_states=0 log_external_commands=1 log_passive_checks=1 service_inter_check_delay_method=s max_service_check_spread=30 service_interleave_factor=s host_inter_check_delay_method=s max_host_check_spread=30 max_concurrent_checks=0 service_reaper_frequency=10 auto_reschedule_checks=0 auto_rescheduling_interval=30 auto_rescheduling_window=180 sleep_time=0.25 service_check_timeout=60 host_check_timeout=30 event_handler_timeout=30 notification_timeout=30 ocsp_timeout=5 perfdata_timeout=5 retain_state_information=1 state_retention_file=/var/nagios/retention.dat retention_update_interval=60 use_retained_program_state=1 use_retained_scheduling_info=0 interval_length=60 use_aggressive_host_checking=0 execute_service_checks=1 accept_passive_service_checks=1 execute_host_checks=1 accept_passive_host_checks=1 enable_notifications=1 enable_event_handlers=1 process_performance_data=0 obsess_over_services=0 check_for_orphaned_services=0 check_service_freshness=1 service_freshness_check_interval=60 check_host_freshness=0 host_freshness_check_interval=60 aggregate_status_updates=1 status_update_interval=15 enable_flap_detection=0 low_service_flap_threshold=5.0 high_service_flap_threshold=20.0 low_host_flap_threshold=5.0 high_host_flap_threshold=20.0 date_format=us p1_file=/usr/nagios/bin/p1.pl illegal_object_name_chars=`~!$%^&*|'"<>?,()= illegal_macro_output_chars=`~$&|'"<> use_regexp_matching=0 use_true_regexp_matching=0 admin_email=nagios admin_pager=pagenagios daemon_dumps_core=0
********** timeperiods.cfg **********
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 }
********** hosts.cfg **********
define host{ name generic-host notifications_enabled 1 event_handler_enabled 1 ;イベントハンドラの有無 flap_detection_enabled 1 ;状態反転の検出 failure_prediction_enabled 1 ; Failure prediction is enabled process_perf_data 1 ;パフォーマンス統計 retain_status_information 1 ;状態情報の保存 retain_nonstatus_information 1 ; 状態以外の情報の保存 check_command check-host-alive max_check_attempts 10 ;最大リトライ回数 notification_interval 120 ;通知間隔 notification_period 24x7 ;通知時間帯 notification_options d,u,r ;通知オプション register 0 ;このオプションにてtemplateと認識させる } define host{ use generic-host ;使用するテンプレート名 host_name host_a ;ホスト名 alias host_a ;エイリアス address xxx.xxx.xxx.xxx ;IPアドレス contact_groups admin-contactgroup } define hostgroup{ hostgroup_name fk-hostgroup alias fk-hostgroup members host_a }
********** contacts.cfg **********
define contact{ name generic-contact service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r ;Warning Unknown Critical Recover None host_notification_options d,u,r ;Down Unreachable recover service_notification_commands notify-by-email host_notification_commands host-notify-by-email register 0 } define contact{ use generic-contact contact_name host_a_admin alias host_a root email root@xxxx.xxx pager root@xxxx.xxx } define contactgroup{ contactgroup_name admin-contactgroup alias admin-contactgroup members host_a_admin }
********** nrpe.cfg **********
pid_file=/var/run/nrpe.pid server_port=5666 nrpe_user=nagios nrpe_group=nagios dont_blame_nrpe=1 debug=0 command_timeout=60 command[check_users]=/usr/nagios/libexec/check_users -w $ARG1$ -c $ARG2$ command[check_load]=/usr/nagios/libexec/check_load -w $ARG1$ -c $ARG2$ command[check_disk]=/usr/nagios/libexec/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ command[check_procs]=/usr/nagios/libexec/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
********** checkcommands.cfg **********
define command{ command_name check_dns command_line $USER1$/check_dns -H www.yahoo.com -s $HOSTADDRESS$ } define command{ command_name check_ftp command_line $USER1$/check_ftp -H $HOSTADDRESS$ } define command{ command_name check_http command_line $USER1$/check_http -H $HOSTADDRESS$ } define command{ command_name check_https command_line $USER1$/check_http -S -H $HOSTADDRESS$ } define command{ command_name check_local_disk command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ } define command{ command_name check_local_load command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ } define command{ command_name check_local_procs command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ } define command{ command_name check_local_users command_line $USER1$/check_users -w $ARG1$ -c $ARG2$ } define command{ command_name check_nntp command_line $USER1$/check_nntp -H $HOSTADDRESS$ } define command{ command_name check_ping command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 } define command{ command_name check_pop command_line $USER1$/check_pop -H $HOSTADDRESS$ } define command{ command_name check_pops command_line $USER1$/check_spop -p 995 -H $HOSTADDRESS$ } define command{ command_name check_smtp command_line $USER1$/check_smtp -H $HOSTADDRESS$ } define command{ command_name check_tcp command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ } define command{ command_name check_telnet command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 23 } define command{ command_name check_ssh command_line $USER1$/check_ssh -H $HOSTADDRESS$ } define command{ command_name check_udp command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ } define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ } define command{ command_name check-host-alive command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1 }
********** services_abstract.cfg **********
define service{ name generic-service check_period 24x7 max_check_attempts 3 ;リトライ回数 normal_check_interval 10 ;検知間隔 retry_check_interval 1 ;リトライ間隔 notification_interval 120 ;通知間隔 notification_period 24x7 notification_options w,u,c,r ;Warning Unknown Critical Recover None active_checks_enabled 1 ; Active service checks are enabled passive_checks_enabled 1 ; Passive service checks are enabled/accepted parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems) obsess_over_service 1 ; We should obsess over this service (if necessary) check_freshness 0 ; Default is to NOT check service 'freshness' notifications_enabled 1 ; Service notifications are enabled event_handler_enabled 1 ; Service 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 is_volatile 0 register 0 } define service{ use generic-service name generic-http service_description HTTP check_command check_http register 0 } define service{ use generic-service name generic-https service_description HTTPS check_command check_https register 0 } define service{ use generic-service name generic-ping service_description PING check_command check_ping!100.0,20%!500.0,60% register 0 } define service{ use generic-service name generic-smtp service_description SMTP check_command check_smtp register 0 } define service{ use generic-service name generic-ftp service_description FTP check_command check_ftp register 0 } define service{ use generic-service name generic-pop3 service_description POP3 check_command check_pop register 0 } define service{ use generic-service name generic-pop3s service_description POP3S check_command check_pops register 0 } define service{ use generic-service name generic-ssh service_description SSH check_command check_ssh register 0 } define service{ use generic-service name generic-dns service_description DNS check_command check_dns register 0 } define service{ use generic-service name generic-current_users service_description Current Users check_command check_local_users!75!150 register 0 } define service{ use generic-service name generic-total_processes service_description Total Processes check_command check_local_procs!170!220!RSZDT register 0 } define service{ use generic-service name generic-current_load max_check_attempts 4 normal_check_interval 5 notification_interval 960 service_description Current Load check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0 register 0 } define service{ use generic-service name generic-hdd_free_space service_description /dev/hda1 Free Space check_command check_local_disk!20%!10%!/dev/hda1 register 0 } define service{ use generic-service name generic-PrinterStatus service_description Printer Status check_command check_hpjd register 0 } define service{ use generic-service name generic-current_users-nrpe service_description Current Users check_command check_nrpe!check_users!75 150 register 0 } define service{ use generic-service name generic-total_processes-nrpe service_description Total Processes check_command check_nrpe!check_procs!150 200 RSZDT register 0 } define service{ use generic-service name generic-current_load-nrpe service_description LOAD max_check_attempts 4 normal_check_interval 5 notification_interval 960 service_description Current Load check_command check_nrpe!check_load!5.0,4.0,3.0 10.0,6.0,4.0 register 0 } define service{ use generic-service name generic-hdd_free_space-nrpe service_description /dev/hda1 Free Space check_command check_nrpe!check_disk!20%!10%!/dev/hda1 register 0 }
********** services_host_a.cfg **********
define service{ use generic-smtp host_name host_a contact_groups admin-contactgroup } define service{ use generic-http host_name host_a contact_groups admin-contactgroup } define service{ use generic-ssh host_name host_a contact_groups admin-contactgroup } define service{ use generic-ping host_name host_a contact_groups admin-contactgroup } define service{ use generic-current_users-nrpe host_name host_a contact_groups admin-contactgroup } define service{ use generic-total_processes-nrpe host_name host_a contact_groups admin-contactgroup } define service{ use generic-current_load-nrpe host_name host_a contact_groups admin-contactgroup }
0 件のコメント:
新しいコメントは書き込めません。