3 require_once('op5/queryhandler.php');
6 * Nagios FIFO command helper
11 * Obtain information about a command.
12 * "information" in this case is a template we can use to inject
13 * one such command into Nagios' FIFO, a description of the
14 * command, it's name and the number Nagios has assigned to it via
16 * @param $name The 'name' of the command (DEL_HOST_COMMENT, fe)
17 * @return array with command information if a command was found, or
20 public static function cmd_info($name = false)
26 $prod_name = Kohana
::config('config.product_name');
30 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
31 'brief' => _('You are trying to execute an unsupported command.'),
33 'ADD_HOST_COMMENT' => array
35 'description' => sprintf(_('This command is used to add a comment for the specified host. If you work with other administrators, you may find it useful to share information about a host that is having problems if more than one of you may be working on it. If you do not check the \'persistent\' option, the comment will be automatically be deleted the next time %s is restarted. '), $prod_name),
36 'brief' => _('You are trying to add a host comment'),
37 'template' => 'ADD_HOST_COMMENT;host_name;persistent;author;comment',
39 'DEL_HOST_COMMENT' => array
41 'description' => _('This command is used to delete a specific host comment. '),
42 'brief' => _('You are trying to delete a host comment'),
43 'template' => 'DEL_HOST_COMMENT;comment_id',
45 'ADD_SVC_COMMENT' => array
47 'description' => sprintf(_('This command is used to add a comment for the specified service. If you work with other administrators, you may find it useful to share information about a host or service that is having problems if more than one of you may be working on it. If you do not check the \'persistent\' option, the comment will automatically be deleted the next time %s is restarted. '), $prod_name),
48 'brief' => _('You are trying to add a service comment'),
49 'template' => 'ADD_SVC_COMMENT;service;persistent;author;comment',
51 'DEL_SVC_COMMENT' => array
53 'description' => _('This command is used to delete a specific service comment. '),
54 'brief' => _('You are trying to delete a service comment'),
55 'template' => 'DEL_SVC_COMMENT;comment_id',
57 'DEL_COMMENT' => array /* Use only in multiselect */
59 'description' => _('This command is used to delete a specific comment. '),
60 'brief' => _('You are trying to delete a comment'),
61 'template' => 'DEL_HOST_COMMENT;comment_id', /* This is magically going to be replaces s/_HOST_/_SVC_/ in multi-select... */
63 'ENABLE_SVC_CHECK' => array
65 'description' => _('This command is used to enable active checks of a service. '),
66 'brief' => _('You are trying to enable active checks of a service'),
67 'template' => 'ENABLE_SVC_CHECK;service',
69 'DISABLE_SVC_CHECK' => array
71 'description' => _('This command is used to disable active checks of a service. '),
72 'brief' => _('You are trying to disable active checks of a service'),
73 'template' => 'DISABLE_SVC_CHECK;service',
75 'SCHEDULE_SVC_CHECK' => array
77 'description' => sprintf(_('This command is used to schedule the next check of a service. %s will re-queue the service to be checked at the time you specify. If you select the <i>force check</i> option, %s will force a check of the service regardless of both what time the scheduled check occurs and whether or not checks are enabled for the service. '), $prod_name, $prod_name),
78 'brief' => _('You are trying to schedule a service check'),
79 'template' => 'SCHEDULE_SVC_CHECK;service;check_time',
81 'DELAY_SVC_NOTIFICATION' => array
83 'description' => _('This command is used to delay the next problem notification that is sent out for the specified service. The notification delay will be disregarded if the service changes state before the next notification is scheduled to be sent out. This command has no effect if the service is currently in an OK state. '),
84 'brief' => _('You are trying to delay a service notification'),
85 'template' => 'DELAY_SVC_NOTIFICATION;service;notification_delay',
87 'DELAY_HOST_NOTIFICATION' => array
89 'description' => _('This command is used to delay the next problem notification that is sent out for the specified host. The notification delay will be disregarded if the host changes state before the next notification is scheduled to be sent out. This command has no effect if the host is currently UP. '),
90 'brief' => _('You are trying to delay a host notification'),
91 'template' => 'DELAY_HOST_NOTIFICATION;host_name;notification_delay',
93 'DISABLE_NOTIFICATIONS' => array
95 'description' => _('This command is used to disable host and service notifications on a program-wide basis. '),
96 'brief' => _('You are trying to disable notifications'),
97 'template' => 'DISABLE_NOTIFICATIONS',
99 'ENABLE_NOTIFICATIONS' => array
101 'description' => _('This command is used to enable host and service notifications on a program-wide basis. '),
102 'brief' => _('You are trying to enable notifications'),
103 'template' => 'ENABLE_NOTIFICATIONS',
105 'RESTART_PROCESS' => array
107 'description' => sprintf(_('This command is used to restart the %s process. Executing a restart command is equivalent to sending the process a HUP signal. All information will be flushed from memory, the configuration files will be re-read, and %s will start monitoring with the new configuration information. '), $prod_name, $prod_name),
108 'brief' => sprintf(_('You are trying to restart the %s process'), $prod_name),
109 'template' => 'RESTART_PROCESS',
111 'SHUTDOWN_PROCESS' => array
113 'description' => sprintf(_('This command is used to shutdown the %s process. Note: Once the %s has been shutdown, it cannot be restarted via the web interface! '), $prod_name, $prod_name),
114 'brief' => sprintf(_('You are trying to shutdown the %s process'), $prod_name),
115 'template' => 'SHUTDOWN_PROCESS',
117 'ENABLE_HOST_SVC_CHECKS' => array
119 'description' => _('This command is used to enable active checks of all services associated with the specified host. This <i>does not</i> enable checks of the host unless you check the \'Enable for host too\' option. '),
120 'brief' => _('You are trying to enable active checks of all services on a host'),
121 'template' => 'ENABLE_HOST_SVC_CHECKS;host_name',
123 'DISABLE_HOST_SVC_CHECKS' => array
125 'description' => sprintf(_('This command is used to disable active checks of all services associated with the specified host. When a service is disabled %s will not monitor the service. Doing this will prevent any notifications being sent out for the specified service while it is disabled. In order to have %s check the service in the future you will have to re-enable the service. Note that disabling service checks may not necessarily prevent notifications from being sent out about the host which those services are associated with. This <i>does not</i> disable checks of the host unless you check the \'Disable for host too\' option. '), $prod_name, $prod_name),
126 'brief' => _('You are trying to disable active checks of all services on a host'),
127 'template' => 'DISABLE_HOST_SVC_CHECKS;host_name',
129 'SCHEDULE_HOST_SVC_CHECKS' => array
131 'description' => sprintf(_('This command is used to scheduled the next check of all services on the specified host. If you select the <i>force check</i> option, %s will force a check of all services on the host regardless of both what time the scheduled checks occur and whether or not checks are enabled for those services. '), $prod_name),
132 'brief' => _('You are trying to schedule a check of all services for a host'),
133 'template' => 'SCHEDULE_HOST_SVC_CHECKS;host_name;check_time',
135 'DELAY_HOST_SVC_NOTIFICATIONS' => array
137 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
138 'brief' => _('You are trying to execute an unsupported command.'),
139 'template' => 'DELAY_HOST_SVC_NOTIFICATIONS;host_name;notification_time',
141 'DEL_ALL_HOST_COMMENTS' => array
143 'description' => _('This command is used to delete all comments associated with the specified host. '),
144 'brief' => _('You are trying to delete all comments for a host'),
145 'template' => 'DEL_ALL_HOST_COMMENTS;host_name',
147 'DEL_ALL_SVC_COMMENTS' => array
149 'description' => _('This command is used to delete all comments associated with the specified service. '),
150 'brief' => _('You are trying to delete all comments for a service'),
151 'template' => 'DEL_ALL_SVC_COMMENTS;service',
153 'ENABLE_SVC_NOTIFICATIONS' => array
155 'description' => _('This command is used to enable notifications for the specified service. Notifications will only be sent out for the service state types you defined in your service definition. '),
156 'brief' => _('You are trying to enable notifications for a service'),
157 'template' => 'ENABLE_SVC_NOTIFICATIONS;service',
159 'DISABLE_SVC_NOTIFICATIONS' => array
161 'description' => _('This command is used to prevent notifications from being sent out for the specified service. You will have to re-enable notifications for this service before any alerts can be sent out in the future. '),
162 'brief' => _('You are trying to disable notifications for a service'),
163 'template' => 'DISABLE_SVC_NOTIFICATIONS;service',
165 'ENABLE_HOST_NOTIFICATIONS' => array
167 'description' => _('This command is used to enable notifications for the specified host. Notifications will only be sent out for the host state types you defined in your host definition. Note that this command <i>does not</i> enable notifications for services associated with this host. '),
168 'brief' => _('You are trying to enable notifications for a host'),
169 'template' => 'ENABLE_HOST_NOTIFICATIONS;host_name',
171 'DISABLE_HOST_NOTIFICATIONS' => array
173 'description' => _('This command is used to prevent notifications from being sent out for the specified host. You will have to re-enable notifications for this host before any alerts can be sent out in the future. Note that this command <i>does not</i> disable notifications for services associated with this host. '),
174 'brief' => _('You are trying to disable notifications for a host'),
175 'template' => 'DISABLE_HOST_NOTIFICATIONS;host_name',
177 'ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST' => array
179 'description' => sprintf(_('This command is used to enable notifications for all hosts and services that lie "beyond" the specified host (from the view of %s). '), $prod_name),
180 'brief' => _('You are trying to enable notifications for all hosts and services beyond a host'),
181 'template' => 'ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST;host_name',
183 'DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST' => array
185 'description' => sprintf(_('This command is used to temporarily prevent notifications from being sent out for all hosts and services that lie "beyone" the specified host (from the view of %s). '), $prod_name),
186 'brief' => _('You are trying to disable notifications for all hosts and services beyond a host'),
187 'template' => 'DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST;host_name',
189 'ENABLE_HOST_SVC_NOTIFICATIONS' => array
191 'description' => _('This command is used to enable notifications for all services on the specified host. Notifications will only be sent out for the service state types you defined in your service definition. This <i>does not</i> enable notifications for the host unless you check the \'Enable for host too\' option. '),
192 'brief' => _('You are trying to enable notifications for all services on a host'),
193 'template' => 'ENABLE_HOST_SVC_NOTIFICATIONS;host_name',
195 'DISABLE_HOST_SVC_NOTIFICATIONS' => array
197 'description' => _('This command is used to prevent notifications from being sent out for all services on the specified host. You will have to re-enable notifications for all services associated with this host before any alerts can be sent out in the future. This <i>does not</i> prevent notifications from being sent out about the host unless you check the \'Disable for host too\' option. '),
198 'brief' => _('You are trying to disable notifications for all services on a host'),
199 'template' => 'DISABLE_HOST_SVC_NOTIFICATIONS;host_name',
201 'PROCESS_SERVICE_CHECK_RESULT' => array
203 'description' => _('This command is used to submit a passive check result for a service. It is particularly useful for resetting security-related services to OK states once they have been dealt with. '),
204 'brief' => _('You are trying to submit a passive check result for a service'),
205 'template' => 'PROCESS_SERVICE_CHECK_RESULT;service;return_code;plugin_output',
207 'SAVE_STATE_INFORMATION' => array
209 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
210 'brief' => _('You are trying to execute an unsupported command.'),
211 'template' => 'SAVE_STATE_INFORMATION',
213 'READ_STATE_INFORMATION' => array
215 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
216 'brief' => _('You are trying to execute an unsupported command.'),
217 'template' => 'READ_STATE_INFORMATION',
219 'ACKNOWLEDGE_HOST_PROBLEM' => array
221 'description' => _('This command is used to acknowledge a host problem. When a host problem is acknowledged, future notifications about problems are temporarily disabled until the host changes from its current state. If you want acknowledgement to disable notifications until the host recovers, check the \'Sticky Acknowledgement\' checkbox. Contacts for this host will receive a notification about the acknowledgement, so they are aware that someone is working on the problem. Additionally, a comment will also be added to the host. Make sure to enter your name and fill in a brief description of what you are doing in the comment field. If you would like the host comment to remain once the acknowledgement is removed, check the \'Persistent Comment\' checkbox. If you do not want an acknowledgement notification sent out to the appropriate contacts, uncheck the \'Notify\' checkbox. '),
222 'brief' => _('You are trying to acknowledge a host problem'),
223 'template' => 'ACKNOWLEDGE_HOST_PROBLEM;host_name;sticky;notify;persistent;author;comment',
225 'ACKNOWLEDGE_SVC_PROBLEM' => array
227 'description' => _('This command is used to acknowledge a service problem. When a service problem is acknowledged, future notifications about problems are temporarily disabled until the service changes from its current state. If you want acknowledgement to disable notifications until the service recovers, check the \'Sticky Acknowledgement\' checkbox. Contacts for this service will receive a notification about the acknowledgement, so they are aware that someone is working on the problem. Additionally, a comment will also be added to the service. Make sure to enter your name and fill in a brief description of what you are doing in the comment field. If you would like the service comment to remain once the acknowledgement is removed, check the \'Persistent Comment\' checkbox. If you do not want an acknowledgement notification sent out to the appropriate contacts, uncheck the \'Notify\' checkbox. '),
228 'brief' => _('You are trying to acknowledge a service problem'),
229 'template' => 'ACKNOWLEDGE_SVC_PROBLEM;service;sticky;notify;persistent;author;comment',
231 'START_EXECUTING_SVC_CHECKS' => array
233 'description' => _('This command is used to resume execution of active service checks on a program-wide basis. Individual services which are disabled will still not be checked. '),
234 'brief' => _('You are trying to start executing active service checks'),
235 'template' => 'START_EXECUTING_SVC_CHECKS',
237 'STOP_EXECUTING_SVC_CHECKS' => array
239 'description' => sprintf(_('This command is used to temporarily stop %s from actively executing any service checks. This will have the side effect of preventing any notifications from being sent out (for any and all services and hosts). Service checks will not be executed again until you issue a command to resume service check execution. '), $prod_name),
240 'brief' => _('You are trying to stop executing active service checks'),
241 'template' => 'STOP_EXECUTING_SVC_CHECKS',
243 'START_ACCEPTING_PASSIVE_SVC_CHECKS' => array
245 'description' => sprintf(_('This command is used to make %s start accepting passive service check results that it finds in the external command file '), $prod_name),
246 'brief' => _('You are trying to start accepting passive service checks'),
247 'template' => 'START_ACCEPTING_PASSIVE_SVC_CHECKS',
249 'STOP_ACCEPTING_PASSIVE_SVC_CHECKS' => array
251 'description' => sprintf(_('This command is use to make %s stop accepting passive service check results that it finds in the external command file. All passive check results that are found will be ignored. '), $prod_name),
252 'brief' => _('You are trying to stop accepting passive service checks'),
253 'template' => 'STOP_ACCEPTING_PASSIVE_SVC_CHECKS',
255 'ENABLE_PASSIVE_SVC_CHECKS' => array
257 'description' => sprintf(_('This command is used to allow %s to accept passive service check results that it finds in the external command file for this particular service. '), $prod_name),
258 'brief' => _('You are trying to start accepting passive service checks for a service'),
259 'template' => 'ENABLE_PASSIVE_SVC_CHECKS;service',
261 'DISABLE_PASSIVE_SVC_CHECKS' => array
263 'description' => sprintf(_('This command is used to stop %s accepting passive service check results that it finds in the external command file for this particular service. All passive check results that are found for this service will be ignored. '), $prod_name),
264 'brief' => _('You are trying to stop accepting passive service checks for a service'),
265 'template' => 'DISABLE_PASSIVE_SVC_CHECKS;service',
267 'ENABLE_EVENT_HANDLERS' => array
269 'description' => sprintf(_('This command is used to allow %s to run host and service event handlers. '), $prod_name),
270 'brief' => _('You are trying to enable event handlers'),
271 'template' => 'ENABLE_EVENT_HANDLERS',
273 'DISABLE_EVENT_HANDLERS' => array
275 'description' => sprintf(_('This command is used to temporarily prevent %s from running any host or service event handlers. '), $prod_name),
276 'brief' => _('You are trying to disable event handlers'),
277 'template' => 'DISABLE_EVENT_HANDLERS',
279 'ENABLE_HOST_EVENT_HANDLER' => array
281 'description' => sprintf(_('This command is used to allow %s to run the host event handler for a service when necessary (if one is defined). '), $prod_name),
282 'brief' => _('You are trying to enable the event handler for a host'),
283 'template' => 'ENABLE_HOST_EVENT_HANDLER;host_name',
285 'DISABLE_HOST_EVENT_HANDLER' => array
287 'description' => sprintf(_('This command is used to temporarily prevent %s from running the host event handler for a host. '), $prod_name),
288 'brief' => _('You are trying to disable the event handler for a host'),
289 'template' => 'DISABLE_HOST_EVENT_HANDLER;host_name',
291 'ENABLE_SVC_EVENT_HANDLER' => array
293 'description' => sprintf(_('This command is used to allow %s to run the service event handler for a service when necessary (if one is defined). '), $prod_name),
294 'brief' => _('You are trying to enable the event handler for a service'),
295 'template' => 'ENABLE_SVC_EVENT_HANDLER;service',
297 'DISABLE_SVC_EVENT_HANDLER' => array
299 'description' => sprintf(_('This command is used to temporarily prevent %s from running the service event handler for a service. '), $prod_name),
300 'brief' => _('You are trying to disable the event handler for a service'),
301 'template' => 'DISABLE_SVC_EVENT_HANDLER;service',
303 'ENABLE_HOST_CHECK' => array
305 'description' => _('This command is used to enable active checks of this host. '),
306 'brief' => _('You are trying to enable active checks of a host'),
307 'template' => 'ENABLE_HOST_CHECK;host_name',
309 'DISABLE_HOST_CHECK' => array
311 'description' => sprintf(_('This command is used to temporarily prevent %s from actively checking the status of a host. If %s needs to check the status of this host, it will assume that it is in the same state that it was in before checks were disabled. '), $prod_name, $prod_name),
312 'brief' => _('You are trying to disable active checks of a host'),
313 'template' => 'DISABLE_HOST_CHECK;host_name',
315 'START_OBSESSING_OVER_SVC_CHECKS' => array
317 'description' => sprintf(_('This command is used to have %s start obsessing over service checks. Read the documentation on distributed monitoring for more information on this. '), $prod_name),
318 'brief' => _('You are trying to start obsessing over service checks'),
319 'template' => 'START_OBSESSING_OVER_SVC_CHECKS',
321 'STOP_OBSESSING_OVER_SVC_CHECKS' => array
323 'description' => sprintf(_('This command is used stop %s from obsessing over service checks. '), $prod_name),
324 'brief' => _('You are trying to stop obsessing over service checks'),
325 'template' => 'STOP_OBSESSING_OVER_SVC_CHECKS',
327 'REMOVE_HOST_ACKNOWLEDGEMENT' => array
329 'description' => _('This command is used to remove an acknowledgement for a host problem. Once the acknowledgement is removed, notifications may start being sent out about the host problem. '),
330 'brief' => _('You are trying to remove a host acknowledgement'),
331 'template' => 'REMOVE_HOST_ACKNOWLEDGEMENT;host_name',
333 'REMOVE_SVC_ACKNOWLEDGEMENT' => array
335 'description' => _('This command is used to remove an acknowledgement for a service problem. Once the acknowledgement is removed, notifications may start being sent out about the service problem. '),
336 'brief' => _('You are trying to remove a service acknowledgement'),
337 'template' => 'REMOVE_SVC_ACKNOWLEDGEMENT;service',
339 'SCHEDULE_FORCED_HOST_SVC_CHECKS' => array
341 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
342 'brief' => _('You are trying to execute an unsupported command.'),
343 'template' => 'SCHEDULE_FORCED_HOST_SVC_CHECKS;host_name;check_time',
345 'SCHEDULE_FORCED_SVC_CHECK' => array
347 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
348 'brief' => _('You are trying to execute an unsupported command.'),
349 'template' => 'SCHEDULE_FORCED_SVC_CHECK;service;check_time',
351 'SCHEDULE_HOST_DOWNTIME' => array
353 'description' => sprintf(_('This command is used to schedule downtime for a host. During the specified downtime, %s will not send notifications out about the host. When the scheduled downtime expires, %s will send out notifications for this host as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). If you select the <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> option, %s will treat this as "flexible" downtime. Flexible downtime starts when the host goes down or becomes unreachable (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed downtime. '), $prod_name, $prod_name, $prod_name),
354 'brief' => _('You are trying to schedule downtime for a host'),
355 'template' => 'SCHEDULE_HOST_DOWNTIME;host_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
357 'SCHEDULE_SVC_DOWNTIME' => array
359 'description' => sprintf(_('This command is used to schedule downtime for a service. During the specified downtime, %s will not send notifications out about the service. When the scheduled downtime expires, %s will send out notifications for this service as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). option, %s will treat this as "flexible" downtime. Flexible downtime starts when the service enters a non-OK state (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed downtime. '), $prod_name, $prod_name, $prod_name),
360 'brief' => _('You are trying to schedule downtime for a service'),
361 'template' => 'SCHEDULE_SVC_DOWNTIME;service;start_time;end_time;fixed;trigger_id;duration;author;comment',
363 'ENABLE_HOST_FLAP_DETECTION' => array
365 'description' => _('This command is used to enable flap detection for a specific host. If flap detection is disabled on a program-wide basis, this will have no effect, '),
366 'brief' => _('You are trying to enable flap detection for a host'),
367 'template' => 'ENABLE_HOST_FLAP_DETECTION;host_name',
369 'DISABLE_HOST_FLAP_DETECTION' => array
371 'description' => _('This command is used to disable flap detection for a specific host. '),
372 'brief' => _('You are trying to disable flap detection for a host'),
373 'template' => 'DISABLE_HOST_FLAP_DETECTION;host_name',
375 'ENABLE_SVC_FLAP_DETECTION' => array
377 'description' => _('This command is used to enable flap detection for a specific service. If flap detection is disabled on a program-wide basis, this will have no effect, '),
378 'brief' => _('You are trying to enable flap detection for a service'),
379 'template' => 'ENABLE_SVC_FLAP_DETECTION;service',
381 'DISABLE_SVC_FLAP_DETECTION' => array
383 'description' => _('This command is used to disable flap detection for a specific service. '),
384 'brief' => _('You are trying to disable flap detection for a service'),
385 'template' => 'DISABLE_SVC_FLAP_DETECTION;service',
387 'ENABLE_FLAP_DETECTION' => array
389 'description' => _('This command is used to enable flap detection for hosts and services on a program-wide basis. Individual hosts and services may have flap detection disabled. '),
390 'brief' => _('You are trying to enable flap detection for hosts and services'),
391 'template' => 'ENABLE_FLAP_DETECTION',
393 'DISABLE_FLAP_DETECTION' => array
395 'description' => _('This command is used to disable flap detection for hosts and services on a program-wide basis. '),
396 'brief' => _('You are trying to disable flap detection for hosts and services'),
397 'template' => 'DISABLE_FLAP_DETECTION',
399 'ENABLE_HOSTGROUP_SVC_NOTIFICATIONS' => array
401 'description' => _('This command is used to enable notifications for all services in the specified hostgroup. Notifications will only be sent out for the service state types you defined in your service definitions. This <i>does not</i> enable notifications for the hosts in this hostgroup unless you check the \'Enable for hosts too\' option. '),
402 'brief' => _('You are trying to enable notifications for all services in a hostgroup'),
403 'template' => 'ENABLE_HOSTGROUP_SVC_NOTIFICATIONS;hostgroup_name',
405 'DISABLE_HOSTGROUP_SVC_NOTIFICATIONS' => array
407 'description' => _('This command is used to prevent notifications from being sent out for all services in the specified hostgroup. You will have to re-enable notifications for all services in this hostgroup before any alerts can be sent out in the future. This <i>does not</i> prevent notifications from being sent out about the hosts in this hostgroup unless you check the \'Disable for hosts too\' option. '),
408 'brief' => _('You are trying to disable notifications for all services in a hostgroup'),
409 'template' => 'DISABLE_HOSTGROUP_SVC_NOTIFICATIONS;hostgroup_name',
411 'ENABLE_HOSTGROUP_HOST_NOTIFICATIONS' => array
413 'description' => _('This command is used to enable notifications for all hosts in the specified hostgroup. Notifications will only be sent out for the host state types you defined in your host definitions. '),
414 'brief' => _('You are trying to enable notifications for all hosts in a hostgroup'),
415 'template' => 'ENABLE_HOSTGROUP_HOST_NOTIFICATIONS;hostgroup_name',
417 'DISABLE_HOSTGROUP_HOST_NOTIFICATIONS' => array
419 'description' => _('This command is used to prevent notifications from being sent out for all hosts in the specified hostgroup. You will have to re-enable notifications for all hosts in this hostgroup before any alerts can be sent out in the future. '),
420 'brief' => _('You are trying to disable notifications for all hosts in a hostgroup'),
421 'template' => 'DISABLE_HOSTGROUP_HOST_NOTIFICATIONS;hostgroup_name',
423 'ENABLE_HOSTGROUP_SVC_CHECKS' => array
425 'description' => _('This command is used to enable active checks of all services in the specified hostgroup. This <i>does not</i> enable active checks of the hosts in the hostgroup unless you check the \'Enable for hosts too\' option. '),
426 'brief' => _('You are trying to enable active checks of all services in a hostgroup'),
427 'template' => 'ENABLE_HOSTGROUP_SVC_CHECKS;hostgroup_name',
429 'DISABLE_HOSTGROUP_SVC_CHECKS' => array
431 'description' => _('This command is used to disable active checks of all services in the specified hostgroup. This <i>does not</i> disable checks of the hosts in the hostgroup unless you check the \'Disable for hosts too\' option. '),
432 'brief' => _('You are trying to disable active checks of all services in a hostgroup'),
433 'template' => 'DISABLE_HOSTGROUP_SVC_CHECKS;hostgroup_name',
435 'CANCEL_HOST_DOWNTIME' => array
437 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
438 'brief' => _('You are trying to execute an unsupported command.'),
439 'not_implemented' => true,
441 'CANCEL_SVC_DOWNTIME' => array
443 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
444 'brief' => _('You are trying to execute an unsupported command.'),
445 'not_implemented' => true,
447 'CANCEL_ACTIVE_HOST_DOWNTIME' => array
449 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
450 'brief' => _('You are trying to execute an unsupported command.'),
451 'not_implemented' => true,
453 'CANCEL_PENDING_HOST_DOWNTIME' => array
455 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
456 'brief' => _('You are trying to execute an unsupported command.'),
457 'not_implemented' => true,
459 'CANCEL_ACTIVE_SVC_DOWNTIME' => array
461 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
462 'brief' => _('You are trying to execute an unsupported command.'),
463 'not_implemented' => true,
465 'CANCEL_PENDING_SVC_DOWNTIME' => array
467 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
468 'brief' => _('You are trying to execute an unsupported command.'),
469 'not_implemented' => true,
471 'CANCEL_ACTIVE_HOST_SVC_DOWNTIME' => array
473 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
474 'brief' => _('You are trying to execute an unsupported command.'),
475 'not_implemented' => true,
477 'CANCEL_PENDING_HOST_SVC_DOWNTIME' => array
479 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
480 'brief' => _('You are trying to execute an unsupported command.'),
481 'not_implemented' => true,
483 'FLUSH_PENDING_COMMANDS' => array
485 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
486 'brief' => _('You are trying to execute an unsupported command.'),
487 'not_implemented' => true,
489 'DEL_HOST_DOWNTIME' => array
491 'description' => _('This command is used to cancel active or pending scheduled downtime for the specified host. '),
492 'brief' => _('You are trying to cancel scheduled downtime for a host'),
493 'template' => 'DEL_HOST_DOWNTIME;downtime_id',
495 'DEL_SVC_DOWNTIME' => array
497 'description' => _('This command is used to cancel active or pending scheduled downtime for the specified service. '),
498 'brief' => _('You are trying to cancel scheduled downtime for a service'),
499 'template' => 'DEL_SVC_DOWNTIME;downtime_id',
501 'DEL_DOWNTIME' => array /* Use only in multiselect */
503 'description' => _('This command is used to cancel active or pending scheduled downtime. '),
504 'brief' => _('You are trying to cancel scheduled downtime'),
505 'template' => 'DEL_HOST_DOWNTIME;downtime_id', /* This is magically going to be replaces s/_HOST_/_SVC_/ in multi-select... */
507 'ENABLE_FAILURE_PREDICTION' => array
509 'description' => _('This command is used to enable failure prediction for hosts and services on a program-wide basis. Individual hosts and services may have failure prediction disabled. '),
510 'brief' => _('You are trying to enable failure prediction for hosts and service'),
511 'template' => 'ENABLE_FAILURE_PREDICTION',
513 'DISABLE_FAILURE_PREDICTION' => array
515 'description' => _('This command is used to disable failure prediction for hosts and services on a program-wide basis. '),
516 'brief' => _('You are trying to disable failure prediction for hosts and service'),
517 'template' => 'DISABLE_FAILURE_PREDICTION',
519 'ENABLE_PERFORMANCE_DATA' => array
521 'description' => _('This command is used to enable the processing of performance data for hosts and services on a program-wide basis. Individual hosts and services may have performance data processing disabled. '),
522 'brief' => _('You are trying to enable performance data processing for hosts and services'),
523 'template' => 'ENABLE_PERFORMANCE_DATA',
525 'DISABLE_PERFORMANCE_DATA' => array
527 'description' => _('This command is used to disable the processing of performance data for hosts and services on a program-wide basis. '),
528 'brief' => _('You are trying to disable performance data processing for hosts and services'),
529 'template' => 'DISABLE_PERFORMANCE_DATA',
531 'SCHEDULE_HOSTGROUP_HOST_DOWNTIME' => array
533 'description' => sprintf(_('This command is used to schedule downtime for all hosts in a hostgroup. During the specified downtime, %s will not send notifications out about the hosts. When the scheduled downtime expires, %s will send out notifications for the hosts as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). If you select the <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> option, %s will treat this as "flexible" downtime. Flexible downtime starts when a host goes down or becomes unreachable (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed dowtime. '), $prod_name, $prod_name, $prod_name),
534 'brief' => _('You are trying to schedule downtime for all hosts in a hostgroup'),
535 'template' => 'SCHEDULE_HOSTGROUP_HOST_DOWNTIME;hostgroup_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
537 'SCHEDULE_HOSTGROUP_SVC_DOWNTIME' => array
539 'description' => sprintf(_('This command is used to schedule downtime for all services in a hostgroup. During the specified downtime, %s will not send notifications out about the services. When the scheduled downtime expires, %s will send out notifications for the services as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). If you select the <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> option, %s will treat this as "flexible" downtime. Flexible downtime starts when a service enters a non-OK state (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed dowtime. Note that scheduling downtime for services does not automatically schedule downtime for the hosts those services are associated with. If you want to also schedule downtime for all hosts in the hostgroup, check the \'Schedule downtime for hosts too\' option. '), $prod_name, $prod_name, $prod_name),
540 'brief' => _('You are trying to schedule downtime for all services in a hostgroup'),
541 'template' => 'SCHEDULE_HOSTGROUP_SVC_DOWNTIME;hostgroup_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
543 'SCHEDULE_HOST_SVC_DOWNTIME' => array
545 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
546 'brief' => _('You are trying to execute an unsupported command.'),
547 'template' => 'SCHEDULE_HOST_SVC_DOWNTIME;host_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
549 'PROCESS_HOST_CHECK_RESULT' => array
551 'description' => _('This command is used to submit a passive check result for a host. '),
552 'brief' => _('You are trying to submit a passive check result for a host'),
553 'template' => 'PROCESS_HOST_CHECK_RESULT;host_name;status_code;plugin_output',
555 'START_EXECUTING_HOST_CHECKS' => array
557 'description' => _('This command is used to enable active host checks on a program-wide basis. '),
558 'brief' => _('You are trying to start executing host checks'),
559 'template' => 'START_EXECUTING_HOST_CHECKS',
561 'STOP_EXECUTING_HOST_CHECKS' => array
563 'description' => _('This command is used to disable active host checks on a program-wide basis. '),
564 'brief' => _('You are trying to stop executing host checks'),
565 'template' => 'STOP_EXECUTING_HOST_CHECKS',
567 'START_ACCEPTING_PASSIVE_HOST_CHECKS' => array
569 'description' => sprintf(_('This command is used to have %s start obsessing over host checks. Read the documentation on distributed monitoring for more information on this. '), $prod_name),
570 'brief' => _('You are trying to start accepting passive host checks'),
571 'template' => 'START_ACCEPTING_PASSIVE_HOST_CHECKS',
573 'STOP_ACCEPTING_PASSIVE_HOST_CHECKS' => array
575 'description' => sprintf(_('This command is used to stop %s from obsessing over host checks. '), $prod_name),
576 'brief' => _('You are trying to stop accepting passive host checks'),
577 'template' => 'STOP_ACCEPTING_PASSIVE_HOST_CHECKS',
579 'ENABLE_PASSIVE_HOST_CHECKS' => array
581 'description' => sprintf(_('This command is used to allow %s to accept passive host check results that it finds in the external command file for a host. '), $prod_name),
582 'brief' => _('You are trying to start accepting passive checks for a host'),
583 'template' => 'ENABLE_PASSIVE_HOST_CHECKS;host_name',
585 'DISABLE_PASSIVE_HOST_CHECKS' => array
587 'description' => sprintf(_('This command is used to stop %s from accepting passive host check results that it finds in the external command file for a host. All passive check results that are found for this host will be ignored. '), $prod_name),
588 'brief' => _('You are trying to stop accepting passive checks for a host'),
589 'template' => 'DISABLE_PASSIVE_HOST_CHECKS;host_name',
591 'START_OBSESSING_OVER_HOST_CHECKS' => array
593 'description' => sprintf(_('This command is used to have %s start obsessing over host checks. Read the documentation on distributed monitoring for more information on this. '), $prod_name),
594 'brief' => _('You are trying to start obsessing over host checks'),
595 'template' => 'START_OBSESSING_OVER_HOST_CHECKS',
597 'STOP_OBSESSING_OVER_HOST_CHECKS' => array
599 'description' => sprintf(_('This command is used to stop %s from obsessing over host checks. '), $prod_name),
600 'brief' => _('You are trying to stop obsessing over host checks'),
601 'template' => 'STOP_OBSESSING_OVER_HOST_CHECKS',
603 'SCHEDULE_HOST_CHECK' => array
605 'description' => sprintf(_('This command is used to schedule the next check of a host. %s will re-queue the host to be checked at the time you specify. If you select the <i>force check</i> option, %s will force a check of the host regardless of both what time the scheduled check occurs and whether or not checks are enabled for the host.'), $prod_name, $prod_name),
606 'brief' => _('You are trying to schedule a host check'),
607 'template' => 'SCHEDULE_HOST_CHECK;host_name;check_time',
609 'SCHEDULE_FORCED_HOST_CHECK' => array
611 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
612 'brief' => _('You are trying to execute an unsupported command.'),
613 'template' => 'SCHEDULE_FORCED_HOST_CHECK;host_name;check_time',
615 'START_OBSESSING_OVER_SVC' => array
617 'description' => sprintf(_('This command is used to have %s start obsessing over a service. '), $prod_name),
618 'brief' => _('You are trying to start obsessing over a service'),
619 'template' => 'START_OBSESSING_OVER_SVC;service',
621 'STOP_OBSESSING_OVER_SVC' => array
623 'description' => sprintf(_('This command is used to stop %s from obsessing over a service. '), $prod_name),
624 'brief' => _('You are trying to stop obsessing over a service'),
625 'template' => 'STOP_OBSESSING_OVER_SVC;service',
627 'START_OBSESSING_OVER_HOST' => array
629 'description' => sprintf(_('This command is used to have %s start obsessing over a host. '), $prod_name),
630 'brief' => _('You are trying to start obsessing over a host'),
631 'template' => 'START_OBSESSING_OVER_HOST;host_name',
633 'STOP_OBSESSING_OVER_HOST' => array
635 'description' => sprintf(_('This command is used to stop %s from obsessing over a host. '), $prod_name),
636 'brief' => _('You are trying to stop obsessing over a host'),
637 'template' => 'STOP_OBSESSING_OVER_HOST;host_name',
639 'ENABLE_HOSTGROUP_HOST_CHECKS' => array
641 'description' => _('This command is used to enable active checks of all hosts in the specified hostgroup. This <i>does not</i> enable active checks of the services in the hostgroup. '),
642 'brief' => _('You are trying to enable active checks of all hosts in a hostgroup'),
643 'template' => 'ENABLE_HOSTGROUP_HOST_CHECKS;hostgroup_name',
645 'DISABLE_HOSTGROUP_HOST_CHECKS' => array
647 'description' => _('This command is used to disable active checks of all hosts in the specified hostgroup. This <i>does not</i> disable active checks of the services in the hostgroup. '),
648 'brief' => _('You are trying to enable active checks of all hosts in a hostgroup'),
649 'template' => 'DISABLE_HOSTGROUP_HOST_CHECKS;hostgroup_name',
651 'ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS' => array
653 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
654 'brief' => _('You are trying to execute an unsupported command.'),
655 'template' => 'ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;hostgroup_name',
657 'DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS' => array
659 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
660 'brief' => _('You are trying to execute an unsupported command.'),
661 'template' => 'DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS;hostgroup_name',
663 'ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS' => array
665 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
666 'brief' => _('You are trying to execute an unsupported command.'),
667 'template' => 'ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;hostgroup_name',
669 'DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS' => array
671 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
672 'brief' => _('You are trying to execute an unsupported command.'),
673 'template' => 'DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS;hostgroup_name',
675 'ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS' => array
677 'description' => _('This command is used to enable notifications for all services in the specified servicegroup. Notifications will only be sent out for the service state types you defined in your service definitions. This <i>does not</i> enable notifications for the hosts in this servicegroup unless you check the \'Enable for hosts too\' option. '),
678 'brief' => _('You are trying to enable notifications for all services in a servicegroup'),
679 'template' => 'ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS;servicegroup_name',
681 'DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS' => array
683 'description' => _('This command is used to prevent notifications from being sent out for all services in the specified servicegroup. You will have to re-enable notifications for all services in this servicegroup before any alerts can be sent out in the future. This <i>does not</i> prevent notifications from being sent out about the hosts in this servicegroup unless you check the \'Disable for hosts too\' option. '),
684 'brief' => _('You are trying to disable notifications for all services in a servicegroup'),
685 'template' => 'DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS;servicegroup_name',
687 'ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS' => array
689 'description' => _('This command is used to enable notifications for all hosts in the specified servicegroup. Notifications will only be sent out for the host state types you defined in your host definitions. '),
690 'brief' => _('You are trying to enable notifications for all hosts in a servicegroup'),
691 'template' => 'ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS;servicegroup_name',
693 'DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS' => array
695 'description' => _('This command is used to prevent notifications from being sent out for all hosts in the specified servicegroup. You will have to re-enable notifications for all hosts in this servicegroup before any alerts can be sent out in the future. '),
696 'brief' => _('You are trying to disable notifications for all hosts in a servicegroup'),
697 'template' => 'DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS;servicegroup_name',
699 'ENABLE_SERVICEGROUP_SVC_CHECKS' => array
701 'description' => _('This command is used to enable active checks of all services in the specified servicegroup. This <i>does not</i> enable active checks of the hosts in the servicegroup unless you check the \'Enable for hosts too\' option. '),
702 'brief' => _('You are trying to enable active checks of all services in a servicegroup'),
703 'template' => 'ENABLE_SERVICEGROUP_SVC_CHECKS;servicegroup_name',
705 'DISABLE_SERVICEGROUP_SVC_CHECKS' => array
707 'description' => _('This command is used to disable active checks of all services in the specified servicegroup. This <i>does not</i> disable checks of the hosts in the servicegroup unless you check the \'Disable for hosts too\' option. '),
708 'brief' => _('You are trying to disable active checks of all services in a servicegroup'),
709 'template' => 'DISABLE_SERVICEGROUP_SVC_CHECKS;servicegroup_name',
711 'ENABLE_SERVICEGROUP_HOST_CHECKS' => array
713 'description' => _('This command is used to enable active checks of all hosts in the specified servicegroup. This <i>does not</i> enable active checks of the services in the servicegroup. '),
714 'brief' => _('You are trying to enable active checks of all services in a servicegroup'),
715 'template' => 'ENABLE_SERVICEGROUP_HOST_CHECKS;servicegroup_name',
717 'DISABLE_SERVICEGROUP_HOST_CHECKS' => array
719 'description' => _('This command is used to disable active checks of all hosts in the specified servicegroup. This <i>does not</i> disable checks of the services in the servicegroup.'),
720 'brief' => _('You are trying to disable active checks of all hosts in a servicegroup'),
721 'template' => 'DISABLE_SERVICEGROUP_HOST_CHECKS;servicegroup_name',
723 'ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS' => array
725 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
726 'brief' => _('You are trying to execute an unsupported command.'),
727 'template' => 'ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;servicegroup_name',
729 'DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS' => array
731 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
732 'brief' => _('You are trying to execute an unsupported command.'),
733 'template' => 'DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS;servicegroup_name',
735 'ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS' => array
737 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
738 'brief' => _('You are trying to execute an unsupported command.'),
739 'template' => 'ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;servicegroup_name',
741 'DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS' => array
743 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
744 'brief' => _('You are trying to execute an unsupported command.'),
745 'template' => 'DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS;servicegroup_name',
747 'SCHEDULE_SERVICEGROUP_HOST_DOWNTIME' => array
749 'description' => sprintf(_('This command is used to schedule downtime for all hosts in a servicegroup. During the specified downtime, %s will not send notifications out about the hosts. When the scheduled downtime expires, %s will send out notifications for the hosts as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). If you select the <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> option, %s will treat this as "flexible" downtime. Flexible downtime starts when a host goes down or becomes unreachable (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed dowtime. '), $prod_name, $prod_name, $prod_name),
750 'brief' => _('You are trying to schedule downtime for all hosts in a servicegroup'),
751 'template' => 'SCHEDULE_SERVICEGROUP_HOST_DOWNTIME;servicegroup_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
753 'SCHEDULE_SERVICEGROUP_SVC_DOWNTIME' => array
755 'description' => sprintf(_('This command is used to schedule downtime for all services in a servicegroup. During the specified downtime, %s will not send notifications out about the services. When the scheduled downtime expires, %s will send out notifications for the services as it normally would. Scheduled downtimes are preserved across program shutdowns and restarts. Both the start and end times should be specified in the following format: <b>'.nagstat
::date_format().'</b> (<a href="http://php.net/manual/en/function.date.php">see explanation of date-letters</a>). If you select the <i>fixed</i> option, the downtime will be in effect between the start and end times you specify. If you do not select the <i>fixed</i> option, %s will treat this as "flexible" downtime. Flexible downtime starts when a service enters a non-OK state (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. The duration fields do not apply for fixed dowtime. Note that scheduling downtime for services does not automatically schedule downtime for the hosts those services are associated with. If you want to also schedule downtime for all hosts in the servicegroup, check the \'Schedule downtime for hosts too\' option. '), $prod_name, $prod_name, $prod_name),
756 'brief' => _('You are trying to schedule downtime for all services in a servicegroup'),
757 'template' => 'SCHEDULE_SERVICEGROUP_SVC_DOWNTIME;servicegroup_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
759 'CHANGE_GLOBAL_HOST_EVENT_HANDLER' => array
761 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
762 'brief' => _('You are trying to execute an unsupported command.'),
763 'template' => 'CHANGE_GLOBAL_HOST_EVENT_HANDLER;event_handler_command',
765 'CHANGE_GLOBAL_SVC_EVENT_HANDLER' => array
767 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
768 'brief' => _('You are trying to execute an unsupported command.'),
769 'template' => 'CHANGE_GLOBAL_SVC_EVENT_HANDLER;event_handler_command',
771 'CHANGE_HOST_EVENT_HANDLER' => array
773 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
774 'brief' => _('You are trying to execute an unsupported command.'),
775 'template' => 'CHANGE_HOST_EVENT_HANDLER;host_name;event_handler_command',
777 'CHANGE_SVC_EVENT_HANDLER' => array
779 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
780 'brief' => _('You are trying to execute an unsupported command.'),
781 'template' => 'CHANGE_SVC_EVENT_HANDLER;service;event_handler_command',
783 'CHANGE_HOST_CHECK_COMMAND' => array
785 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
786 'brief' => _('You are trying to execute an unsupported command.'),
787 'template' => 'CHANGE_HOST_CHECK_COMMAND;host_name;check_command',
789 'CHANGE_SVC_CHECK_COMMAND' => array
791 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
792 'brief' => _('You are trying to execute an unsupported command.'),
793 'template' => 'CHANGE_SVC_CHECK_COMMAND;service;check_command',
795 'CHANGE_NORMAL_HOST_CHECK_INTERVAL' => array
797 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
798 'brief' => _('You are trying to execute an unsupported command.'),
799 'template' => 'CHANGE_NORMAL_HOST_CHECK_INTERVAL;host_name;check_interval',
801 'CHANGE_NORMAL_SVC_CHECK_INTERVAL' => array
803 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
804 'brief' => _('You are trying to execute an unsupported command.'),
805 'template' => 'CHANGE_NORMAL_SVC_CHECK_INTERVAL;service;check_interval',
807 'CHANGE_RETRY_SVC_CHECK_INTERVAL' => array
809 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
810 'brief' => _('You are trying to execute an unsupported command.'),
811 'template' => 'CHANGE_RETRY_SVC_CHECK_INTERVAL;service;check_interval',
813 'CHANGE_MAX_HOST_CHECK_ATTEMPTS' => array
815 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
816 'brief' => _('You are trying to execute an unsupported command.'),
817 'template' => 'CHANGE_MAX_HOST_CHECK_ATTEMPTS;host_name;check_attempts',
819 'CHANGE_MAX_SVC_CHECK_ATTEMPTS' => array
821 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
822 'brief' => _('You are trying to execute an unsupported command.'),
823 'template' => 'CHANGE_MAX_SVC_CHECK_ATTEMPTS;service;check_attempts',
825 'SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME' => array
827 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
828 'brief' => _('You are trying to execute an unsupported command.'),
829 'template' => 'SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME;host_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
831 'ENABLE_HOST_AND_CHILD_NOTIFICATIONS' => array
833 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
834 'brief' => _('You are trying to execute an unsupported command.'),
835 'template' => 'ENABLE_HOST_AND_CHILD_NOTIFICATIONS;host_name',
837 'DISABLE_HOST_AND_CHILD_NOTIFICATIONS' => array
839 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
840 'brief' => _('You are trying to execute an unsupported command.'),
841 'template' => 'DISABLE_HOST_AND_CHILD_NOTIFICATIONS;host_name',
843 'SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME' => array
845 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
846 'brief' => _('You are trying to execute an unsupported command.'),
847 'template' => 'SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME;host_name;start_time;end_time;fixed;trigger_id;duration;author;comment',
849 'ENABLE_SERVICE_FRESHNESS_CHECKS' => array
851 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
852 'brief' => _('You are trying to execute an unsupported command.'),
853 'template' => 'ENABLE_SERVICE_FRESHNESS_CHECKS',
855 'DISABLE_SERVICE_FRESHNESS_CHECKS' => array
857 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
858 'brief' => _('You are trying to execute an unsupported command.'),
859 'template' => 'DISABLE_SERVICE_FRESHNESS_CHECKS',
861 'ENABLE_HOST_FRESHNESS_CHECKS' => array
863 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
864 'brief' => _('You are trying to execute an unsupported command.'),
865 'template' => 'ENABLE_HOST_FRESHNESS_CHECKS',
867 'DISABLE_HOST_FRESHNESS_CHECKS' => array
869 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
870 'brief' => _('You are trying to execute an unsupported command.'),
871 'template' => 'DISABLE_HOST_FRESHNESS_CHECKS',
873 'SET_HOST_NOTIFICATION_NUMBER' => array
875 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
876 'brief' => _('You are trying to execute an unsupported command.'),
877 'template' => 'SET_HOST_NOTIFICATION_NUMBER;host_name;notification_number',
879 'SET_SVC_NOTIFICATION_NUMBER' => array
881 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
882 'brief' => _('You are trying to execute an unsupported command.'),
883 'template' => 'SET_SVC_NOTIFICATION_NUMBER;service;notification_number',
885 'CHANGE_HOST_CHECK_TIMEPERIOD' => array
887 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
888 'brief' => _('You are trying to execute an unsupported command.'),
889 'template' => 'CHANGE_HOST_CHECK_TIMEPERIOD;host_name;timeperiod',
891 'CHANGE_SVC_CHECK_TIMEPERIOD' => array
893 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
894 'brief' => _('You are trying to execute an unsupported command.'),
895 'template' => 'CHANGE_SVC_CHECK_TIMEPERIOD;service;check_timeperiod',
897 'PROCESS_FILE' => array
899 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
900 'brief' => _('You are trying to execute an unsupported command.'),
901 'template' => 'PROCESS_FILE;file_name;delete',
903 'CHANGE_CUSTOM_HOST_VAR' => array
905 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
906 'brief' => _('You are trying to execute an unsupported command.'),
907 'template' => 'CHANGE_CUSTOM_HOST_VAR;host_name;varname;varvalue',
909 'CHANGE_CUSTOM_SVC_VAR' => array
911 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
912 'brief' => _('You are trying to execute an unsupported command.'),
913 'template' => 'CHANGE_CUSTOM_SVC_VAR;service;varname;varvalue',
915 'CHANGE_CUSTOM_CONTACT_VAR' => array
917 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
918 'brief' => _('You are trying to execute an unsupported command.'),
919 'template' => 'CHANGE_CUSTOM_CONTACT_VAR;contact_name;varname;varvalue',
921 'ENABLE_CONTACT_HOST_NOTIFICATIONS' => array
923 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
924 'brief' => _('You are trying to execute an unsupported command.'),
925 'template' => 'ENABLE_CONTACT_HOST_NOTIFICATIONS;contact_name',
927 'DISABLE_CONTACT_HOST_NOTIFICATIONS' => array
929 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
930 'brief' => _('You are trying to execute an unsupported command.'),
931 'template' => 'DISABLE_CONTACT_HOST_NOTIFICATIONS;contact_name',
933 'ENABLE_CONTACT_SVC_NOTIFICATIONS' => array
935 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
936 'brief' => _('You are trying to execute an unsupported command.'),
937 'template' => 'ENABLE_CONTACT_SVC_NOTIFICATIONS;contact_name',
939 'DISABLE_CONTACT_SVC_NOTIFICATIONS' => array
941 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
942 'brief' => _('You are trying to execute an unsupported command.'),
943 'template' => 'DISABLE_CONTACT_SVC_NOTIFICATIONS;contact_name',
945 'ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS' => array
947 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
948 'brief' => _('You are trying to execute an unsupported command.'),
949 'template' => 'ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS;contactgroup_name',
951 'DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS' => array
953 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
954 'brief' => _('You are trying to execute an unsupported command.'),
955 'template' => 'DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS;contactgroup_name',
957 'ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS' => array
959 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
960 'brief' => _('You are trying to execute an unsupported command.'),
961 'template' => 'ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS;contactgroup_name',
963 'DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS' => array
965 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
966 'brief' => _('You are trying to execute an unsupported command.'),
967 'template' => 'DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS;contactgroup_name',
969 'CHANGE_RETRY_HOST_CHECK_INTERVAL' => array
971 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
972 'brief' => _('You are trying to execute an unsupported command.'),
973 'template' => 'CHANGE_RETRY_HOST_CHECK_INTERVAL;service;check_interval',
975 'SEND_CUSTOM_HOST_NOTIFICATION' => array
977 'description' => sprintf(_('This command is used to send a custom notification about the specified host. Useful in emergencies when you need to notify admins of an issue regarding a monitored system or service. Custom notifications normally follow the regular notification logic in %s. Selecting the <i>Forced</i> option will force the notification to be sent out, regardless of the time restrictions, whether or not notifications are enabled, etc. Selecting the <i>Broadcast</i> option causes the notification to be sent out to all normal (non-escalated) and escalated contacts. These options allow you to override the normal notification logic if you need to get an important message out. '), $prod_name),
978 'brief' => _('You are trying to send a custom host notification'),
979 'template' => 'SEND_CUSTOM_HOST_NOTIFICATION;host_name;options;author;comment',
981 'SEND_CUSTOM_SVC_NOTIFICATION' => array
983 'description' => sprintf(_('This command is used to send a custom notification about the specified service. Useful in emergencies when you need to notify admins of an issue regarding a monitored system or service. Custom notifications normally follow the regular notification logic in %s. Selecting the <i>Forced</i> option will force the notification to be sent out, regardless of the time restrictions, whether or not notifications are enabled, etc. Selecting the <i>Broadcast</i> option causes the notification to be sent out to all normal (non-escalated) and escalated contacts. These options allow you to override the normal notification logic if you need to get an important message out. '), $prod_name),
984 'brief' => _('You are trying to send a custom service notification'),
985 'template' => 'SEND_CUSTOM_SVC_NOTIFICATION;service;options;author;comment',
987 'CHANGE_HOST_NOTIFICATION_TIMEPERIOD' => array
989 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
990 'brief' => _('You are trying to execute an unsupported command.'),
991 'template' => 'CHANGE_HOST_NOTIFICATION_TIMEPERIOD;host_name;notification_timeperiod',
993 'CHANGE_SVC_NOTIFICATION_TIMEPERIOD' => array
995 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
996 'brief' => _('You are trying to execute an unsupported command.'),
997 'template' => 'CHANGE_SVC_NOTIFICATION_TIMEPERIOD;service;notification_timeperiod',
999 'CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD' => array
1000 ('nagios_id' => 163,
1001 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1002 'brief' => _('You are trying to execute an unsupported command.'),
1003 'template' => 'CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD;contact_name;notification_timeperiod',
1005 'CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD' => array
1006 ('nagios_id' => 164,
1007 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1008 'brief' => _('You are trying to execute an unsupported command.'),
1009 'template' => 'CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD;contact_name;notification_timeperiod',
1011 'CHANGE_HOST_MODATTR' => array
1012 ('nagios_id' => 165,
1013 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1014 'brief' => _('You are trying to execute an unsupported command.'),
1015 'template' => 'CHANGE_HOST_MODATTR;host_name;value',
1017 'CHANGE_SVC_MODATTR' => array
1018 ('nagios_id' => 166,
1019 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1020 'brief' => _('You are trying to execute an unsupported command.'),
1021 'template' => 'CHANGE_SVC_MODATTR;service;value',
1023 'CHANGE_CONTACT_MODATTR' => array
1024 ('nagios_id' => 167,
1025 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1026 'brief' => _('You are trying to execute an unsupported command.'),
1027 'template' => 'CHANGE_CONTACT_MODATTR;contact_name;value',
1029 'CHANGE_CONTACT_MODHATTR' => array
1030 ('nagios_id' => 168,
1031 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1032 'brief' => _('You are trying to execute an unsupported command.'),
1033 'template' => 'CHANGE_CONTACT_MODHATTR;contact_name;value',
1035 'CHANGE_CONTACT_MODSATTR' => array
1036 ('nagios_id' => 169,
1037 'description' => sprintf(_('This command is not implemented in %s.'), $prod_name),
1038 'brief' => _('You are trying to execute an unsupported command.'),
1039 'template' => 'CHANGE_CONTACT_MODSATTR;contact_name;value',
1041 'NACOMA_DEL_SERVICE' => array
1042 ('template' => 'NOT_A_REAL_COMMAND;service'),
1043 'NACOMA_DEL_HOST' => array
1044 ('template' => 'NOT_A_REAL_COMMAND;host_name'),
1047 if (isset($command_info[$name])) {
1048 $command_info[$name]['name'] = $name;
1049 return $command_info[$name];
1052 if (!is_numeric($name)) {
1056 # we weren't given a name, but $name is numeric so we loop
1057 # loop the command_info array and look for a matching id
1058 foreach ($command_info as $cmd_name => $info) {
1059 if ($info['nagios_id'] == $name) {
1060 $info['name'] = $cmd_name;
1069 * If the provided name is a valid command, return it, otherwise return false
1071 public static function cmd_name($name = false)
1073 $info = self
::cmd_info($name);
1074 if (empty($info) ||
isset($info['name'])) {
1075 return $info['name'];
1081 * Obtain the id for a command
1082 * @param $name The name of the command
1083 * @return False on errors, the numeric id on success (may be 0)
1085 public static function command_id($name)
1090 $first = self
::cmd_name($name);
1091 if ($first !== false) {
1095 # handle a CMD_ prefixed name too
1096 if (substr($name, 0, 4) === 'CMD_') {
1097 return self
::cmd_name(substr($name, 4));
1103 * Massage a parameter value to make it suitable for
1104 * consumption by Nagios.
1106 * @param $name The parameter name
1107 * @value The parameter value
1108 * @return The massaged parameter value
1110 private static function massage_param($name, $value)
1112 # We only massage *_time fields for now
1113 if (strpos($name, '_time') !== false) {
1114 return nagstat
::timestamp_format(nagstat
::date_format(), $value);
1117 if ($name === 'duration') {
1118 return floatval($value) * 3600;
1121 if('comment' == $name) {
1122 // nagios terminates string on ;, whether it's quoted or not,
1123 // we need to get rid of it
1124 // @see http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html
1125 return str_replace(';', ',', $value);
1128 # notification_delay is given in minutes,
1129 # but nagios wants a unix timestamp
1130 if ($name === 'notification_delay') {
1131 return ($value * 60) +
time();
1138 * Construct a command suitable for passing to Nagios
1140 * @param $cmd string or command-info array
1141 * @param $param Parameters to use as macros for the template
1142 * @return A command string on success, false on errors
1144 static function build_command($cmd, $param)
1149 $info = self
::cmd_info($cmd);
1151 if (!$info ||
!$info['template'])
1154 $template = explode(';', $info['template']);
1155 for ($i = 1; $i < count($template); $i++
) {
1157 if (isset($param[$k])) {
1158 if('trigger_id' == $k && is_array($param[$k])) {
1159 $v = current($param[$k]);
1164 # boolean variables that have gone missing mean "0"
1166 case 'persistent': case 'delete':
1167 case 'fixed': case 'notify': case 'sticky':
1177 $template[$i] = nagioscmd
::massage_param($k, $v);
1180 return join(';', $template);
1184 * Obtain Nagios' macro name for the given command
1185 * @param $id Numeric or string representation of command
1186 * @return False on errors, Nagios' macro name as string on
1188 public function nagios_name($id)
1190 if (is_numeric($id)) {
1191 $base_cmd = self
::cmd_name($id);
1195 return "CMD_" . $base_cmd;
1197 if (self
::command_id($name)) {
1198 return "CMD_" . $id;
1204 * Actually submit command to nagios
1205 * @param $cmd The complete command
1206 * @param $args string
1207 * @return false on error, else true
1209 public static function submit_to_nagios($cmd, $args = "")
1211 $qh = op5queryhandler
::instance();
1212 $command = sprintf("[%d] %s", time(), $cmd);
1214 $output = $qh->call("command run", $command, $args);
1215 } catch (op5queryhandler_Exception
$e) {
1216 op5log
::instance("ninja")->log("error", "external command failed. Exception: " . $e->getMessage());
1219 $result = substr($output, 0, strlen("OK:")) === "OK:";
1221 op5log
::instance("ninja")->log("error", "external command failed. Output: " . trim($output));
1228 * Helper function to save us from typing
1229 * the links to the cmd controller
1232 static function command_link($command_type=false, $host=false, $service=false, $lable='', $method='submit', $force=false, $attributes=NULL)
1234 $host = trim($host);
1236 $lable = trim($lable);
1237 $method = trim($method);
1238 if ($command_type===false ||
empty($lable) ||
empty($method)) {
1241 $lnk = "command/$method?cmd_typ=$command_type";
1242 # only print extra params when present
1243 if (!empty($host)) {
1244 $lnk .= '&host_name=' . urlencode($host);
1246 if (!empty($service)) {
1247 $lnk .= '&service=' . urlencode($service);
1249 if ($force === true) {
1250 $lnk .= '&force=true';
1253 return html
::anchor($lnk, html
::specialchars($lable), $attributes);
1257 * Returns the HTML for a button which can send commands through ajax
1258 * instead of page reloads!
1260 * TODO Handling of command parameters
1262 static function command_ajax_button ( $command, $lable, $params = false, $state = false ) {
1264 if ( $params != false && is_array( $params ) ) {
1265 $params = json_encode( $params );
1266 return '<button class="command-button" ' . (( $state !== false ) ?
('data-state="' . $state . '"') : "") . ' data-parameters="' . $params . '" data-command="' . $command . '"><span></span>' . $lable . '</button>';
1269 return '<button class="command-button" ' . (( $state !== false ) ?
('data-state="' . $state . '"') : "") . ' data-command="' . $command . '"><span></span>' . $lable . '</button>';
1274 * Given the name of a command, return the type of the command
1275 * (which can beharder than you'd think, see for example
1276 * "ENABLE_SERVICEGROUP_HOST_CHECKS"), where "system" is code for
1279 public static function get_command_type($cmd)
1282 'host' => strpos($cmd, '_HOST_'),
1283 'service' => strpos($cmd, '_SVC_') ?
: strpos($cmd, '_SERVICE_'),
1284 'hostgroup' => strpos($cmd, '_HOSTGROUP_'),
1285 'servicegroup' => strpos($cmd, '_SERVICEGROUP_'),
1288 $type = array_reduce(array_keys($pos), function ($a, $b) use ($pos) {
1289 return ($pos[$a] === false ?
$b :
1290 ($pos[$b] === false ?
$a :
1291 ($pos[$a] < $pos[$b] ?
$a : $b)));
1297 * Check if user is authorized for the selected command
1298 * http://nagios.sourceforge.net/docs/3_0/configcgi.html controls
1299 * the correctness of this method
1301 * -1: No command passed
1302 * -2: Contact can't submit commands
1303 * -3: not a configured contact
1304 * -4: Contact can't submit commands on this object type.
1305 * -5: Contact can't submit commands on this specific object.
1306 * true: authorized for command
1308 public static function is_authorized_for($params, $cmd = false, $throw_exception_on_error = false)
1311 $cmd = isset($params['cmd_typ']) ?
$params['cmd_typ'] : $cmd;
1313 # first see if this is a contact and, if so, if that contact
1314 # is allowed to submit commands. If it isn't, we can bail out
1316 # FIXME: this is stupid
1317 $contact = ContactPool_Model
::get_current_contact();
1318 if ($contact !== false) {
1319 if (!$contact->get_can_submit_commands()) {
1320 if($throw_exception_on_error) {
1321 throw new Exception("Contact can not submit commands", 401);
1328 'service' => arr
::search($params, 'service'),
1329 'host' => arr
::search($params, 'host_name', array()),
1330 'hostgroup' => arr
::search($params, 'hostgroup_name'),
1331 'servicegroup' => arr
::search($params, 'servicegroup_name'),
1334 $type = self
::get_command_type($cmd);
1335 if ($type === 'system') {
1336 foreach ($objects as $k => $obj) {
1344 $user = Auth
::instance()->get_user();
1346 # second we check if this contact is allowed to submit
1347 # the type of command we're looking at and, if so, if
1348 # we can bypass fetching all the objects we're authorized
1350 if ($type == 'system') {
1351 # No per-contact rights, you're in or your out
1352 $authorized = $user->authorized_for('system_commands');
1353 if(!$authorized && $throw_exception_on_error) {
1354 throw new Exception("Not authorized for system_commands", 401);
1358 else if ($user->authorized_for($type.'_edit_all')) {
1359 # All of this type - wee!
1362 else if (!$objects[$type] && $user->authorized_for($type.'_edit_contact')) {
1363 # A valid use-case is to see /if/ the user /would/ be allowed to
1364 # submit this command, should them later try to, for displaying
1365 # proper items in right click menus.
1366 # When the user is specified for specific objects, and didn't
1367 # specify any at all, tell them that it is OK to try.
1370 else if (!$user->authorized_for($type.'_edit_contact')) {
1371 # Not edit all, not by contact - no rights.
1372 if($throw_exception_on_error) {
1373 throw new Exception("Not authorized for {$type}_edit_contact", 401);
1378 # not authorized from cgi.cfg, and not a configured contact,
1380 if ($contact === false) {
1381 if($throw_exception_on_error) {
1382 throw new Exception("Not authorized from cgi.cfg and not contact", 401);
1387 if ($objects['service']) {
1388 if (!is_array($objects['service']))
1389 $objects['service'] = array($objects['service']);
1390 if (!is_array($objects['host']))
1391 $objects['host'] = array($objects['host']);
1392 foreach ($objects['service'] as $service) {
1393 if (strstr($service, ';')) {
1394 # we have host_name;service in service field
1395 $parts = explode(';', $service, 2);
1398 $parts = array(end($objects['host']), $service);
1400 if (!$user->authorized_for_object('services', $parts)) {
1401 if($throw_exception_on_error) {
1402 throw new Exception("Not authorized for '".implode(';', $parts)."'", 401);
1409 if (!is_array($objects[$type])) {
1410 $objects[$type] = array($objects[$type]);
1412 foreach ($objects[$type] as $object) {
1413 if (!$user->authorized_for_object($type.'s', $object)) {
1414 if($throw_exception_on_error) {
1415 throw new Exception("Not authorized for '$object'", 401);