GPS Maps for Cacti

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
gonecrazy
Posts: 7
Joined: Fri Sep 14, 2007 1:25 pm

Re: GPS Maps for Cacti

Post by gonecrazy »

Ok if you have a problem with not seeing any hosts on your map when everything is correct with the new 1.63 version here is a solution.

Go into the plugins/gpsmap/js directory and edit the GPSMaps.js file. At the bottom of the file you will find the resize function, just replace it completely with the following:

Code: Select all

function resize(){

 var frame = document.getElementById("map");
 var htmlheight = document.body.parentNode.scrollHeight;
 var windowheight;                     

 if (window.innerHeight) {
        windowheight=window.innerHeight;
 }
 else if (document.documentElement && document.documentElement.clientHeight) {
        windowheight=document.documentElement.clientHeight;
 }
 else if (document.body) {
        windowheight=document.body.clientHeight;
 }

 if ( htmlheight < windowheight ) {
        document.body.style.height = windowheight + "px";
        frame.style.height = parseInt(windowheight-105) + "px";
 }
 else {
        document.body.style.height = htmlheight + "px";
        frame.style.height = parseInt(htmlheight-105) + "px"; 
 }
}

The main problem here is lots of newer versions of browsers like the ie9 and the newest chrome don't recognize "window.innerHeight" so the script would attempt to set the frame height to a negative value. This should work on most browsers now, I tested it with ie9, firefox 10.0 and 11.0, and chrome 17. Make sure you do a full reload in your browser to test it out.
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

Did that, nothing happened. The problem is(I think) that I'm doing something wrong(maybe a permision or some files I need to edit). Here are 2 printscreens for a device I added, and my GPS Map console settings.
I installed the plugin, made an API key, added a host and that was all. Maybe I have to do something else?.
Attachments
gpsmap settings.jpg
gpsmap settings.jpg (129.98 KiB) Viewed 7201 times
host.jpg
host.jpg (249.56 KiB) Viewed 7201 times
gonecrazy
Posts: 7
Joined: Fri Sep 14, 2007 1:25 pm

Re: GPS Maps for Cacti

Post by gonecrazy »

you do need to make the XML folder writable by your web server, on Centos you can just do:

chgrp apache XML
chmod g+w XML

if your in the gpsmap folder.

If you look at the gpsXML.xml file it should show the devices that you have added gps cords to. if not check your permissions and then remove the gps cords on the device and re-add them. You should also be able to look at your /var/log/httpd/error_log and see if it is generating any errors as well.
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

Did that, no errors on http logs, also no errors on cacti logs. Checked the gpsXML file and I have the devices with coordonates :

<markers><marker id="106" name="test1" address="172.25.232.3" lat="46.1030400000" lng="21.1841030000" type="Cisco - 6500" templateId="9" availability="100.00000" radius="0" status="up" latency="7.50685" group="1" />
<marker id="109" name="test" address="127.0.0.1" lat="46.1900000000" lng="21.3200000000" type="Generic SNMP-enabled Host" templateId="1" availability="99.99030" radius="0.000000" status="up" latency="1.64700" start="0" stop="0" group="3" />
</markers>
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: GPS Maps for Cacti

Post by tosage »

+1 with Atreides, nothing on the map and in apache2's log
On an other Cacti, the 1.62 of GPSMap function like a charm :oops:
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
gonecrazy
Posts: 7
Joined: Fri Sep 14, 2007 1:25 pm

Re: GPS Maps for Cacti

Post by gonecrazy »

Well this is how I figured out what was going on with mine, is open it up in ie9 and go to the gpsmap tab and go to settings in ie9 and open up "developer tools", click on the console tab in the developer tools and then refresh the gpsmap tab and see if it shows any errors the script is having. If it does you can then click on them and do some debuging to see where the problem is exactly.

I tried using the developer tools in chrome but ie9's debugger was a little more handy.
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Re: GPS Maps for Cacti

Post by spiffydudex »

Guys, I almost have a new version out that should address the problems that came in 1.63. Version 1.63 was rushed, sadly, I didn't have enough time to tidy up loose ends and test properly because of the icon file issue. My bad on that one.

I have been quite busy the past month. In the past 3 weeks I have gone from IT Technician/do-it-all-guy to Business Owner. I previously worked for a small company that setup shop as a Managed Services Provider. Well, my boss received a job offer he couldn't refuse, and literally stepped away from the company. I stepped up and formed my own company to fill the void and take over the existing customer base. I figure I'm young enough and no real life so I should be able to grow the business substantially.

