PHP Network Weathermap 0.8 (now 0.9)

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

Post Reply
gundamx
Posts: 29
Joined: Wed Mar 08, 2006 6:07 am

Post by gundamx »

Howie wrote:
davs wrote:Hi Howie and Gundamx,

Sorry for not having telling you some news, I didn't gave up, your plugins is so good, but I just changed into mysql 4 and it works fine. I know, I choose the easiest solution but I stayed about 2 days trying to resolved the problems.
Which is wierd, because I've tested with MySQL 5.0.15-nt, 5.0.14, 4.1.12-Max , 4.0.13 and some others, on Windows, Linux and FreeBSD, and I can't make this fail the same way!

Gundamx, could you please use the 'mysql' command-line tool (mysql -u root -p cacti) to manually enter this query?

Code: Select all

insert into weathermap_maps (configfile,titlecache,active) VALUES 
('minor.conf','(no title)','on');
and tell me what error you get (if you get one)?

I use mysql version 5.0.18-nt.
User avatar
ScOp3
Cacti User
Posts: 61
Joined: Wed Aug 03, 2005 4:14 am
Location: Cologne Germany
Contact:

Post by ScOp3 »

Maybe a bit OT but i think this might be some friday motivation for some of us.. :)
Attachments
Yup it works!
Yup it works!
RTFM-Cacti-8x6.jpg (36.72 KiB) Viewed 4873 times
fear leads to anger, anger leads to hate and dancing leads to sex!
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

ScOp3 wrote:Maybe a bit OT but i think this might be some friday motivation for some of us.. :)
Actually, it might just get me through the ISO27001 Security Forum meeting I have for this morning :)
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

gundamx wrote:
sorry for respond rate
i have error ERROR 1364 (HY000): Field 'imagefile' doesn't have a default value

i will check in folder "weathermap/configs" it have in the folder
Excellent. Thank you! :-)

Please change that same line 390 to

Code: Select all

$SQL = "insert into weathermap_maps (configfile,titlecache,active,imagefile,htmlfile) VALUES ('$file','$title','on','','')";
I think this will fix it for you. Please let me know, and I'll make that change in the next release.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
User avatar
ScOp3
Cacti User
Posts: 61
Joined: Wed Aug 03, 2005 4:14 am
Location: Cologne Germany
Contact:

Post by ScOp3 »

Howie wrote: Actually, it might just get me through the ISO27001 Security Forum meeting I have for this morning :)
Then it worked. I got that ITIL thingy ahead of me aswell as a 2 week CCSP Bootcamp so i can imagine the way you feel. TGIF
fear leads to anger, anger leads to hate and dancing leads to sex!
gundamx
Posts: 29
Joined: Wed Mar 08, 2006 6:07 am

Post by gundamx »

Howie wrote:
gundamx wrote:
sorry for respond rate
i have error ERROR 1364 (HY000): Field 'imagefile' doesn't have a default value

i will check in folder "weathermap/configs" it have in the folder
Excellent. Thank you! :-)

Please change that same line 390 to

Code: Select all

$SQL = "insert into weathermap_maps (configfile,titlecache,active,imagefile,htmlfile) VALUES ('$file','$title','on','','')";
I think this will fix it for you. Please let me know, and I'll make that change in the next release.

JUMBO thank... Everything work
:lol: :P
jamey
Posts: 4
Joined: Thu Apr 27, 2006 1:55 pm

Post by jamey »

Howie wrote:
knobdy wrote:You would have to have two links configured in order to figure out which side is down, since one link is just the in and out of one port/interface.

I don't know how this could be done "nicely", via just the weathermap interface, either. Perhaps it should just be semi-joined to Cacti's or thold's up/down check process and when they change the status of a device in the database from up to down or vice versa, the icon for the device is changed.

In the weathermap config you'd just define the two icons to use:
up_icon /cacti/plugins/weathermap/images/up/my_device_up.png
dn_icon /cacti/plugins/weathermap/images/dn/my_device_dn.png
See, I don't really care whether Cacti thinks my devices are down. If I wanted to see up/down info, I'd want it to come from my monitoring/alerting system (What's Up Gold, unfortunately, but Nagios or similar would be a similar situation). There are weathermap users without Cacti, too.

That would mean that the method for deciding how nodes look would have to be pretty clever, or make the user do more work. The most generic way would be to have some sort of 'plugin script' - weathermap runs yourscript.pl nodename, which then returns some sort of status code that is pre-agreed or defined in the config file. Maybe there would be some 'standard' scripts to handle Cacti and other common sources. I guess this is your 'semi-joined' really :-)

