GPS Maps for Cacti

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
Jason.S
Posts: 35
Joined: Thu Jun 11, 2009 9:28 am

Post by Jason.S »

Are the finals over yet, sir?


:D


Thanks,
Jason
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Post by spiffydudex »

Proposed changes for the GPSMap plugin

-Random bugfixes and code writing errors
-Make code files smaller, currently it is masses of ugliness to sift through.
-Change the file structure layout to make more sense.
-Implement KML exporting
-Allow for untagged devices so that you can have a coverage map on only the required devices.
-Possible implementation of google street view (*this is going to be held of for last*)
-selectable locations in the USA for NOAA data
-differentiate tower from other devices by a differently shaped point.
-Allow lookup of IP address from hostname so that both types of hosts can be used.
-Multiple AP type select
-Possible search by IP or Name (*this is going to be held of for last*)
-Automatic resize to page height.

Things that will not be added
-Street View

Partially complete:
-Multiple AP selections. (This is being rewritten)
-Select Host type display options and differentiate tower from other devices by a differently shaped point. (This is being rewritten)
-Make code files smaller.
-KML exporting. - Only working sometimes?

Completed:
-Change the file structure layout to make more sense. - Alot of this is because of Thold (Thanks Jimmy)
-Random bugfixes and code writing errors. Fixed reported.
-Automatic resize to page height. - Javascript fix.
-Allow for untagged devices so that you can have a coverage map on only the required devices. - Selectable in individual host options.
-Allow lookup of IP address from hostname so that both types of hosts can be used. - This should work for any device that can get a resolved IP address.



Please let me know if there is anything else.

Yes, exams went well. Glad the burden is lifted.
Last edited by spiffydudex on Mon Jan 18, 2010 10:49 am, edited 6 times in total.
Jason.S
Posts: 35
Joined: Thu Jun 11, 2009 9:28 am

Post by Jason.S »

How about a drop down to select if this item is an AP or SU. We have about 5 different AP types, so the one item you can select in the options does no good for us.
Jason.S
Posts: 35
Joined: Thu Jun 11, 2009 9:28 am

Post by Jason.S »

And, how about a search too. By IP or name.
VegardAa
Posts: 6
Joined: Wed Oct 14, 2009 4:08 am

Post by VegardAa »

Hello again! Glad to hear that the exams went well.

Are you going to work on the "custome" image/color feature? It would be very nice if you could. I dunno how much work you'll have to put down to make this work, but I'll give you 100 karma points.
Jason.S
Posts: 35
Joined: Thu Jun 11, 2009 9:28 am

Post by Jason.S »

Good to see you are making head-way on the new version! Thank you!


Jason Swindle
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Post by sini »

Hi,

Just installed this plugin and i got a following notice error on the top of the page:
"Notice: Undefined offset: 3 in /var/www/cacti-0.8.7e/plugins/gpsmap/gpsmap.php on line 49"

Do i just switch off php notice error msgs or is it bug?

Thx!
--
Cacti Version 0.8.7e
Cacti OS unix
PA.: 2.6
SNMP Version NET-SNMP version: 5.4.1
RRDTool Version RRDTool 1.3.x
PHP Version 5.2.10-2ubuntu6.3
Sini
lupick
Posts: 18
Joined: Tue Nov 28, 2006 10:44 am

PHP Parse error

Post by lupick »

Dear all I'ìve installed and configured gpsmap plugin but when I click on gpsmap button I've got

PHP Parse error: syntax error, unexpected $end in /srv/www/vhosts/cacti.domain.local/plugins/gpsmap/gpsmap.php on line 329, referer: http://cacti.wamgroup.local/plugins.php ... &id=gpsmap


I've downloaded 1.41 version

thank's

L.
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Post by spiffydudex »

sini wrote:Hi,

Just installed this plugin and i got a following notice error on the top of the page:
"Notice: Undefined offset: 3 in /var/www/cacti-0.8.7e/plugins/gpsmap/gpsmap.php on line 49"

Do i just switch off php notice error msgs or is it bug?

Thx!
--
Cacti Version 0.8.7e
Cacti OS unix
PA.: 2.6
SNMP Version NET-SNMP version: 5.4.1
RRDTool Version RRDTool 1.3.x
PHP Version 5.2.10-2ubuntu6.3

This is a bug, in that version it could not get IP addresses from regular hostnames.
In the new version I am working on I have more error checking, but in the meantime you can replace this code starting on line 47 and ending on 62... or just ignore the error.

Code: Select all

while($row = mysql_fetch_array($result,MYSQL_BOTH)){
	if(isset($row['latitude'])&&isset($row['longitude'])&&($row['latitude'] != '')&&($row['latitude'] != '')&&($row['latitude'] != '0')&&($row['longitude'] != '0')){
		list($first, $second, $third, $fourth) = split('[.]',$row["hostname"]);
				$status = $row['status'];
		if ($status == 3){
			$status = "up"; 
		}elseif($status == 1){
			$status = "down";
		}elseif($status == 2){
			$status = "recovering";
		}else{ $status = "Undefined"; }
		if($row['disabled'] == "on"){
		$status = "disabled";}
		$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],$row['availability'],$status,$row['cur_time']);
	}
}	
With this code

Code: Select all

while($row = mysql_fetch_array($result,MYSQL_BOTH)){
	if(isset($row['latitude'])&&isset($row['longitude'])&&($row['latitude'] != '')&&($row['latitude'] != '')&&($row['latitude'] != '0')&&($row['longitude'] != '0')){
		if (list($first, $second, $third, $fourth) = split('[.]',gethostbyname($row["hostname"]))){
				$status = $row['status'];
		if ($status == 3){
			$status = "up"; 
		}elseif($status == 1){
			$status = "down";
		}elseif($status == 2){
			$status = "recovering";
		}else{ $status = "Undefined"; }
		if($row['disabled'] == "on"){
		$status = "disabled";}
		$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],$row['availability'],$status,$row['cur_time']);
	}
	}
}	
lupick wrote:PHP Parse error: syntax error, unexpected $end in /srv/www/vhosts/cacti.domain.local/plugins/gpsmap/gpsmap.php on line 329, referer: http://cacti.wamgroup.local/plugins.php ... &id=gpsmap
This could be a number of things. Something I hope to fix in the new version. I really don't know what it could be. Which reminds me, I need to add a debug option so that it will display checkpoints.
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Post by phalek »

maybe that eroroccurs as the gpsmap.php file only contains a

Code: Select all

<?
instead of the

Code: Select all

<?php
at line 323 ?
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Post by spiffydudex »

phalek wrote:maybe that eroroccurs as the gpsmap.php file only contains a

Code: Select all

<?
instead of the

Code: Select all

<?php
at line 323 ?
You can try that, I was under the impression that using the full " <?php " made a new instance of the php engine. I am probably wrong as most of my PHP skills are self taught.

Give it a try and report back.
sini
Cacti User
Posts: 91
Joined: Mon Nov 24, 2003 10:22 am
Location: Hungary

Post by sini »

spiffydudex wrote: This is a bug, in that version it could not get IP addresses from regular hostnames.
In the new version I am working on I have more error checking, but in the meantime you can replace this code starting on line 47 and ending on 62... or just ignore the error.

Code: Select all

while($row = mysql_fetch_array($result,MYSQL_BOTH)){
	if(isset($row['latitude'])&&isset($row['longitude'])&&($row['latitude'] != '')&&($row['latitude'] != '')&&($row['latitude'] != '0')&&($row['longitude'] != '0')){
		list($first, $second, $third, $fourth) = split('[.]',$row["hostname"]);
				$status = $row['status'];
		if ($status == 3){
			$status = "up"; 
		}elseif($status == 1){
			$status = "down";
		}elseif($status == 2){
			$status = "recovering";
		}else{ $status = "Undefined"; }
		if($row['disabled'] == "on"){
		$status = "disabled";}
		$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],$row['availability'],$status,$row['cur_time']);
	}
}	
With this code

Code: Select all

while($row = mysql_fetch_array($result,MYSQL_BOTH)){
	if(isset($row['latitude'])&&isset($row['longitude'])&&($row['latitude'] != '')&&($row['latitude'] != '')&&($row['latitude'] != '0')&&($row['longitude'] != '0')){
		if (list($first, $second, $third, $fourth) = split('[.]',gethostbyname($row["hostname"]))){
				$status = $row['status'];
		if ($status == 3){
			$status = "up"; 
		}elseif($status == 1){
			$status = "down";
		}elseif($status == 2){
			$status = "recovering";
		}else{ $status = "Undefined"; }
		if($row['disabled'] == "on"){
		$status = "disabled";}
		$hostArray[] = new host($row['id'],$row['host_template_id'],$row['latitude'],$row['longitude'],$first.$second.$third.$fourth,$row['description'],$row['hostname'],$row['availability'],$status,$row['cur_time']);
	}
	}
}	
Thank You that solve the main page notice error but when i click on "IP Analysis" link i got these notice warnings:

Notice: Undefined offset: 3 in /var/www/cacti-0.8.7e/plugins/gpsmap/gpsmap.php on line 87

Notice: Undefined offset: 3 in /var/www/cacti-0.8.7e/plugins/gpsmap/gpsmap.php on line 112

Code: Select all

<?php 
not solve the problem

Thx!
--
Cacti Version 0.8.7e
Cacti OS unix
PA.: 2.6
SNMP Version NET-SNMP version: 5.4.1
RRDTool Version RRDTool 1.3.x [/code]
Sini
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Post by spiffydudex »

Its basically the same error. Just replace the entire while loop starting on 85 with the code I gave you before.
Jason.S
Posts: 35
Joined: Thu Jun 11, 2009 9:28 am

Post by Jason.S »

Any update good sir?
spiffydudex
Cacti User
Posts: 97
Joined: Thu Jul 24, 2008 11:21 am
Location: Hallsville, TX
Contact:

Post by spiffydudex »

Well, after playing with how I was going to assign different styles to different hosts. The Thold plugin provided some useful insight on how to assign attributes to portions of hosts. I had to scrap and rewrite a good portion of code, turning this into a much larger debacle than I had anticipated. I like the layout and functionality of what will be the end product, its nice clean and will actually feel a bit more completed.

I should have updated here a bit more, so I am sorry for keep you guys in the dark.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest