How to filter Service Status View

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
Johan159
Posts: 43
Joined: Mon Mar 30, 2015 8:05 am

How to filter Service Status View

Post 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!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: How to filter Service Status View

Post 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.
Johan159
Posts: 43
Joined: Mon Mar 30, 2015 8:05 am

Re: How to filter Service Status View

Post 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!
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: How to filter Service Status View

Post by hsmith »

It sounds like this one is working for you now. Are we good to consider this one resolved?
Former Nagios Employee.
me.
Johan159
Posts: 43
Joined: Mon Mar 30, 2015 8:05 am

Re: How to filter Service Status View

Post by Johan159 »

Yes, you can close this thread
bwallace
Posts: 1145
Joined: Tue Nov 17, 2015 1:57 pm

Re: How to filter Service Status View

Post 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.
Be sure to check out the Knowledgebase for helpful articles and solutions!
Locked