I have modified my weathermap to grab ICON and DOWN icon information from the config, and to save the information, however, I cannot figure out how to switch the image on the map. I have added an if statement that should be doing this by changing the name of the icon it is loading around line 910 of Weathermap.class.php. Note I have also added a hostname (hostn) option to the config so that I can lookup the status of that host in the cacti database on the fly.

I am missing something in the code that maybe you can help me with.

I've ran some debug, and the if seems to be working correctly, and switching the image path according to what is set in the config, however, the regular up image always displays.


if (in_array($this->hostn,$downhost)){
$temp_im=imagecreatefrompng($this->downiconfile);
} else {
$temp_im=imagecreatefrompng($this->iconfile);
};
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

jamey wrote:I have added an if statement that should be doing this by changing the name of the icon it is loading around line 910 of Weathermap.class.php. Note I have also added a hostname (hostn) option to the config so that I can lookup the status of that host in the cacti database on the fly.
Personally, I'd do this by using the hostid as the nodename (something like host32), and save having another parameter. Less parameters means less ReadConfig, less WriteConfig, less editor and less weird little special cases.
jamey wrote: I've ran some debug, and the if seems to be working correctly, and switching the image path according to what is set in the config, however, the regular up image always displays.

if (in_array($this->hostn,$downhost)){
$temp_im=imagecreatefrompng($this->downiconfile);
} else {
$temp_im=imagecreatefrompng($this->iconfile);
};
That looks like it should work, assuming that downiconfile is set correctly, and the scope of $downhost makes it visible...

There's a --dumpafter option for the command-line script that dumps the whole of the Weathermap object after the config is read, so you can see for sure about that part. You could also add some tracing to see what's going on for sure - the debug() function logs to stderr for cli weathermap, or Cacti's debug log for the cacti plugin.

Finally, if you are using different sized icons, things will go wrong with link offsets, unless you change calc_size() around line 710 or so, too. See what I mean about the little special cases? :-) That particular issue will go away in 0.9, which draws nodes in a different way, to make the editor able to share code and do drag&drop editing.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
jamey
Posts: 4
Joined: Thu Apr 27, 2006 1:55 pm

Post by jamey »

Howie wrote:
jamey wrote:I have added an if statement that should be doing this by changing the name of the icon it is loading around line 910 of Weathermap.class.php. Note I have also added a hostname (hostn) option to the config so that I can lookup the status of that host in the cacti database on the fly.
Personally, I'd do this by using the hostid as the nodename (something like host32), and save having another parameter. Less parameters means less ReadConfig, less WriteConfig, less editor and less weird little special cases.
jamey wrote: I've ran some debug, and the if seems to be working correctly, and switching the image path according to what is set in the config, however, the regular up image always displays.

if (in_array($this->hostn,$downhost)){
$temp_im=imagecreatefrompng($this->downiconfile);
} else {
$temp_im=imagecreatefrompng($this->iconfile);
};
That looks like it should work, assuming that downiconfile is set correctly, and the scope of $downhost makes it visible...

There's a --dumpafter option for the command-line script that dumps the whole of the Weathermap object after the config is read, so you can see for sure about that part. You could also add some tracing to see what's going on for sure - the debug() function logs to stderr for cli weathermap, or Cacti's debug log for the cacti plugin.

Finally, if you are using different sized icons, things will go wrong with link offsets, unless you change calc_size() around line 710 or so, too. See what I mean about the little special cases? :-) That particular issue will go away in 0.9, which draws nodes in a different way, to make the editor able to share code and do drag&drop editing.
Great, thanks for the help. By using the --dumpafter I was able to solve the issue. The map now changes icons if the host is down. I also added it to change the color of the label if there is not an icon specified.
lahrcm
Posts: 6
Joined: Wed May 03, 2006 7:36 pm

Post by lahrcm »

Hello!

I have the network weather map plugin installed and somewhat working. Very randomly I get lines in my cacti log like...

target "path to rrd file" had no valid data

