| [48] | 1 | ################################################################################ | 
|---|
|  | 2 | # Sample object config file for Nagios | 
|---|
|  | 3 | # | 
|---|
|  | 4 | # Read the documentation for more information on this configuration file.  I've | 
|---|
|  | 5 | # provided some comments here, but things may not be so clear without further | 
|---|
|  | 6 | # explanation, so make sure to read the HTML documentation! | 
|---|
|  | 7 | # | 
|---|
|  | 8 | # Last Modified: 12-17-2005 | 
|---|
|  | 9 | # | 
|---|
|  | 10 | ################################################################################ | 
|---|
|  | 11 |  | 
|---|
|  | 12 |  | 
|---|
|  | 13 | ################################################################################ | 
|---|
|  | 14 | # COMMAND DEFINITIONS | 
|---|
|  | 15 | # | 
|---|
|  | 16 | # SYNTAX: | 
|---|
|  | 17 | # | 
|---|
|  | 18 | #       define command{ | 
|---|
|  | 19 | #               template      <templatename> | 
|---|
|  | 20 | #               name          <objectname> | 
|---|
|  | 21 | #               command_name  <commandname> | 
|---|
|  | 22 | #               command_line  <commandline> | 
|---|
|  | 23 | #               } | 
|---|
|  | 24 | # | 
|---|
|  | 25 | # WHERE: | 
|---|
|  | 26 | # | 
|---|
|  | 27 | # <templatename> = object name of another command definition that should be | 
|---|
|  | 28 | #                  used as a template for this definition (optional) | 
|---|
|  | 29 | # <objectname>   = object name of command definition, referenced by other | 
|---|
|  | 30 | #                  command definitions that use it as a template (optional) | 
|---|
|  | 31 | # <commandname>  = name of the command, as recognized/used by Nagios | 
|---|
|  | 32 | # <commandline>  = command line | 
|---|
|  | 33 | # | 
|---|
|  | 34 | ################################################################################ | 
|---|
|  | 35 |  | 
|---|
|  | 36 |  | 
|---|
|  | 37 |  | 
|---|
|  | 38 |  | 
|---|
|  | 39 | ################################################################################ | 
|---|
|  | 40 | # | 
|---|
|  | 41 | # SAMPLE NOTIFICATION COMMANDS | 
|---|
|  | 42 | # | 
|---|
|  | 43 | # These are some example notification commands.  They may or may not work on | 
|---|
|  | 44 | # your system without modification. | 
|---|
|  | 45 | # | 
|---|
|  | 46 | ################################################################################ | 
|---|
|  | 47 |  | 
|---|
|  | 48 | # 'host-notify-by-email' command definition | 
|---|
|  | 49 | define command{ | 
|---|
|  | 50 | command_name    host-notify-by-email | 
|---|
| [717] | 51 | 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 "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$ | 
|---|
| [48] | 52 | } | 
|---|
|  | 53 |  | 
|---|
|  | 54 |  | 
|---|
| [428] | 55 | # 'host-notify-by-zephyr' command definition | 
|---|
|  | 56 | define command{ | 
|---|
|  | 57 | command_name    host-notify-by-zephyr | 
|---|
|  | 58 | command_line    /usr/bin/printf "%b" "Host $HOSTSTATE$ alert for $HOSTNAME$!\n$HOSTOUTPUT$" | /usr/bin/zwrite -d -s "Nagios" -c $CONTACTEMAIL$ -i "nagios.$HOSTALIAS$" | 
|---|
|  | 59 | } | 
|---|
|  | 60 |  | 
|---|
|  | 61 |  | 
|---|
| [48] | 62 | # 'host-notify-by-epager' command definition | 
|---|
|  | 63 | define command{ | 
|---|
|  | 64 | command_name    host-notify-by-epager | 
|---|
| [894] | 65 | command_line    /usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /usr/bin/mail -s "Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$ | 
|---|
| [48] | 66 | } | 
|---|
|  | 67 |  | 
|---|
|  | 68 | # 'notify-by-email' command definition | 
|---|
|  | 69 | define command{ | 
|---|
|  | 70 | command_name    notify-by-email | 
|---|
| [717] | 71 | 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$" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$ | 
|---|
| [48] | 72 | } | 
|---|
|  | 73 |  | 
|---|
|  | 74 |  | 
|---|
| [428] | 75 | # 'notify-by-zephyr' command definition | 
|---|
|  | 76 | define command{ | 
|---|
|  | 77 | command_name    notify-by-zephyr | 
|---|
|  | 78 | command_line    /usr/bin/printf "%b" "$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n$SERVICEOUTPUT$" | /usr/bin/zwrite -d -s "Nagios" -c $CONTACTEMAIL$ -i "nagios.$HOSTALIAS$.$SERVICEDESC$" | 
|---|
|  | 79 | } | 
|---|
|  | 80 |  | 
|---|
|  | 81 |  | 
|---|
| [48] | 82 | # 'notify-by-epager' command definition | 
|---|
|  | 83 | define command{ | 
|---|
|  | 84 | command_name    notify-by-epager | 
|---|
| [894] | 85 | command_line    /usr/bin/printf "%b" "Info: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /usr/bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$ | 
|---|
| [48] | 86 | } | 
|---|
|  | 87 |  | 
|---|
|  | 88 |  | 
|---|
|  | 89 |  | 
|---|
|  | 90 |  | 
|---|
|  | 91 |  | 
|---|
|  | 92 | ################################################################################ | 
|---|
|  | 93 | # | 
|---|
|  | 94 | # SAMPLE PERFORMANCE DATA COMMANDS | 
|---|
|  | 95 | # | 
|---|
|  | 96 | # These are sample performance data commands that can be used to send performance | 
|---|
|  | 97 | # data output to two text files (one for hosts, another for services).  If you | 
|---|
|  | 98 | # plan on simply writing performance data out to a file, consider using the | 
|---|
|  | 99 | # host_perfdata_file and service_perfdata_file options in the main config file. | 
|---|
|  | 100 | # | 
|---|
|  | 101 | ################################################################################ | 
|---|
|  | 102 |  | 
|---|
|  | 103 |  | 
|---|
|  | 104 | # 'process-host-perfdata' command definition | 
|---|
|  | 105 | define command{ | 
|---|
|  | 106 | command_name    process-host-perfdata | 
|---|
|  | 107 | command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/log/nagios/host-perfdata.out | 
|---|
|  | 108 | } | 
|---|
|  | 109 |  | 
|---|
|  | 110 |  | 
|---|
|  | 111 | # 'process-service-perfdata' command definition | 
|---|
|  | 112 | define command{ | 
|---|
|  | 113 | command_name    process-service-perfdata | 
|---|
|  | 114 | 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/log/nagios/service-perfdata.out | 
|---|
|  | 115 | } | 
|---|
|  | 116 |  | 
|---|
|  | 117 |  | 
|---|
|  | 118 | define command { | 
|---|
|  | 119 | command_name  ng-service-perfdata | 
|---|
|  | 120 | command_line  /home/noc/ng/bin/insert.pl | 
|---|
|  | 121 | } | 
|---|
|  | 122 | #  command_line  /home/nagios/ng/bin/test.sh | 
|---|