Page 1 of 1

How to filter Service Status View

Posted: Thu Jan 07, 2016 4:48 am
by Johan159
Hello,

I would like to create a custom display for the Service Status View.

When I click on "Unhandled" I see that it creates this filter :
Filters: Service=Warning,Unknown,Critical,Not Acknowledged,Not In Downtime
I would like to append this filter so that :
- I only see the issues that are in HARD state
- I do not see the issues for the services that have their notifications disabled.

But I do not see a way to edit the filter... Is it possible?

Thanks in advance for your help!

Re: How to filter Service Status View

Posted: Thu Jan 07, 2016 5:59 pm
by ssax
*** Note: This will get reverted if you upgrade and will need to be re-implemented.
*** Make sure that you have known-good backups/vm snapshots before making any modifications

Edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/components/xicore/ajaxhelpers-status.inc.php
Around line 553 change this code:

Code: Select all

$unhandled_problems_text .= "<a href='" . $baseurl . "&show=" . $show . "&hoststatustypes=" . $hoststatustypes . "&servicestatustypes=" . (SERVICESTATE_WARNING | SERVICESTATE_UNKNOWN | SERVICESTATE_CRITICAL) . "&serviceattr=" . (SERVICESTATUSATTR_NOTACKNOWLEDGED | SERVICESTATUSATTR_NOTINDOWNTIME) . "'>" . $unhandled_problems . "</a>";
To this:

Code: Select all

$unhandled_problems_text .= "<a href='" . $baseurl . "&show=" . $show . "&hoststatustypes=" . $hoststatustypes . "&servicestatustypes=" . (SERVICESTATE_WARNING | SERVICESTATE_UNKNOWN | SERVICESTATE_CRITICAL) . "&serviceattr=" . (SERVICESTATUSATTR_NOTACKNOWLEDGED | SERVICESTATUSATTR_NOTINDOWNTIME | SERVICESTATUSATTR_HARDSTATE | SERVICESTATUSATTR_NOTIFICATIONSENABLED) . "'>" . $unhandled_problems . "</a>";
That should do what you want.

Re: How to filter Service Status View

Posted: Wed Jan 13, 2016 10:16 am
by Johan159
Thank you for your reply!

It indeed filters the service list when I click on the Unhandled problems count.

But the count itself still showed the original number of Unhandled problems (without taking the new filter into account).

So I had to adapt this section as well :

Code: Select all

 // unhandled problems
    $backendargs["current_state"] = "in:1,2,3";
    unset($backendargs["has_been_checked"]);
    //$backendargs["has_been_checked"]=1;
    $backendargs["problem_acknowledged"] = 0;
    $backendargs["scheduled_downtime_depth"] = 0;
    $backendargs["notifications_enabled"]=1;
     $backendargs["state_type"]=1;
    // Commenting below so the unhandled services number actually reflects what is displayed in the table when clicking the link -SW
    //$backendargs["host_current_state"]=0; // up state
    //$timerinfo[]=get_timer();
    //$xml=get_backend_xml_data($backendargs);
    $xml = get_xml_service_status($backendargs);
    $unhandled_problems = 0;
    if ($xml)
        $unhandled_problems = intval($xml->recordcount);

So I added the

Code: Select all

$backendargs["notifications_enabled"]=1;
$backendargs["state_type"]=1;
Thanks again for your help!

Re: How to filter Service Status View

Posted: Wed Jan 13, 2016 4:17 pm
by hsmith
It sounds like this one is working for you now. Are we good to consider this one resolved?

Re: How to filter Service Status View

Posted: Thu Jan 14, 2016 5:00 am
by Johan159
Yes, you can close this thread

Re: How to filter Service Status View

Posted: Thu Jan 14, 2016 12:16 pm
by bwallace
Glad we were able to help. We'll lock this thread now and feel free to open another should you require assistance with anything else.