1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
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
}
|