Page 1 of 1

Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 11:43 am
by ponnpr7
How do I change the bubble colors in the map since there are bunch sites not online instead red I would to make it yellow.

Thanks,
Ravi

Re: Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 12:37 pm
by kyang
That would require editing the google map component which is editing the php code.

Is there a specific reason why you want hosts that are critical to show yellow?

Re: Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 12:41 pm
by ponnpr7
There is a reason for the management don't wanted to see the critical since the host wasn't been integrated on the network at the same time they don't want that host been deleted as well. They just wanted all the offline nodes to be yellow.

Re: Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 12:45 pm
by mcapra
You could probably avoid modifying the Google Maps component itself (which is messy and overwritten with updates) by leveraging the Custom Includes component. It would still require a bit of Javascript/CSS know-how though.

Re: Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 12:51 pm
by kyang
Thanks @mcapra!

That is a good way, since the component may need a lot of modification.

Re: Nagios XI Maps Bubble Color!!!

Posted: Tue Oct 03, 2017 12:54 pm
by scottwilkerson
ponnpr7 wrote:There is a reason for the management don't wanted to see the critical since the host wasn't been integrated on the network at the same time they don't want that host been deleted as well. They just wanted all the offline nodes to be yellow.
I'm not sure what is considered an offline node, but I can point you to where you would want to make the change to the component
in this file at about line 52 there is a loop that set's the marker color, and that is what would need to be edited
/usr/local/nagiosxi/html/includes/components/googlemap/buildmarkers.inc.php

Code: Select all

// loop for host statuses
foreach ($gethoststatus->children() as $status)
{

    if (strlen($status->name) > 2) //this xml array had empty variables that were set, needed a workaround
    {
        switch ($status->current_state) //grab current host state and assign a balloon icon
        {
            case 0:
                $icon = 'https://www.google.com/mapfiles/marker_green.png'; //host is up
                break;
            case 1:
                $icon = 'https://www.google.com/mapfiles/marker.png'; //host is critical
                break;
            case 2:
                $icon = 'https://www.google.com/mapfiles/marker.png'; //host is something else not good
                break;
            default:
                $icon = 'https://www.google.com/mapfiles/marker_white.png'; //set for any other unknown cases
                break;
        }

        $hostArray["{$status->host_id}"]["icon"] = $icon; //grab status_text field from xml data
        $hostArray["{$status->host_id}"]["status_text"] = $status->status_text;
        $hostArray["{$status->host_id}"]["current_state"] = $status->current_state;
    }
}
Worth noting is that this change will not survive updating the component so you will want to note your changes to be re-applied if the component is updated.