When this happens the png and html files get created but the link utilization numbers are always 0% or 0 if BWLABEL is set to 'bits'

I can reproduce this on the command line as well with the same config file.

The odd thing is that sometimes it works just fine, both from the command line and from the cacti poller. I can't figure out why it works sometimes and others not.

I'm running this on windows 2003, apache, php 4.3.1, rrdtool 1.2, cacti 8.6.g

Any ideas?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

lahrcm wrote:Hello!

I have the network weather map plugin installed and somewhat working. Very randomly I get lines in my cacti log like...

target "path to rrd file" had no valid data

When this happens the png and html files get created but the link utilization numbers are always 0% or 0 if BWLABEL is set to 'bits'
My guess would be that your poller cycle takes a while to run. Somewhere around 3-4 minutes? It seems that the way rrdtool averages things means that it will return NaNs instead of the last entry in this situation. Since it only happens sometimes, I would guess that the rrds it happens for are amongst the first ones polled, and you are right on the borderline of this failure mode.

The two solutions are: change the 'now-400' to 'now-800' in Weathermap.class.php (0.82 will have this change), and/or switch to cactid so that your polling runs much quicker - be sure to read the installation docs fully!
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
lahrcm
Posts: 6
Joined: Wed May 03, 2006 7:36 pm

Post by lahrcm »

Howie wrote:
lahrcm wrote:Hello!

I have the network weather map plugin installed and somewhat working. Very randomly I get lines in my cacti log like...

target "path to rrd file" had no valid data

When this happens the png and html files get created but the link utilization numbers are always 0% or 0 if BWLABEL is set to 'bits'
My guess would be that your poller cycle takes a while to run. Somewhere around 3-4 minutes? It seems that the way rrdtool averages things means that it will return NaNs instead of the last entry in this situation. Since it only happens sometimes, I would guess that the rrds it happens for are amongst the first ones polled, and you are right on the borderline of this failure mode.

The two solutions are: change the 'now-400' to 'now-800' in Weathermap.class.php (0.82 will have this change), and/or switch to cactid so that your polling runs much quicker - be sure to read the installation docs fully!
That fixed it. Thanks
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Post by JJX »

First of all this is an excellent plugin!! ;)

When i run the poller i get this error:

..................
OK u:0.02 s:0.06 r:2.31
PHP Warning: mime_magic: type regex BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Weathermap 0.81 in da house

Notice: Use of undefined constant WEATHERMAP - assumed 'WEATHERMAP' in /var/www/cacti/plugins/weathermap/setup.php on line 273
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Normal logging mode. If things are going wrong, turn on DEBUG in Cacti for more information!
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Map: /var/www/cacti/plugins/weathermap/configs//weathermap.conf -> /var/www/cacti/plugins/weathermap/output//weathermap_3.html & /var/www/cacti/plugins/weathermap/output//weathermap_3.png
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] About to write image file. If this is the last message in your log, increase memory_limit in php.ini
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Wrote map to /var/www/cacti/plugins/weathermap/output//weathermap_3.png and /var/www/cacti/plugins/weathermap/output//weathermap_thumb_3.png
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Weathermap has left the building
This appears almost every time (but not every time...)
Any idea how to remove the trailing slash because the graphs arent upgraded?
using the commnd:
./weathermap --config configs/weathermap.conf --output output/weathermap_3.png --htmloutput output/weathermap_3.html --debug
i get no error
thx
cacti rulez!
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

JJX wrote:First of all this is an excellent plugin!! ;)

When i run the poller i get this error:

..................
OK u:0.02 s:0.06 r:2.31
PHP Warning: mime_magic: type regex BEGIN[[:space:]]*[{] application/x-awk invalid in Unknown on line 0
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Weathermap 0.81 in da house

Notice: Use of undefined constant WEATHERMAP - assumed 'WEATHERMAP' in /var/www/cacti/plugins/weathermap/setup.php on line 273
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Normal logging mode. If things are going wrong, turn on DEBUG in Cacti for more information!
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Map: /var/www/cacti/plugins/weathermap/configs//weathermap.conf -> /var/www/cacti/plugins/weathermap/output//weathermap_3.html & /var/www/cacti/plugins/weathermap/output//weathermap_3.png
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] About to write image file. If this is the last message in your log, increase memory_limit in php.ini
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Wrote map to /var/www/cacti/plugins/weathermap/output//weathermap_3.png and /var/www/cacti/plugins/weathermap/output//weathermap_thumb_3.png
05/05/2006 08:30:22 PM - WEATHERMAP: Poller[0] Weathermap has left the building
This appears almost every time (but not every time...)
Any idea how to remove the trailing slash because the graphs arent upgraded?
using the commnd:
./weathermap --config configs/weathermap.conf --output output/weathermap_3.png --htmloutput output/weathermap_3.html --debug
i get no error
thx
The double-slashes don't cause a problem as far as I know, but if you want to change it, edit setup.php and change lines 239/240 to:

Code: Select all

        $outdir = dirname(__FILE__).DIRECTORY_SEPARATOR.'output';
        $confdir = dirname(__FILE__).DIRECTORY_SEPARATOR.'configs';
If this really does fix your maps not appearing, I'd like to know though! On every system I know of the second slash is just ignored.

The line 273 warning is fixed by adding quotes around 'WEATHERMAP'.

Both these changes are in 0.82, which I'm planning to put out this weekend. It's purely bug fixes, since I think I've caught up with bugs now! :-)

0.9 is (just about) in progress now. I'm playing with AJAXish stuff for the editor.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
JJX
Cacti User
Posts: 402
Joined: Thu Oct 06, 2005 5:03 am

Post by JJX »

thx for the reply
Before making any changes i get these in the log:
05/06/2006 07:05:08 PM - WEATHERMAP: Poller[0] About to write image file. If this is the last message in your log, increase memory_limit in php.ini
05/06/2006 07:05:08 PM - THOLD: Poller[0] Checking Thresholds
05/06/2006 07:05:08 PM - WEATHERMAP: Poller[0] Map: /var/www/cacti/plugins/weathermap/configs//weathermap.conf -> /var/www/cacti/plugins/weathermap/output//weathermap_4.html & /var/www/cacti/plugins/weathermap/output//weathermap_4.png
05/06/2006 07:05:08 PM - WEATHERMAP: Poller[0] Normal logging mode. If things are going wrong, turn on DEBUG in Cacti for more information!
05/06/2006 07:05:08 PM - WEATHERMAP: Poller[0] Weathermap 0.81 in da house
05/06/2006 07:05:08 PM - SYSTEM STATS: Time:6.2194 Method:cmd.php Processes:1 Threads:N/A Hosts:16 HostsPerProcess:16 DataSources:150 RRDsProcessed:95
05/06/2006 07:05:02 PM - CMDPHP: Poller[0] Host[1] DS[58] WARNING: Result from CMD not valid. Partial Result:
For some reason weathermap isnt refreshed :(
If i run "php poller.php" it refresh as it should
Strange.....

After doing the above changes i get in the log:
05/06/2006 07:15:08 PM - WEATHERMAP: Poller[0] Using a non-existent special font (100) - falling back to internal GD fonts
05/06/2006 07:15:08 PM - WEATHERMAP: Poller[0] About to write image file. If this is the last message in your log, increase memory_limit in php.ini
05/06/2006 07:15:07 PM - THOLD: Poller[0] Checking Thresholds
05/06/2006 07:15:07 PM - WEATHERMAP: Poller[0] Map: /var/www/cacti/plugins/weathermap/configs/weathermap.conf -> /var/www/cacti/plugins/weathermap/output/weathermap_4.html & /var/www/cacti/plugins/weathermap/output/weathermap_4.png
05/06/2006 07:15:07 PM - WEATHERMAP: Poller[0] Normal logging mode. If things are going wrong, turn on DEBUG in Cacti for more information!
05/06/2006 07:15:07 PM - WEATHERMAP: Poller[0] Weathermap 0.81 in da house
05/06/2006 07:15:07 PM - SYSTEM STATS: Time:6.2315 Method:cmd.php Processes:1 Threads:N/A Hosts:16 HostsPerProcess:16 DataSources:150 RRDsProcessed:95
05/06/2006 07:15:01 PM - CMDPHP: Poller[0] Host[1] DS[58] WARNING: Result from CMD not valid. Partial Result:
but still weathermap doesnt refesh & running "php poller.php" it does.

any idea why weathermap doesnt refresh with poller?
cacti rulez!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest