nagioscmd Class Reference
Nagios FIFO command helper.
More...
Public Member Functions |
| nagios_name ($id) |
| Obtain Nagios' macro name for the given command.
|
Static Public Member Functions |
static | cmd_info ($name=false) |
| Obtain information about a command.
|
static | cmd_name ($name=false) |
| If the provided name is a valid command, return it, otherwise return false.
|
static | command_id ($name) |
| Obtain the id for a command.
|
static | build_command ($cmd, $param) |
| Construct a command suitable for passing to Nagios.
|
static | submit_to_nagios ($cmd, $args="", &$output=false) |
| Actually submit command to nagios.
|
static | command_link ($command_type=false, $host=false, $service=false, $lable='', $method='submit', $force=false, $attributes=NULL) |
| Helper function to save us from typing the links to the cmd controller.
|
static | command_ajax_button ($command, $lable, $params=false, $state=false) |
| Returns the HTML for a button which can send commands through ajax instead of page reloads!
|
static | get_command_type ($cmd) |
| Given the name of a command, return the type of the command (which can beharder than you'd think, see for example "ENABLE_SERVICEGROUP_HOST_CHECKS"), where "system" is code for "can't tell".
|
static | is_authorized_for ($params, $cmd=false, $throw_exception_on_error=false) |
| Check if user is authorized for the selected command http://nagios.sourceforge.net/docs/3_0/configcgi.html controls the correctness of this method Return codes: -1: No command passed -2: Contact can't submit commands -3: not a configured contact -4: Contact can't submit commands on this object type.
|
Detailed Description
Nagios FIFO command helper.
Member Function Documentation
static nagioscmd::build_command |
( |
$ |
cmd, |
|
|
$ |
param | |
|
) |
| | [static] |
Construct a command suitable for passing to Nagios.
- Parameters:
-
| $cmd | string or command-info array |
| $param | Parameters to use as macros for the template |
- Returns:
- A command string on success, false on errors
static nagioscmd::cmd_info |
( |
$ |
name = false |
) |
[static] |
Obtain information about a command.
"information" in this case is a template we can use to inject one such command into Nagios' FIFO, a description of the command, it's name and the number Nagios has assigned to it via a macro.
- Parameters:
-
| $name | The 'name' of the command (DEL_HOST_COMMENT, fe) |
- Returns:
- array with command information if a command was found, or false otherwise
static nagioscmd::command_ajax_button |
( |
$ |
command, |
|
|
$ |
lable, |
|
|
$ |
params = false , |
|
|
$ |
state = false | |
|
) |
| | [static] |
Returns the HTML for a button which can send commands through ajax instead of page reloads!
TODO Handling of command parameters
static nagioscmd::command_id |
( |
$ |
name |
) |
[static] |
Obtain the id for a command.
- Parameters:
-
| $name | The name of the command |
- Returns:
- False on errors, the numeric id on success (may be 0)
static nagioscmd::command_link |
( |
$ |
command_type = false , |
|
|
$ |
host = false , |
|
|
$ |
service = false , |
|
|
$ |
lable = '' , |
|
|
$ |
method = 'submit' , |
|
|
$ |
force = false , |
|
|
$ |
attributes = NULL | |
|
) |
| | [static] |
Helper function to save us from typing the links to the cmd controller.
static nagioscmd::is_authorized_for |
( |
$ |
params, |
|
|
$ |
cmd = false , |
|
|
$ |
throw_exception_on_error = false | |
|
) |
| | [static] |
Check if user is authorized for the selected command http://nagios.sourceforge.net/docs/3_0/configcgi.html controls the correctness of this method Return codes: -1: No command passed -2: Contact can't submit commands -3: not a configured contact -4: Contact can't submit commands on this object type.
-5: Contact can't submit commands on this specific object. true: authorized for command
nagioscmd::nagios_name |
( |
$ |
id |
) |
|
Obtain Nagios' macro name for the given command.
- Parameters:
-
| $id | Numeric or string representation of command |
- Returns:
- False on errors, Nagios' macro name as string on
static nagioscmd::submit_to_nagios |
( |
$ |
cmd, |
|
|
$ |
args = "" , |
|
|
&$ |
output = false | |
|
) |
| | [static] |
Actually submit command to nagios.
- Parameters:
-
| $cmd | The complete command |
| $args | Not at all a string, and I suspect you can't use it |
| $output | string If a response was received from naemon, the message will be set here |
- Returns:
- boolean false on error, else true
The documentation for this class was generated from the following file: