| 1 | ###############################################################################
|
---|
| 2 | # COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 3.2.2
|
---|
| 3 | #
|
---|
| 4 | # Last Modified: 05-31-2007
|
---|
| 5 | #
|
---|
| 6 | # NOTES: This config file provides you with some example command definitions
|
---|
| 7 | # that you can reference in host, service, and contact definitions.
|
---|
| 8 | #
|
---|
| 9 | # You don't need to keep commands in a separate file from your other
|
---|
| 10 | # object definitions. This has been done just to make things easier to
|
---|
| 11 | # understand.
|
---|
| 12 | #
|
---|
| 13 | ###############################################################################
|
---|
| 14 |
|
---|
| 15 |
|
---|
| 16 | ################################################################################
|
---|
| 17 | #
|
---|
| 18 | # SAMPLE NOTIFICATION COMMANDS
|
---|
| 19 | #
|
---|
| 20 | # These are some example notification commands. They may or may not work on
|
---|
| 21 | # your system without modification. As an example, some systems will require
|
---|
| 22 | # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
|
---|
| 23 | #
|
---|
| 24 | ################################################################################
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | # 'notify-host-by-email' command definition
|
---|
| 28 | define command{
|
---|
| 29 | command_name notify-host-by-email
|
---|
| 30 | command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | # 'notify-service-by-email' command definition
|
---|
| 34 | define command{
|
---|
| 35 | command_name notify-service-by-email
|
---|
| 36 | 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$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 |
|
---|
| 43 | ################################################################################
|
---|
| 44 | #
|
---|
| 45 | # SAMPLE HOST CHECK COMMANDS
|
---|
| 46 | #
|
---|
| 47 | ################################################################################
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | # This command checks to see if a host is "alive" by pinging it
|
---|
| 51 | # The check must result in a 100% packet loss or 5 second (5000ms) round trip
|
---|
| 52 | # average time to produce a critical error.
|
---|
| 53 | # Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
|
---|
| 54 |
|
---|
| 55 | # 'check-host-alive' command definition
|
---|
| 56 | define command{
|
---|
| 57 | command_name check-host-alive
|
---|
| 58 | command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 10
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | ################################################################################
|
---|
| 65 | #
|
---|
| 66 | # SAMPLE SERVICE CHECK COMMANDS
|
---|
| 67 | #
|
---|
| 68 | # These are some example service check commands. They may or may not work on
|
---|
| 69 | # your system, as they must be modified for your plugins. See the HTML
|
---|
| 70 | # documentation on the plugins for examples of how to configure command definitions.
|
---|
| 71 | #
|
---|
| 72 | # NOTE: The following 'check_local_...' functions are designed to monitor
|
---|
| 73 | # various metrics on the host that Nagios is running on (i.e. this one).
|
---|
| 74 | ################################################################################
|
---|
| 75 |
|
---|
| 76 | # 'check_local_disk' command definition
|
---|
| 77 | define command{
|
---|
| 78 | command_name check_local_disk
|
---|
| 79 | command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 |
|
---|
| 83 | # 'check_local_load' command definition
|
---|
| 84 | define command{
|
---|
| 85 | command_name check_local_load
|
---|
| 86 | command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | # 'check_local_procs' command definition
|
---|
| 91 | define command{
|
---|
| 92 | command_name check_local_procs
|
---|
| 93 | command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | # 'check_local_users' command definition
|
---|
| 98 | define command{
|
---|
| 99 | command_name check_local_users
|
---|
| 100 | command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 |
|
---|
| 104 | # 'check_local_swap' command definition
|
---|
| 105 | define command{
|
---|
| 106 | command_name check_local_swap
|
---|
| 107 | command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 |
|
---|
| 111 | # 'check_local_mrtgtraf' command definition
|
---|
| 112 | define command{
|
---|
| 113 | command_name check_local_mrtgtraf
|
---|
| 114 | command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | ################################################################################
|
---|
| 119 | # NOTE: The following 'check_...' commands are used to monitor services on
|
---|
| 120 | # both local and remote hosts.
|
---|
| 121 | ################################################################################
|
---|
| 122 |
|
---|
| 123 | # 'check_ftp' command definition
|
---|
| 124 | define command{
|
---|
| 125 | command_name check_ftp
|
---|
| 126 | command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
|
---|
| 127 | }
|
---|
| 128 |
|
---|
| 129 |
|
---|
| 130 | # 'check_hpjd' command definition
|
---|
| 131 | define command{
|
---|
| 132 | command_name check_hpjd
|
---|
| 133 | command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | # 'check_snmp' command definition
|
---|
| 138 | define command{
|
---|
| 139 | command_name check_snmp
|
---|
| 140 | command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | # 'check_http' command definition
|
---|
| 145 | define command{
|
---|
| 146 | command_name check_http
|
---|
| 147 | command_line $USER1$/check_http -I $HOSTADDRESS$ -f follow $ARG1$
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | # 'check_dns' command definition
|
---|
| 151 | define command{
|
---|
| 152 | command_name check_dns
|
---|
| 153 | command_line $USER1$/check_dns -A -H $HOSTNAME$ -s $HOSTADDRESS$ $ARG1$
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 |
|
---|
| 157 | # 'check_ssh' command definition
|
---|
| 158 | define command{
|
---|
| 159 | command_name check_ssh
|
---|
| 160 | command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 |
|
---|
| 164 | # 'check_dhcp' command definition
|
---|
| 165 | define command{
|
---|
| 166 | command_name check_dhcp
|
---|
| 167 | command_line $USER1$/check_dhcp $ARG1$
|
---|
| 168 | }
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | # 'check_ping' command definition
|
---|
| 172 | define command{
|
---|
| 173 | command_name check_ping
|
---|
| 174 | command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 |
|
---|
| 178 | # 'check_pop' command definition
|
---|
| 179 | define command{
|
---|
| 180 | command_name check_pop
|
---|
| 181 | command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | # 'check_imap' command definition
|
---|
| 186 | define command{
|
---|
| 187 | command_name check_imap
|
---|
| 188 | command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 |
|
---|
| 192 | # 'check_smtp' command definition
|
---|
| 193 | define command{
|
---|
| 194 | command_name check_smtp
|
---|
| 195 | command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
|
---|
| 196 | }
|
---|
| 197 |
|
---|
| 198 |
|
---|
| 199 | # 'check_tcp' command definition
|
---|
| 200 | define command{
|
---|
| 201 | command_name check_tcp
|
---|
| 202 | command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 | # 'check_udp' command definition
|
---|
| 207 | define command{
|
---|
| 208 | command_name check_udp
|
---|
| 209 | command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
|
---|
| 210 | }
|
---|
| 211 |
|
---|
| 212 |
|
---|
| 213 | # 'check_nt' command definition
|
---|
| 214 | define command{
|
---|
| 215 | command_name check_nt
|
---|
| 216 | command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 | # $ sudo fetch -o/usr/local/libexec/nagios http://nagios.manubulon.com/check_snmp_int.pl
|
---|
| 220 | # $ sudo chmod 755 /usr/local/libexec/nagios/check_snmp_int.pl
|
---|
| 221 | # $ sudo make -C /usr/ports/net-mgmt/p5-Net-SNMP install clean
|
---|
| 222 | define command {
|
---|
| 223 | command_name check_snmp_int
|
---|
| 224 | command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C 'public!' -2 -f -n $ARG1$
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | define command {
|
---|
| 228 | command_name check_ntp_peer
|
---|
| 229 | command_line $USER1$/check_ntp_peer -H $HOSTADDRESS$
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | ################################################################################
|
---|
| 233 | #
|
---|
| 234 | # SAMPLE PERFORMANCE DATA COMMANDS
|
---|
| 235 | #
|
---|
| 236 | # These are sample performance data commands that can be used to send performance
|
---|
| 237 | # data output to two text files (one for hosts, another for services). If you
|
---|
| 238 | # plan on simply writing performance data out to a file, consider using the
|
---|
| 239 | # host_perfdata_file and service_perfdata_file options in the main config file.
|
---|
| 240 | #
|
---|
| 241 | ################################################################################
|
---|
| 242 |
|
---|
| 243 |
|
---|
| 244 | # # 'process-host-perfdata' command definition
|
---|
| 245 | # define command{
|
---|
| 246 | # command_name process-host-perfdata
|
---|
| 247 | # command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/spool/nagios/host-perfdata.out
|
---|
| 248 | # }
|
---|
| 249 | #
|
---|
| 250 | #
|
---|
| 251 | # # 'process-service-perfdata' command definition
|
---|
| 252 | # define command{
|
---|
| 253 | # command_name process-service-perfdata
|
---|
| 254 | # command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/spool/nagios/service-perfdata.out
|
---|
| 255 | # }
|
---|
| 256 |
|
---|
| 257 | define command{
|
---|
| 258 | command_name process-service-perfdata-file
|
---|
| 259 | command_line /usr/local/libexec/process_perfdata.pl --bulk=/var/spool/nagios/service-perfdata
|
---|
| 260 | }
|
---|
| 261 |
|
---|
| 262 | define command{
|
---|
| 263 | command_name process-host-perfdata-file
|
---|
| 264 | command_line /usr/local/libexec/process_perfdata.pl --bulk=/var/spool/nagios/host-perfdata
|
---|
| 265 | }
|
---|
| 266 |
|
---|
| 267 |
|
---|
| 268 | # 'check-host-alive' command definition (ipv6)
|
---|
| 269 | define command{
|
---|
| 270 | command_name check_ping_ipv6
|
---|
| 271 | command_line $USER1$/check_ping -6 -H $HOSTNAME$ -w 3000.0,80% -c 5000.0,100% -p 10
|
---|
| 272 | }
|
---|
| 273 |
|
---|
| 274 | define command{
|
---|
| 275 | command_name check_ping_ipv6_addr
|
---|
| 276 | command_line $USER1$/check_ping -6 -H $ARG1$ -w 3000.0,80% -c 5000.0,100% -p 10
|
---|
| 277 | }
|
---|
| 278 |
|
---|