Set Default Map NagiosXI

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
abishop
Posts: 25
Joined: Fri Dec 13, 2019 9:59 am

Set Default Map NagiosXI

Post by abishop »

I would like to add a map layout to "Views" but I need it to be different than the default circular balloon layout. I have searched the forums and saw where someone said to edit the:
"You can open the "/usr/local/nagiosxi/html/includes/utils-links.inc.php" file in a text editor and change line 145 from this:
CODE: SELECT ALL
function get_statusmap_link($layout = 6, $dest = "auto")

to this:
CODE: SELECT ALL
function get_statusmap_link($layout = 5, $dest = "auto")"
Which I have done (though now its like 150 something) and the default layout says the same. Is it possible to lock the map to one layout the way I like it, and attach that layout to views?

Thank You!
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

See here:

https://support.nagios.com/kb/article/n ... n-726.html

Use the link, add layout onto it via the guide, add it like so:

Code: Select all

http://YOURXISERVER/nagiosxi/includes/components/statusmap/index.php?layout=7
You can test it in the browser to see the changes.
abishop
Posts: 25
Joined: Fri Dec 13, 2019 9:59 am

Re: Set Default Map NagiosXI

Post by abishop »

I have done this, but the layout stays the default circular balloon.
https://MYSERVER/nagiosxi/includes/comp ... CH-CHARTER

I have tried others besides 7 no luck.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

What XI version are you using? I just tested in mine with 2 and 7 and they show differently, I think you are right though, they look the same but bigger. Let me see what I can find.
abishop
Posts: 25
Joined: Fri Dec 13, 2019 9:59 am

Re: Set Default Map NagiosXI

Post by abishop »

ssax wrote:What XI version are you using? I just tested in mine with 2 and 7 and they show differently, I think you are right though, they look the same but bigger. Let me see what I can find.
Your installation of Nagios XI (5.6.9)
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

The original link you modified only deals with the legacy status map so that won't work. Looking at the other code now.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

As a temporary workaround you can do this and it seems to work:

Code: Select all

/usr/local/nagiosxi/html/includes/components/statusmap/map.php

Code: Select all

        <div id="map-container" ng-hide="formDisplayed"
                nagios-map
                cgiurl="{{params.cgiurl}}"
                layout="7"
[/s]

You'll need to replace that file after every upgrade until we find a way to do it through the URL.
abishop
Posts: 25
Joined: Fri Dec 13, 2019 9:59 am

Re: Set Default Map NagiosXI

Post by abishop »

ssax wrote:As a temporary workaround you can do this and it seems to work:

Code: Select all

/usr/local/nagiosxi/html/includes/components/statusmap/map.php

Code: Select all

        <div id="map-container" ng-hide="formDisplayed"
                nagios-map
                cgiurl="{{params.cgiurl}}"
                layout="7"
You'll need to replace that file after every upgrade until we find a way to do it through the URL.
This worked for setting the map style, in that same spot I changed root="What I want" and that didn't work.

Any Ideas?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

Ok, please revert that change.

I found out that if you go here and use it, it works:

Code: Select all

http://YOURXISERVER/nagios/map.php?host=all&layout=7
You could use that and the Dashboards > Available Dashlets > Custom URL Dashlet but you'd either need to hardcode a username/pass in there or enter in your XI creds once it asks.

But for whatever reason XI isn't passing it through properly or it's being overridden somewhere, my guess is by /usr/local/nagios/share/map.php, I'm not sure if this is a bug or intended at this point.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Set Default Map NagiosXI

Post by ssax »

Ok, I got it, please edit this file:

Code: Select all

/usr/local/nagiosxi/html/includes/components/statusmap/js/map.js
Change this (around line 102) from:

Code: Select all

                        layout: $scope.search.layout ? parseInt($scope.search.layout) :
                                        6,
To:

Code: Select all

                        layout: $scope.search.layout ? parseInt($scope.search.layout) :
                                        7,
You can also set the default root there:

Change this (around line 110) from:

Code: Select all

                        root: $scope.search.root ? $scope.search.root :
                                        nagiosProcessName,
To:

Code: Select all

                        root: $scope.search.root ? $scope.search.root :
                                        "YOURROOTNODE",
That should do it, you'll need to replace it after every upgrade until the developers implement a fix to make the main ones pass through properly.
Locked