So all that to say, I should have had the new version out 3 weeks ago...

I have had some chance to work on things. The biggest change currently is that all of the XML files a pre-generated by a poller post process. Every time the poller hits, the XML files will be created for all levels of your network. This will improve page/map load times and responsiveness. Also, because of this I am able to separate out (more than before) the process of rendering from the process of page/XML generation. I've already caught about 10 minor bugs from the old version that could have led to small leaks and odd problems.

The last thing I have to work on is KML file generation and some more code separation. I really want to get page generation completely separate from XML/KML generation. That way I can more easily isolate any issues you guys may have in the future.
Last edited by spiffydudex on Wed Feb 15, 2012 2:52 am, edited 1 time in total.
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Re: GPS Maps for Cacti

Post by spiffydudex »

tosage wrote:+1 with Atreides, nothing on the map and in apache2's log
On an other Cacti, the 1.62 of GPSMap function like a charm :oops:
If you have any map templates set for current device types. You may need to recheck the icon files they are using, those variables are stored in the database and would not be changed by swapping out the files for with the newer 1.63. Preferably delete and remake the templates.
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

Well, I dunno what I did, but now I can see icons for 2 hosts I added:). The mistery of IT/programming, always the problem is a "," or a ";". I assume icons can be changed right ?
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: GPS Maps for Cacti

Post by tosage »

Thanks for your help spiffy
So I haven't as fortunate as Atreides because for me it's still not working

I keep waiting the 1.62 of your plugin :oops:
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
reeyon
Posts: 5
Joined: Sun Jan 01, 2012 10:56 pm

Re: GPS Maps for Cacti

Post by reeyon »

Hi Boss, can you look into my problem? Google Map is on, but there is no any points on the map.

Code: Select all

Fri Feb 17 13:39:16 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/plugins/gpsmap/gpsmap.php
[Fri Feb 17 13:40:51 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/index.php
[Fri Feb 17 13:41:07 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/utilities.php?action=view_logfile
[Fri Feb 17 13:41:09 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/utilities.php?action=view_logfile
[Fri Feb 17 13:43:47 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/index.php
[Fri Feb 17 13:44:24 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/host.php?action=edit&id=2
[Fri Feb 17 13:45:12 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/settings.php?tab=gpsmap
[Fri Feb 17 13:48:32 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/plugins/gpsmap/gpsmap.php
[Fri Feb 17 13:56:19 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/index.php
[Fri Feb 17 13:57:11 2012] [error] [client 10.177.15.208] PHP Notice:  Undefined index: 0 in /var/www/html/cacti/plugins/gpsmap/includes/pointsxml.php on line 16, referer: http://10.177.15.5/cacti/index.php
Edit: I tried disable the plugins, and re-enable back. Now it's work. Just a suggestion, can bump in the "mouse hover" function?
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Re: GPS Maps for Cacti

Post by spiffydudex »

Good news, 1.7 is now ready for download.
http://spiffdev.com/downloads/gpsmaps-downloads

I believe I have ironed out most of the bugs. As usual, I will keep my eye on the Cacti forums and the comment section on my site for anything major. I will be releasing a PDF usage guide of sorts, as soon as I can find a free weekend to work on it and finish it up.

This is a big change from the way previous GPSMap version operated. In short, at the end of each polling cycle, XML and KML files are created, as well as static HTML map header files. This dramatically increase page generation time. Additionally, this greatly reduces the overall stress on the database. (hit every poll cycle vs every page load)

With this change, I can isolate Data generation issues vs browser compatibility issues. I am pleased with this version and I hope you guys will be too. I also removed lots of uneeded and useless code, I think the final count was close to 300 lines removed.

It does have some new polling hooks, I think they should automatically update with a simple extract and copy install. However, I am not 100% positive.

For you people having undefined index errors, please try this new version.


Also, you can still get Google API V2 keys.
They moved the location around a bit. It is not located here: https://code.google.com/apis/console/b/0/ You must have a Google account. Then, in the services section, select to enable Google Maps V2.
Go to the API Access tab, and you may have to create a new server key, one may already be provided. (I cannot remember, it has been a long time.) That is the key that you use.
geskorup
Posts: 24
Joined: Thu Nov 23, 2006 1:08 am

Re: GPS Maps for Cacti

Post by geskorup »

spiffydudex wrote:Good news, 1.7 is now ready for download.
http://spiffdev.com/downloads/gpsmaps-downloads

I believe I have ironed out most of the bugs. As usual, I will keep my eye on the Cacti forums and the comment section on my site for anything major. I will be releasing a PDF usage guide of sorts, as soon as I can find a free weekend to work on it and finish it up.

This is a big change from the way previous GPSMap version operated. In short, at the end of each polling cycle, XML and KML files are created, as well as static HTML map header files. This dramatically increase page generation time. Additionally, this greatly reduces the overall stress on the database. (hit every poll cycle vs every page load)

With this change, I can isolate Data generation issues vs browser compatibility issues. I am pleased with this version and I hope you guys will be too. I also removed lots of uneeded and useless code, I think the final count was close to 300 lines removed.

It does have some new polling hooks, I think they should automatically update with a simple extract and copy install. However, I am not 100% positive.

For you people having undefined index errors, please try this new version.


Also, you can still get Google API V2 keys.
They moved the location around a bit. It is not located here: https://code.google.com/apis/console/b/0/ You must have a Google account. Then, in the services section, select to enable Google Maps V2.
Go to the API Access tab, and you may have to create a new server key, one may already be provided. (I cannot remember, it has been a long time.) That is the key that you use.
I just upgraded Cacti to 0.8.7i w/ PIA and thought I'd give the GPSMap plugin a try again. I found a couple issues.

First, trying to uncheck either or both "Allow display of disabled hosts" and "Coverage Overlay" in Console > Settings > GPS Map, clicking the Save button, the check-boxes revert to the previous setting (enabled). The page does reload saying Save Successful. Those options also do not update in the "settings" table in the Cacti DB. I can manually update the DB and then the GPS Map settings page displays an un-checked box. Check the boxes again, click the Save button, uncheck, Save, STILL checked.

Next, the radius coverage on the map doesn't seem to be working. Yes, I have GPS coordinates (in the proper format) and fixed radius values defined for hosts. Also have the Map Template set up properly. The pins show up on the map, but after each poller run (regular cmd.php poller), no coverage overlay on the map, the all.xml file shows radius=0 for each and every host device. If I modify the radius values in the all.xml file and refresh the map, it works.. until the next poller run when the radius values are overwritten with zeros again.

I'm monitoring mainly Motorola Canopy access points, but I'm not interested in monitoring the subscriber radios (another system does that). I just want to input the fixed radius values on each host/device and have it display on the map. I don't get it.
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Re: GPS Maps for Cacti

Post by spiffydudex »

geskorup wrote:I just upgraded Cacti to 0.8.7i w/ PIA and thought I'd give the GPSMap plugin a try again. I found a couple issues.

First, trying to uncheck either or both "Allow display of disabled hosts" and "Coverage Overlay" in Console > Settings > GPS Map, clicking the Save button, the check-boxes revert to the previous setting (enabled). The page does reload saying Save Successful. Those options also do not update in the "settings" table in the Cacti DB. I can manually update the DB and then the GPS Map settings page displays an un-checked box. Check the boxes again, click the Save button, uncheck, Save, STILL checked.

Next, the radius coverage on the map doesn't seem to be working. Yes, I have GPS coordinates (in the proper format) and fixed radius values defined for hosts. Also have the Map Template set up properly. The pins show up on the map, but after each poller run (regular cmd.php poller), no coverage overlay on the map, the all.xml file shows radius=0 for each and every host device. If I modify the radius values in the all.xml file and refresh the map, it works.. until the next poller run when the radius values are overwritten with zeros again.

I'm monitoring mainly Motorola Canopy access points, but I'm not interested in monitoring the subscriber radios (another system does that). I just want to input the fixed radius values on each host/device and have it display on the map. I don't get it.
You have to remember that the data values are updated with your poller, not immediately. In order to get a coverage overlay, you will need to put devices in a group ID that is not 0. So, create a map template for the Motorola AP device type, set it as AP to True. Now when you edit the device properties you should get an extra box for Radius, Start and Stop degree. Radius will be automatically calculated to the furthest non-AP device in the group. If you do not have any other devices in the group, a radius of 0 will be used,(no devices to map distance). You can set a static radius if so desired. (I will have to check the code to see if this works without having any other devices in the group).

If setting a static radius does not work, I will do a bit of checking to see why the static radius is not being compliant. My suggestion for the time being is to include a dummy SM (even at the same coordinates as the AP or slightly off by a degree point) this will allow the radius generation portion of the code to work.


As for the saving issues, I will look into those, I didn't change much code in the setup file, so this is news to me.
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: GPS Maps for Cacti

Post by tosage »

Hello, thanks for the new version of the module.

My First feedback :

Nothing displaying on the map :)

Thanks for any advice
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests