GPS Maps for Cacti

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: GPS Maps for Cacti

Post by TheWitness »

This is an example from thold. If you don't want to interfere with the poller and go to the background to run, you use the function exec_background(binary, arguments)

Code: Select all

api_plugin_register_hook('thold', 'poller_bottom', 'thold_poller_bottom', 'includes/polling.php');
Having the function itself out of setup.php as shown here, reduces load on the web server during page loads.

An example might be something like:

Code: Select all

exec_background("/usr/bin/php", " -q help_me.php -A -B -C");
TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
CCNAJ
Posts: 30
Joined: Fri Apr 15, 2011 7:13 am
Location: Australia

Re: GPS Maps for Cacti

Post by CCNAJ »

Thanks SpiffyDev for the update.

It is working on 3/4 of my setups but one is persistently a PITA.

It is also the only one running on Windows 2008 and behind a bluecoat (which has been exempted though).

The problem exists across all browsers and on the server itself.

Overlay is turned off and no modifications were made...but just a blank map.

Error 183: Uncaught SyntaxError: Unexpected token

Appreciate any help as the google fu doesnt seem to get a hit....
Attachments
gpsmaps-error-syntax.JPG
gpsmaps-error-syntax.JPG (71.23 KiB) Viewed 4199 times
++++++ Cacti Newbie ++++++++++++++++++++++++++++++++++++++++++
Cacti 0.8.8f with PIA on a Centos6 VM
Plugins Used: Infopage | RouterConfigs | Spikekill | BOOST | REALTIME | CLOG
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 »

For whatever reason, it seems like you have a degree symbol in the latitude coordinate. That's probably breaking the function.
CCNAJ
Posts: 30
Joined: Fri Apr 15, 2011 7:13 am
Location: Australia

Re: GPS Maps for Cacti

Post by CCNAJ »

spiffydudex wrote:For whatever reason, it seems like you have a degree symbol in the latitude coordinate. That's probably breaking the function.
Bullseye! -- thanks it is up and running perfectly now.

Think I copied it across from Google-Earth and just didn't spot it when troubleshooting.

Many Thanks and once again - great work on a fantastic plugin :)
++++++ Cacti Newbie ++++++++++++++++++++++++++++++++++++++++++
Cacti 0.8.8f with PIA on a Centos6 VM
Plugins Used: Infopage | RouterConfigs | Spikekill | BOOST | REALTIME | CLOG
lany
Posts: 12
Joined: Sun Mar 18, 2007 4:33 am

Re: GPS Maps for Cacti

Post by lany »

Hi

After upgrading to latest version (1.63) of gpsmap I´ve lost the "popup" window when I click on hosts in the map. Nothing happens when the nodes are clicked. Anyone else who had this problem?

Regards
Lars

---Problem solved. I found that the createMarker() function was missing in the code. Added it from prev. version and corrected the call.
Last edited by lany on Sun Feb 05, 2012 11:39 am, edited 1 time in total.
skareb
Posts: 6
Joined: Mon Jul 04, 2011 10:58 am

Re: GPS Maps for Cacti

Post by skareb »

Hi all !

I 'm stuck trying to troubleshoot why my hosts don't show up on the map.
Below, the error message:

Code: Select all

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/plugins/gpsmap/includes/processregion.php on line 43

Warning: Missing argument 18 for host::host(), called in /var/www/html/plugins/gpsmap/includes/processregion.php on line 46 and defined in /var/www/html/plugins/gpsmap/class/hosts_class.php on line 23

Notice: Undefined variable: group in /var/www/html/plugins/gpsmap/class/hosts_class.php on line 45
The gpsXML.xml file is populated, but with the group empty.
I'm using the 1.63 release.

Did I miss something in the config ?

Thank you in adavance for you help !

Br,

Skareb
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

Hello, I've installed GPS Maps, but its not working properly, maybe someone can give me some hints. I've made an API key from code.google.com, but when I try to access the map it keeps saying :
Google has disabled use of the Maps API, invalid key, etc,etc. If I login with my account, and check the key, everything looks ok.
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 »

skareb wrote:Hi all !

I 'm stuck trying to troubleshoot why my hosts don't show up on the map.
Below, the error message:

Code: Select all

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /var/www/html/plugins/gpsmap/includes/processregion.php on line 43

Warning: Missing argument 18 for host::host(), called in /var/www/html/plugins/gpsmap/includes/processregion.php on line 46 and defined in /var/www/html/plugins/gpsmap/class/hosts_class.php on line 23

Notice: Undefined variable: group in /var/www/html/plugins/gpsmap/class/hosts_class.php on line 45
The gpsXML.xml file is populated, but with the group empty.
I'm using the 1.63 release.

Did I miss something in the config ?

Thank you in adavance for you help !

Br,

Skareb
Make sure the group number is not left blank in the device properties. By default it is 0.

Atreides wrote:Hello, I've installed GPS Maps, but its not working properly, maybe someone can give me some hints. I've made an API key from code.google.com, but when I try to access the map it keeps saying :
Google has disabled use of the Maps API, invalid key, etc,etc. If I login with my account, and check the key, everything looks ok.
Make sure you copy the whole code. Usually just double clicking the code and copy/paste will only select 2/3rds of the code. Also check that you are activating for the correct domain address. If you are visiting the site via FooDomain.com then get a code for FooDomain.com.
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 »

Edit... I'm a dunce, a very basic beginner error that I should have a week ago. Anywho, a new version should be out soon.

This one has some major changes from the way things were previously done. It should improve the response time of the Google map as well as provide static XML/KML files for the duration of your poller time. (Gives a reason to have an auto-refresh time now.) Yes it will increase the load every time the poller hits, however, this will allow for exporting of certain subnets to a custom google map or to google earth via KML and it will get rid of several lines of code. (Less headache in the long run)

It has been requested several times and I think I ought to deliver. A User Guide.
Last edited by spiffydudex on Mon Feb 06, 2012 9:32 pm, edited 2 times in total.
skareb
Posts: 6
Joined: Mon Jul 04, 2011 10:58 am

Re: GPS Maps for Cacti

Post by skareb »

Make sure the group number is not left blank in the device properties. By default it is 0.
Hi spiffydudex,

Thank you for your reply.
The device group number is filled in the device properties. Do you have any ideas how I can troubleshoot my issue ?

Br,

Skareb,
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: GPS Maps for Cacti

Post by tosage »

Hello i Have the same issue with a fresh installation of GpsMap 1.63.
I don't see any point in the map, however I saw something strange in the file gpsKML.kml :

http://cacti.mydomain.fr/site/plugins/g ... DrkRed.png

When i go to this URL, my web browser sho me an 404 Not Found

In my include/global.php i have set the
$config['url_path'] = '/cacti/';

define('URL_PATH', $config['url_path']);
If someone have an idea :)
Thanks !
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
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

spiffydudex wrote:
Atreides wrote:Hello, I've installed GPS Maps, but its not working properly, maybe someone can give me some hints. I've made an API key from code.google.com, but when I try to access the map it keeps saying :
Google has disabled use of the Maps API, invalid key, etc,etc. If I login with my account, and check the key, everything looks ok.
Make sure you copy the whole code. Usually just double clicking the code and copy/paste will only select 2/3rds of the code. Also check that you are activating for the correct domain address. If you are visiting the site via FooDomain.com then get a code for FooDomain.com.

Thanks, seems working now, but I cant seem to be able to add any host, prolly I'm missing something. Except adding coordonates and API key, what else do I have to do?. I dont see any buttons, or anything like a console.\


PS : Adding hosts is made from only from console/devices clicking on every host?.
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:Hello i Have the same issue with a fresh installation of GpsMap 1.63.
I don't see any point in the map, however I saw something strange in the file gpsKML.kml :

http://cacti.mydomain.fr/site/plugins/g ... DrkRed.png

When i go to this URL, my web browser sho me an 404 Not Found

In my include/global.php i have set the
$config['url_path'] = '/cacti/';

define('URL_PATH', $config['url_path']);
If someone have an idea :)
Thanks !
Yes, the KML generation for 1.63, it shouldn't have any effect on the actual map presented in the browser. If you are going to use KMLs for google earth, then to fix it replace the URL generation line is iconskml.php:

Code: Select all

$iconlist .= "<href>http://".$server."/site/plugins/gpsmap/images/icons/".$icon.".".$tail."</href>";
with:

Code: Select all

$iconlist .= "<href>http://".$server.$config['url_path']."plugins/gpsmap/images/icons/".$icon.".".$tail."</href>";
At the top of the iconskml() function add to make it look like this:

Code: Select all

function iconskml(){
global $config;
skareb wrote:
Make sure the group number is not left blank in the device properties. By default it is 0.
Hi spiffydudex,

Thank you for your reply.
The device group number is filled in the device properties. Do you have any ideas how I can troubleshoot my issue ?

Br,

Skareb,
I'm not sure why your version of the download did not include this. Hmm..very odd. Anyways...
For your problem. In processregion.php replace lines 38-49 with this:

Code: Select all

		
$group = $row['groupnum'];
		if($hostOnly){
				if($row['host_template_id']==$hostId){
					$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],0,$row['availability'],$status,$row['cur_time'],$row['GPScoverage'],$upimage,$downimage,$recoverimage,0,360,$group);
				}
			}else{
				if(in_array($row['host_template_id'],$towerIds)){
					$towerArray[] =  new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],0,$row['availability'],$status,$row['cur_time'],$row['GPScoverage'],$upimage,$downimage,$recoverimage,$start,$stop,$group);
				}else{
					$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],0,$row['availability'],$status,$row['cur_time'],$row['GPScoverage'],$upimage,$downimage,$recoverimage,0,360,$group);
				}
			}
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 reply Spiff, i test it and i will be back :)
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
Atreides
Cacti User
Posts: 174
Joined: Mon May 31, 2010 9:26 am

Re: GPS Maps for Cacti

Post by Atreides »

Cant seem to be able to add hosts/devices to the map. I tried addin new hosts, filled the GPS segment with coordonates and stuff, but nothing appears. Can someone give me a hint? do I need to edit gpsXML or gpsKML?.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest