26abd34661c17d99fbdffaa106f052932caded07
[infrastructure.git] / nagios / AutomaticConfig / config-sample.old / commands.cfg-sample
1 ################################################################################
2 # Sample command definitions for Nagios 2.9
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: 11-21-2006
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 SERVICE CHECK COMMANDS
42 #
43 # These are some example service check commands.  They may or may not work on
44 # your system, as they must be modified for your plugins.  See the HTML 
45 # documentation on the plugins for examples of how to configure command definitions.
46 #
47 ################################################################################
48
49
50 ################################################################################
51 # NOTE:  The following 'check_local_...' functions are designed to monitor
52 #        various metrics on the host that Nagios is running on (i.e. this one).
53 ################################################################################
54
55 # 'check_local_disk' command definition
56 define command{
57         command_name    check_local_disk
58         command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
59         }
60
61
62 # 'check_local_load' command definition
63 define command{
64         command_name    check_local_load
65         command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
66         }
67
68
69 # 'check_local_procs' command definition
70 define command{
71         command_name    check_local_procs
72         command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
73         }
74
75
76 # 'check_local_users' command definition
77 define command{
78         command_name    check_local_users
79         command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
80         }
81
82
83
84 ################################################################################
85 # NOTE:  The following 'check_...' commands are used to monitor services on
86 #        both local and remote hosts.
87 ################################################################################
88
89 # 'check_dns' command definition
90 define command{
91         command_name    check_dns
92         command_line    $USER1$/check_dns -H www.yahoo.com -s $HOSTADDRESS$
93         }
94
95
96 # 'check_ftp' command definition
97 define command{
98         command_name    check_ftp
99         command_line    $USER1$/check_ftp -H $HOSTADDRESS$
100         }
101
102
103 # 'check_hpjd' command definition
104 define command{
105         command_name    check_hpjd
106         command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ -C public
107         }
108
109
110 # 'check_http' command definition
111 define command{
112         command_name    check_http
113         command_line    $USER1$/check_http -H $HOSTADDRESS$
114         }
115
116
117 # 'check_nntp' command definition
118 define command{
119         command_name    check_nntp
120         command_line    $USER1$/check_nntp -H $HOSTADDRESS$
121         }
122
123
124 # 'check_ping' command definition
125 define command{
126         command_name    check_ping
127         command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
128         }
129
130
131 # 'check_pop' command definition
132 define command{
133         command_name    check_pop
134         command_line    $USER1$/check_pop -H $HOSTADDRESS$
135         }
136
137
138 # 'check_smtp' command definition
139 define command{
140         command_name    check_smtp
141         command_line    $USER1$/check_smtp -H $HOSTADDRESS$
142         }
143
144
145 # 'check_tcp' command definition
146 define command{
147         command_name    check_tcp
148         command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
149         }
150
151
152 # 'check_telnet' command definition
153 define command{
154         command_name    check_telnet
155         command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p 23
156         }
157
158
159 # 'check_udp' command definition
160 define command{
161         command_name    check_udp
162         command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$
163         }
164
165
166
167
168 ################################################################################
169 #
170 # SAMPLE HOST CHECK COMMANDS
171 #
172 ################################################################################
173
174
175 # This command checks to see if a host is "alive" by pinging it
176 # The check must result in a 100% packet loss or 5 second (5000ms) round trip 
177 # average time to produce a critical error.
178 # Note: Only one ICMP echo packet is sent (determined by the '-p 1' argument)
179
180 # 'check-host-alive' command definition
181 define command{
182         command_name    check-host-alive
183         command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 1
184         }
185
186
187
188
189 ################################################################################
190 #
191 # SAMPLE NOTIFICATION COMMANDS
192 #
193 # These are some example notification commands.  They may or may not work on
194 # your system without modification.  As an example, some systems will require 
195 # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
196 #
197 ################################################################################
198
199
200 # 'host-notify-by-email' command definition
201 define command{
202         command_name    host-notify-by-email
203         command_line    /usr/bin/printf "%b" "***** Nagios 2.9 *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
204         }
205
206
207 # 'host-notify-by-epager' command definition
208 define command{
209         command_name    host-notify-by-epager
210         command_line    /usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nTime: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
211         }
212
213 # 'notify-by-email' command definition
214 define command{
215         command_name    notify-by-email
216         command_line    /usr/bin/printf "%b" "***** Nagios 2.9 *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
217         }
218
219
220 # 'notify-by-epager' command definition
221 define command{
222         command_name    notify-by-epager
223         command_line    /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
224         }
225
226
227
228
229
230 ################################################################################
231 #
232 # SAMPLE PERFORMANCE DATA COMMANDS
233 #
234 # These are sample performance data commands that can be used to send performance
235 # data output to two text files (one for hosts, another for services).  If you
236 # plan on simply writing performance data out to a file, consider using the 
237 # host_perfdata_file and service_perfdata_file options in the main config file.
238 #
239 ################################################################################
240
241
242 # 'process-host-perfdata' command definition
243 define command{
244         command_name    process-host-perfdata
245         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
246         }
247
248
249 # 'process-service-perfdata' command definition
250 define command{
251         command_name    process-service-perfdata
252         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
253         }
254
255