define command {
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}
define command {
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 4000.0,90% -c 6000.0,100% -p 5
}
# '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
}
define command {
command_name notify-by-email
command_line /usr/bin/printf "%b" "***** NAGIOS *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s "[nagios] $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTEMAIL$
}
# 'host-notify-by-email' command definition
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: $DATETIME$\n" | /bin/mail -s "[nagios] $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}
define host {
name generic-host ; The name of this host template
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 0 ; Process performance data
retain_status_information 1 ; Retain status information
retain_nonstatus_information 1 ; Retain non-status information
max_check_attempts 10
alias HOST
check_command check-host-alive
notification_interval 60
notification_period 24x7
notification_options d,u,r
register 0 ; it's just a template
}
# ---------------------------------------------------------------------------- #
# generic/global service definition template
define service {
name generic-service
active_checks_enabled 1 ; Active service checks are enabled
passive_checks_enabled 1 ; Passive service checks are enabled
parallelize_check 1 ; parallelize service checks
obsess_over_service 1 ; obsess over this service
check_freshness 0 ; check service 'freshness' default 0
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
retain_nonstatus_information 1 ; Retain non-status information
retry_check_interval 2 ; retry every 2 minutes
is_volatile 0
max_check_attempts 3 ; check at least 3 times
normal_check_interval 5 ; check every 5 minutes
retry_check_interval 1 ; retry every minute
contact_groups testcontacts ; tell the unix team
notification_interval 120 ; renotify every 2 hours
notification_period 24x7 ; notify 24x7
check_period 24x7 ; monitor 24x7
notification_options w,c,r ; Warnings,Critical,Recoverd,Unknown
register 0 ; this is only a template
}
# ---------------------------------------------------------------------------- #
# THE contact template
define contact {
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,c,r
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email
register 0
}
define contact {
use generic-contact
contact_name testuser1
alias The Test User
email root@localhost
pager 5555555555
}
define contactgroup {
contactgroup_name testcontacts
alias Some Test Contacts
members testuser1
}
define contactgroup {
contactgroup_name otherusers
alias Another Contact Group For Testing
members testuser1
}
define host {
use generic-host
host_name localhost
address 127.0.0.1
}
define host {
use generic-host
host_name tsohlacol
address 127.0.0.1
}
define hostgroup{
hostgroup_name local_hosts
alias Local Hosts
contact_groups testcontacts
members localhost
}
define service {
use generic-service
hostgroup_name local_hosts
host_name tsohlacol
service_description telnet
check_command check_tcp!21
}
define serviceescalation {
host_name localhost
service_description telnet
first_notification 2
last_notification 6
contact_groups otherusers
notification_interval 0
}