nagioscmd_Core 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, $pipe_path)
 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 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)
 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 authorized from cgi.cfg, and not a configured contact false: fallthrough, not authorized for anything.

Detailed Description

Nagios FIFO command helper.


Member Function Documentation

static nagioscmd_Core::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_Core::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_Core::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_Core::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.

nagioscmd_Core::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_Core::submit_to_nagios ( cmd,
pipe_path 
) [static]

Actually submit command to nagios.

Parameters:
$cmd The complete command
$pipe_path Path to the nagios path
Returns:
false on error, else true

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 6 May 2013 for ninja by  doxygen 1.6.1