#################################### # Contacts and Times #################################### 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 } define contact{ contact_name nagios-admin 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 [add your email address] } define contactgroup{ contactgroup_name admins alias Nagios Administrators members nagios-admin } #################################### # Notification Commands #################################### define command{ command_name notify-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ } define command{ command_name host-notify-by-email command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $OUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$ } #################################### # Ping Commands #################################### define command{ command_name check-host-alive command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 99,99% -c 100,100% -p 1 } define command{ command_name check-somehost-alive command_line $USER1$/check_ping -H $ARG1$ -w 99,99% -c 100,100% -p 1 } #################################### # Misc Check Commands #################################### define command{ command_name check_disk command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ } define command{ command_name check_dns command_line $USER1$/check_dns -H $ARG1$ } define command{ command_name check_http command_line $USER1$/check_http -w $ARG2$ -c $ARG3$ -H $ARG1$ -u http://$ARG1$ } #################################### # Host Template #################################### define host{ name ez-host notifications_enabled 1 event_handler_enabled 1 flap_detection_enabled 1 failure_prediction_enabled 1 process_perf_data 1 retain_status_information 1 retain_nonstatus_information 1 register 0 check_command check-host-alive max_check_attempts 2 normal_check_interval 5 notification_interval 0 notification_period 24x7 notification_options d,r contact_groups admins } #################################### # Router #################################### define host{ use ez-host host_name router alias router address 192.168.0.1 } #################################### # Mybox #################################### define host{ use ez-host host_name mybox alias mybox address 192.168.0.123 } #################################### # Dreamhost #################################### define host{ use ez-host host_name dreamhost alias dreamhost address [add address here] } define hostgroup{ hostgroup_name All alias All members mybox,dreamhost,router } #################################### # Service Template #################################### define service{ name ez-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 failure_prediction_enabled 1 process_perf_data 1 retain_status_information 1 retain_nonstatus_information 1 register 0 is_volatile 0 max_check_attempts 1 check_period 24x7 normal_check_interval 60 retry_check_interval 1 contact_groups admins notification_options w,u,c,r notification_interval 0 notification_period 24x7 } #################################### # Iostat Plugin #################################### define command{ command_name iostat command_line $USER1$/check_iostat --url=$ARG1$ } #################################### # Iostat Service #################################### define service{ use ez-service host_name dreamhost service_description Iostat check_command iostat!http://xxx.yyy.zzz/cgi/iostat.cgi } #################################### # All Services #################################### define service{ use ez-service service_description DiscRoot check_command check_disk!10%!5%!/ host_name mybox } define service{ use ez-service service_description DiscData1 check_command check_disk!10%!5%!/mnt/big1 host_name mybox } define service{ use ez-service service_description DiscHome check_command check_disk!10%!5%!/mnt/big2 host_name mybox } define service{ use ez-service service_description DiscData2 check_command check_disk!10%!5%!/mnt/big3 host_name mybox } define service{ use ez-service host_name mybox service_description Webserver:80 check_command check_http!localhost!1!2 } define service{ use ez-service host_name mybox service_description Temperature Outside check_command check_temperature!35!40!Outside } define service{ use ez-service host_name mybox service_description Temperature Inside check_command check_temperature!25!30!Inside } define service{ use ez-service host_name router service_description Netgear check_command check-somehost-alive!192.168.0.1 } define service{ use ez-service host_name router service_description PacBell DNS check_command check_dns!www.microsoft.com } define service{ use ez-service host_name router service_description www.google.com check_command check_http!www.google.com!1!2 } #################################### # Special Commands #################################### define command{ command_name check_temperature command_line $USER1$/check_temperature -warn=$ARG1$ -crit=$ARG2$ -dsname=$ARG3$ }