Nagios XI Maps Bubble Color!!!

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ponnpr7
Posts: 90
Joined: Fri Jul 28, 2017 3:55 pm

Nagios XI Maps Bubble Color!!!

Post 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
You do not have the required permissions to view the files attached to this post.
kyang

Re: Nagios XI Maps Bubble Color!!!

Post 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?
ponnpr7
Posts: 90
Joined: Fri Jul 28, 2017 3:55 pm

Re: Nagios XI Maps Bubble Color!!!

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios XI Maps Bubble Color!!!

Post 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.
Former Nagios employee
https://www.mcapra.com/
kyang

Re: Nagios XI Maps Bubble Color!!!

Post by kyang »

Thanks @mcapra!

That is a good way, since the component may need a lot of modification.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios XI Maps Bubble Color!!!

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked