This is by no means meant to be an exhaustive list of the functions available in Nagios Fusion. These are the most common ones that will be used by extending Fusion by building custom components and dashlets.
If you have any questions or require clarification, don't hesitate to visit the Nagios Support Form!
register_component
Description | Registers a component with Fusion. | ||||||
---|---|---|---|---|---|---|---|
Usage |
register_component($opts)
| ||||||
Arguments |
| ||||||
Return | Returns a boolean representing if the function was successful |
register_dashlet
Description | Registers a dashlet with Fusion. | ||||||
---|---|---|---|---|---|---|---|
Usage |
register_dashlet($opts)
| ||||||
Arguments |
| ||||||
Return | Returns a boolean representing if the function was successful |
register_callback
Description |
Register a function to be executed when a specific callback occurs. The function you specify must accept two arguments, the first will be the callback being performed, and the second will be an array of data passed. Generally called | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
register_callback($cbtype, $func)
| |||||||||
Arguments |
|
get_dashlet_dependent_params
Description |
Used by dashlets as a generic | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_dashlet_dependent_params($get_servers = true, $get_hosts = true, $get_services = true, $server_type = SERVER_TYPE_FUSION)
| |||||||||||||||
Arguments |
| |||||||||||||||
Return |
Returns an array containing the specified options suitable for passing to a |
get_dashlet_dependent_request_vars
Description |
This function is used in conjunction with | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_dashlet_dependent_request_vars(&$server, &$host, &$service)
| ||||||||||||
Arguments |
|
pack_array
Description | Used to pack an array for storage in the database. | ||||||
---|---|---|---|---|---|---|---|
Usage |
pack_array($arr)
| ||||||
Arguments |
| ||||||
Return | Returns a base64 encoded and serialized array (or just what was originally passed on failure). |
unpack_array
Description |
Unpack a previously packed array (using | ||||||
---|---|---|---|---|---|---|---|
Usage |
unpack_array($packed)
| ||||||
Arguments |
| ||||||
Return | Returns an array (or just what was originally passed on failure). |
dashlets_data_check
Description | This function serves to check to see if any data exists in the polling database. | ||||||
---|---|---|---|---|---|---|---|
Usage |
dashlets_data_check($redirect = true)
| ||||||
Arguments |
| ||||||
Return |
If there is data then this function returns true, otherwise if |
get_servers
Description | Return an array of all of the servers that are fused. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_servers($enabled_servers_only = true, $include_exclusions = true, $order_alphabetically = true)
| ||||||||||||
Arguments |
| ||||||||||||
Return | Returns an array of fused servers based on the options specified, or false if none or error. |
get_server
Description | Retrieve specific server data based on a server's database id or validates an existing server array. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_server($server_data)
| ||||||
Arguments |
| ||||||
Return | Returns an associative array of fused server data, or false on failure. |
get_server_polled_key
Description | Grab all existing entries of a key in the polled data tables or a certain number based on the limit supplied. | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_server_polled_key($server, $key, $limit = 0, $user_id = 0)
| |||||||||||||||
Arguments |
| |||||||||||||||
Return |
Returns an associative array that is required to cycle through and run $service_status = get_server_polled_key($server, 'service_status', $limit = 1); $services = unpack_array($service_status[0]['service_status']); |
get_appended_server_url
Description | Build a URL dependent on the type of server passed. | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_appended_server_url($url, $server_type, $authentication_type, $xi_fusekey = null, $xi_session = null, $core_basic = null)
| |||||||||||||||||||||
Arguments |
| |||||||||||||||||||||
Return | Returns a fully built URL depending on the options specified. Example usage (building) $url = get_appended_server_url($url, $server_type, $authentication_type, "api/v1/objects/", "backend/", "statusjson.cgi")
Where |
child_page
Description | Prints a child page (one of the inner frame pages), and includes all of the headers. Automatically handles the closing of the page as well. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
child_page($page_title, $opts = array(), $page = null)
| ||||||||||||
Arguments |
|
$menu->add_link
Description | Add a link to the side navigation menu object. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
add_link($link, $search_section_id, $terms = null)
| ||||||||||||
Arguments |
|
$menu->add_link_spacer
Description | Add a link spacer to the side navigation menu object. | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
add_link_spacer($search_section_id, $terms = null)
| |||||||||
Arguments |
|
menu_link
Description |
Build a link to insert into the | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
menu_link($title = '', $href = '', $class = '', $id = '', $icon = '', $target = '', $raw = '')
| ||||||||||||||||||||||||
Arguments |
|
grab_request_var
Description |
Nagios wrapper function for grabbing values from | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
grab_request_var($varname, $default = "")
| |||||||||
Arguments |
| |||||||||
Return |
Returns either the |
grab_array_var
Description | Nagios wrapper function for grabbing values from PHP arrays with minimal effort. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
grab_array_var($arr, $key, $default = '')
| ||||||||||||
Arguments |
| ||||||||||||
Return |
Returns either |
set_option
Description | Sets an option in the options table of the fusion database (a basic key/value store). | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
set_option($name, $value)
| |||||||||
Arguments |
|
get_option
Description | Get the value of an option that exists in the options table in the fusion database (a basic key/value store). | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_option($name, $default = null)
| |||||||||
Arguments |
| |||||||||
Return |
Returns the option's value if found, |
set_array_option
Description |
Use this to set an option that's an array. It uses the | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
set_array_option($name, $array)
| |||||||||
Arguments |
|
get_array_option
Description |
Get the value of an option that exists that has been set using the | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_array_option($name, $default = array())
| |||||||||
Arguments |
| |||||||||
Return |
Returns the option's unpacked value if found, |
register_poll_callback
Description | Register a predefined end point for Fusion to connect to during polling. You may optionally also specify the function that transforms the raw data into the proper format for database inclusion. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
register_poll_callback($server_type, $poll_type, $cb = null)
| ||||||||||||
Arguments |
|
flash_message
Description | Flash a message to be displayed using the message banner on next page load. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
flash_message($text, $type = 'info', $options = array())
| ||||||||||||
Arguments |
|
get_base_dir
Description | Get the location of Fusion's html directory. |
---|---|
Usage |
get_base_dir()
|
Return |
Returns the html directory (e.g.: |
convert_server_timestring_to_local_timestring
Description |
Convert a given timestring (passed to | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
convert_server_timestring_to_local_timestring($server, $timestring)
| |||||||||
Arguments |
| |||||||||
Return | Returns |
get_formatted_number
Description | Convert a given number to the logged in user's specified number format | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Usage |
get_formatted_number($num = 0, $dec = -1, $format = NF_AUTO)
| ||||||||||||
Arguments |
| ||||||||||||
Return | Return a formatted number. |
user_date
Description | Convert a unix timestamp into the specified user's preferred datetime format. | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Usage |
user_date($time = null, $user_id = 0)
| |||||||||
Arguments |
| |||||||||
Return | Returns the converted datetime format. |
get_base_url
Description | Get the base URL of the Fusion server. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_base_url($usefullpath = true)
| ||||||
Arguments |
| ||||||
Return | Returns the base URL of the Fusion server. |
get_dashlets_base_url
Description | Get the dashlets URL of the Fusion server. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_dashlets_base_url($usefullpath = false)
| ||||||
Arguments |
| ||||||
Return | Returns the base dashlets URL of the Fusion server. |
get_components_base_url
Description | Get the components URL of the Fusion server. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_components_base_url($usefullpath = false)
| ||||||
Arguments |
| ||||||
Return | Returns the base components URL of the Fusion server. |
get_image_url
Description | Get a specified image's URL from the Fusion server. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_image_url($img)
| ||||||
Arguments |
| ||||||
Return | Returns the specified image's URL. |
get_icon_url
Description | Get a specified icons's URL from the Fusion server. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_icon_url($img)
| ||||||
Arguments |
| ||||||
Return | Returns the specified icon's URL. |
get_base_uri
Description | Get the Fusion server's base URI. | ||||||
---|---|---|---|---|---|---|---|
Usage |
get_base_uri($usefullpath = true)
| ||||||
Arguments |
| ||||||
Return | Returns the Fusion server's base URI. |