initial commit
commit
eda2466c6e
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once(dirname(__FILE__) . '/../componenthelper.inc.php');
|
||||||
|
|
||||||
|
report_non_ok_svc_init();
|
||||||
|
|
||||||
|
|
||||||
|
function report_non_ok_svc_init()
|
||||||
|
{
|
||||||
|
$desc = "Report on specified services in non-OK state";
|
||||||
|
if (!report_non_ok_svc_check_version()) {
|
||||||
|
$desc .= " <strong>Error: This component requires Nagios XI 5.6.0 or later.</strong>";
|
||||||
|
}
|
||||||
|
|
||||||
|
register_component("report_non_ok_svc", array(
|
||||||
|
COMPONENT_NAME => "report_non_ok_svc",
|
||||||
|
COMPONENT_AUTHOR => "hedenface",
|
||||||
|
COMPONENT_DESCRIPTION => $desc,
|
||||||
|
COMPONENT_TITLE => "Services Non-OK Report",
|
||||||
|
COMPONENT_VERSION => "0.0.0",
|
||||||
|
COMPONENT_DATE => "31/07/2021",
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!report_non_ok_svc_check_version()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
register_callback(CALLBACK_MENUS_INITIALIZED, 'report_non_ok_svc_component_addmenu');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function report_non_ok_svc_check_version()
|
||||||
|
{
|
||||||
|
if (function_exists('get_product_release')) {
|
||||||
|
if (get_product_release() >= 5600) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function report_non_ok_svc_component_addmenu()
|
||||||
|
{
|
||||||
|
$component_url = get_component_url_base("report_non_ok_svc");
|
||||||
|
|
||||||
|
$menu_section = find_menu_item(MENU_REPORTS, "menu-reports-nagiosxi", "id");
|
||||||
|
if ($menu_section == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$order = grab_array_var($menu_section, "order", "");
|
||||||
|
$new_order = $order + 0.1;
|
||||||
|
if ($new_order < 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
add_menu_item(MENU_REPORTS, array(
|
||||||
|
"type" => "link",
|
||||||
|
"title" => "Non-OK Services",
|
||||||
|
"id" => "menu-report-non-ok",
|
||||||
|
"order" => $new_order,
|
||||||
|
"opts" => array(
|
||||||
|
"href" => $component_url . "/index.php",
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
add_menu_item(MENU_REPORTS, array(
|
||||||
|
"type" => "linkspacer",
|
||||||
|
"id" => "menu-reports-non-ok-spacer",
|
||||||
|
"order" => $new_order + 0.1
|
||||||
|
));
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue