Hello all,
is it possible to configure the action url to have the command "Force an immediate check" under it?
Would be really helpful to click the little arrows in the overview in stead of opening them all and going to the advanced tab.
Thanks for your help.
Frank
Use action url to "Force immediate check"
-
frankwijers
- Posts: 22
- Joined: Fri Apr 09, 2021 6:22 am
- Rfferrao13
- Posts: 12
- Joined: Tue Aug 09, 2016 3:56 pm
Re: Use action url to "Force immediate check"
Just so you know, there is an option to force en masse:
Mass Immediate Check
https://IP/nagiosxi/includes/components ... /index.php
Mass Immediate Check
https://IP/nagiosxi/includes/components ... /index.php
Re: Use action url to "Force immediate check"
While not currently a part of the XI feature-set you could do it with the CALLBACK_CUSTOM_TABLE_ICONS callback, see Help > Callback Reference in the web interface for details.
Here's an example that does what you want:
Put this in /usr/local/nagiosxi/html/includes/components/nagiosxicallbacks/nagiosxicallbacks.inc.php:
Run this command to adjust owner/group:
Then refresh the page and see if that shows a new link for you.
If you have issues, delete the component:
NOTE: This change will add additional load time to the display of those pages as it constructs the links but it should be minimal
Here's an example that does what you want:
Code: Select all
mkdir /usr/local/nagiosxi/html/includes/components/nagiosxicallbacksCode: Select all
<?php
// include the XI component helper
require_once(dirname(__FILE__) . '/../componenthelper.inc.php');
// define/call our component initialize function
nagiosxicallbacks_component_init();
function nagiosxicallbacks_component_init()
{
// information to pass to XI about our component
$args = array(
COMPONENT_NAME => "nagiosxicallbacks",
COMPONENT_VERSION => "1.0",
COMPONENT_AUTHOR => "Nagios Enterprises, LLC",
COMPONENT_DESCRIPTION => "Demonstrate Nagios XI Callbacks inside of Custom Components",
COMPONENT_TITLE => "Nagios XI Callbacks Demonstration"
);
// register with XI
if (register_component("nagiosxicallbacks", $args)) {
// register a function to be called when CALLBACK_CUSTOM_TABLE_ICONS is executed
register_callback(CALLBACK_CUSTOM_TABLE_ICONS, 'nagiosxicallbacks_custom_table_icons');
}
}
function nagiosxicallbacks_custom_table_icons($callback_type, &$args) {
// make sure we are in the right callback
if ($callback_type == CALLBACK_CUSTOM_TABLE_ICONS) {
// Initialze some stuff we'll use a few times...
$cmd = array(
"command" => COMMAND_NAGIOSCORE_SUBMITCOMMAND,
);
$cmd["command_args"] = array(
"host_name" => $args['host_name'],
"service_name" => $args['service_description']
);
// Forced immediate check
if ($args['objecttype'] == OBJECTTYPE_HOST) {
$cmd["command_args"]["cmd"] = NAGIOSCORE_CMD_SCHEDULE_FORCED_HOST_CHECK;
$cmd["command_args"]["start_time"] = time();
$icondata = get_host_detail_command_link($cmd, "arrow_refresh.png", '');
} else {
$cmd["command_args"]["cmd"] = NAGIOSCORE_CMD_SCHEDULE_FORCED_SVC_CHECK;
$cmd["command_args"]["start_time"] = time();
$icondata = get_service_detail_command_link($cmd, "arrow_refresh.png", '');
}
$args['icons'][] = $icondata;
}
}
?>Code: Select all
chown -R nagios.nagios /usr/local/nagiosxi/html/includes/components/nagiosxicallbacksIf you have issues, delete the component:
Code: Select all
rm -rf /usr/local/nagiosxi/html/includes/components/nagiosxicallbacks