network map

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
ssams
Cacti User
Posts: 65
Joined: Tue Feb 01, 2005 5:54 pm
Location: Texas
Contact:

Post by ssams »

ah,
that ever elusive manual.....

thanks!
philuxe
Posts: 24
Joined: Fri Jan 07, 2005 6:15 am

Post by philuxe »

Howie wrote:
philuxe wrote: The file weathermap.conf is not present in the tarball, i m wondering if my php-gd is really the cause of my trouble ???

EDIT : the "php -m" command says me that the GD module is present, where shall I get the missing conf file ?
The weathermap.conf file is what describes your network, which is why it isn't in the tarball :-) I'd suggest having a read of the manual...
Ya I did read the manual (even the french version based on perl), it seems i dont undertand the way your script works :/ I cant see any explaination about the weathmap.conf, could someone help me ?
Mikkel
Posts: 32
Joined: Thu May 12, 2005 12:41 am

Post by Mikkel »

Hi,

I'm running php-weathermap on a Windows 2000 server and so far everything is running fine. However, the values in the network map don't match with the most recent values in the cacti graphs. Usually the network map values are running behind 2 polling cycles (10 minutes).

Also, some of the links appear to be down (grey) when they're not.

Any ideas?
philuxe
Posts: 24
Joined: Fri Jan 07, 2005 6:15 am

Post by philuxe »

Everything is working now, Howie u did a great work, congratulation !!

I have an issue with the overlib plugins, all is working fine under Firefox/Linux but it doesn't work with any browser under Windows :/

I have just copied the .js files in the root directory of the web page, am I wrong ?
philuxe
Posts: 24
Joined: Fri Jan 07, 2005 6:15 am

Post by philuxe »

Mikkel wrote:Hi,

I'm running php-weathermap on a Windows 2000 server and so far everything is running fine. However, the values in the network map don't match with the most recent values in the cacti graphs. Usually the network map values are running behind 2 polling cycles (10 minutes).

Also, some of the links appear to be down (grey) when they're not.

Any ideas?
The same here, with both soft : weathermap4rrd and howie's soft :/
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Mikkel wrote:I'm running php-weathermap on a Windows 2000 server and so far everything is running fine. However, the values in the network map don't match with the most recent values in the cacti graphs. Usually the network map values are running behind 2 polling cycles (10 minutes).
I think this is just to do with the way RRD works. What is stored is not actually the value but a moving average of some sort, as I understand it. I don't <i>think</i> there's a way around it, either... there isn't a command to retrieve the values submitted to rrdtool, only the ones where
Mikkel wrote: Also, some of the links appear to be down (grey) when they're not.
Make sure that you run weathermap just after the poller finishes. I've seen this before if you run it later in the 5-minute period. This also seems to be to do with the moving-average stuff in RRD. I run poller.php then weathermap in one batch file, so that weathermap always has the freshest information to work with.

I've never used Cacti on win32, but I guess it'll be possible the same as on Unix - have the Scheduler run a .bat which has php poller.php and your weathermap command-line(s) in it, instead of running poller.php directly.
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!)
philuxe
Posts: 24
Joined: Fri Jan 07, 2005 6:15 am

Post by philuxe »

Hi,

I would like to know how php-weather (0.4) retrieve values in the rrd file. Indeed I cant explain why percents (or values) calculated by php-weather are different from the Cacti output.

As u can see on the attachement the Cacti last value for inbound traffic is 452.90 kbits/s but php-weather retrieve 445kbits/s in the rrd file.
Attachments
php_weather.JPG
php_weather.JPG (6.65 KiB) Viewed 5007 times
cacti_out.JPG
cacti_out.JPG (41.79 KiB) Viewed 5007 times
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

philuxe wrote:I would like to know how php-weather (0.4) retrieve values in the rrd file.
Really simple:

Code: Select all

rrdtool fetch file.rrd AVERAGE -s now-15m -e now
And take the last value that exists. I think it's this same averaging issue. Although what you call the 'cacti' output is really produced by rrdtool's graph command, so it should have the same information.
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!)
philuxe
Posts: 24
Joined: Fri Jan 07, 2005 6:15 am

Post by philuxe »

Howie wrote:
philuxe wrote:I would like to know how php-weather (0.4) retrieve values in the rrd file.
Really simple:

Code: Select all

rrdtool fetch file.rrd AVERAGE -s now-15m -e now
And take the last value that exists. I think it's this same averaging issue. Although what you call the 'cacti' output is really produced by rrdtool's graph command, so it should have the same information.
Ok but Cacti have not the last 15 min AVERAGE output (5min daily) so that can explain why it s impossible to have exactly the same output.

Let me know if I m wrong, thanks for the answer
cl
Posts: 3
Joined: Tue Jun 14, 2005 2:59 pm

Post by cl »

First, Howie, thanks for this nice tool.

Now, I am no programmer and dont know php, but in case it can help someone here are a few things I had to change in php-weathermap to get it going for me, some might be due to the fact i'm running it on windows.

Changed these in weathearmap.class.php:

To get the correct data (same as cacti graph):

//* if($col=='nan') { $dataok=0; }
if($col=='-1.#IND000000e+000') { $dataok=0; }

//* $cols = preg_split("/\s+/",$line);
$cols = preg_split("/\s+/",$theline);

To get data:
//* $command = $this->rrdtool." fetch '$target' AVERAGE --start now-400";
$command = $this->rrdtool." fetch $target AVERAGE --start now-400";


Changed this in weathermap.php so i was not getting max bandwidth displayed instead of actual value when using debug mode:

case '--debug':
$DEBUG = 1;
$map->debugging = TRUE;
added this line--> break;
case '--sizedebug':
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

cl wrote:To get the correct data (same as cacti graph):

//* if($col=='nan') { $dataok=0; }
if($col=='-1.#IND000000e+000') { $dataok=0; }

//* $cols = preg_split("/\s+/",$line);
$cols = preg_split("/\s+/",$theline);
The last two (the single quotes and the missing break) were already fixed in 0.5, but the first one sounds good! I'll check it out, and drop that in... thanks a lot!

I've been reading through rrdtool docs trying to figure this stuff out, because rrdgraph manual pages claims that it uses the 'rrdtool fetch' command internally, but there isn't a LAST consolidation function available from rrdtool fetch, even though rrdgraph can display it.

I've been on-call for Real Work for the last week, but I hope to get 0.5 up in the next few days - it's mostly bugfixes, and a couple of things to make life easier for those with non-Cacti RRD files.
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
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Hi,
I have cacti 0.8.6d and same version cactid.
I download weathermap4rrd.
I select php version and configure the conf file
But there is color and util. info. ALways shows %0
Then I try to use per based weathermap4rrd. But when I try to run ./weathermap commad I get an error like these:
[root@cacti-test weathermap4rrd-perl-1.2rc3]# ./weathermap
Can't locate GD.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at ./weathermap line 11.
BEGIN failed--compilation aborted at ./weathermap line 11.
If I must have libgd,
How can i found for Fwdora core ?
And what is my problem?
User avatar
NHDave
Cacti User
Posts: 61
Joined: Sun Mar 20, 2005 9:14 am
Contact:

Post by NHDave »

TFC,

http://www.cpan.org/misc/cpan-faq.html# ... rl_modules

I wont go into what your 'other' problems may be
:wink:
User avatar
TFC
Cacti Pro User
Posts: 739
Joined: Wed Apr 09, 2003 2:17 am
Location: Izmir/Turkey

Post by TFC »

Howie wrote:I've started writing up the changes I made to weathermap-1.1.1, and a page showing how it can be set up with Cacti. The page is half-finished, but it does have a download for the modified version, and has the documentation for my changes.

Here it is if anyone wants to take a look. The last section is missing pieces in particular.

I'm actually playing with a PHP version of this program too, so that you wouldn't need to have perl/GD installed, and hopefully that can read from rrd files directly. So far the config-file is read OK, and it draws the map. No data-reading yet, but I'm still going :-) This is the largest PHP project I've written from scratch, so it's slow sometimes. I'll post something if I get it all going enough to be useful. The theory is that it'd have the same dependencies as Cacti, so if you have gotten that running, this should just drop in - maybe even read Cacti's database to find links.
Hi I use this script
my cacti directory is:
/www/htdocs/cacti
my weathermap directory is :
/www/htdocs/cacti/weathermap
and i have data folder is:
/www/htdocs/cacti/weathermap/data
all folders have permission is nobody:nobody
then I have rrdtool.Directory is:
/usr/local/rrdtool/bin/rrdtool
my rra folder is :
/www/htdocs/cacti/rra
this is my rra folder:
drwxr-xr-x 2 nobody nobody 4096 Jun 15 14:00 .
drwxr-xr-x 15 nobody nobody 4096 Jun 16 10:24 ..
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_mpls_1k_5min_cpu_32.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_mpls_1k_mem_free_33.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_mpls_1k_mem_used_34.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 ankara_mpls_1k_traffic_in_35.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_zk_7507_5min_cpu_28.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_zk_7507_mem_free_29.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 ankara_zk_7507_mem_used_30.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 ankara_zk_7507_traffic_in_31.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 davutpasa_1a_7206_5min_cpu_24.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 davutpasa_1a_7206_mem_free_25.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 davutpasa_1a_7206_mem_used_26.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 davutpasa_1a_7206_traffic_in_23.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 davutpasa_1a_7206_traffic_in_27.rrd
-rw-r--r-- 1 nobody nobody 141484 Jun 16 11:00 localhost_load_1min_5.rrd
-rw-r--r-- 1 nobody nobody 47836 Jun 16 11:00 localhost_mem_buffers_3.rrd
-rw-r--r-- 1 nobody nobody 47836 Jun 16 11:00 localhost_mem_swap_4.rrd
-rw-r--r-- 1 nobody nobody 47836 Jun 16 11:00 localhost_proc_7.rrd
-rw-r--r-- 1 nobody nobody 47836 Jun 16 11:00 localhost_users_6.rrd
-rw-r--r-- 1 nobody nobody 471900 Jun 16 11:00 m_2b_6009_1_procmem_13.rrd
-rw-r--r-- 1 nobody nobody 471900 Jun 16 11:00 m_2b_6009_1_switch_load_14.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_2d_7507_5min_cpu_15.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_2d_7507_mem_free_16.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_2d_7507_mem_used_17.rrd
-rw-r--r-- 1 nobody nobody 628420 Jun 16 11:00 maltepe_2d_7507_traffic_in_10.rrd
-rw-r--r-- 1 nobody nobody 628420 Jun 16 11:00 maltepe_2d_7507_traffic_in_11.rrd
-rw-r--r-- 1 nobody nobody 628420 Jun 16 11:00 maltepe_2d_7507_traffic_in_12.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_4a_7507_5min_cpu_18.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_4a_7507_mem_free_19.rrd
-rw-r--r-- 1 nobody nobody 698004 Jun 16 11:00 maltepe_4a_7507_mem_used_20.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 maltepe_4a_7507_traffic_in_21.rrd
-rw-r--r-- 1 nobody nobody 1394548 Jun 16 11:00 maltepe_4a_7507_traffic_in_22.rrd
-rw-r--r-- 1 nobody nobody 0 Apr 27 03:47 .placeholder
And my script is like:

Code: Select all

[root@cacti-test weathermap]# more cacti2weathermap.pl
#!/usr/bin/perl

# you might need to uncomment this line, or one like it
use lib qw([b]/usr/local/rrdtool/lib/perl[/b]);
use RRDs;

#Path to rrd files, or take a command-line option if it exists
$my_dir = $ARGV[0] || "[b]/www/htdocs/cacti/rra/[/b]";

#Path to store weathermap compatible files
$my_htmldir = "[b]data/[/b]";

die("RRA directory specified ($my_dir) doesn't exist.") if ! -d $my_dir;
die("Output directory ($my_html_dir) doesn't exist.") if ! -d $my_htmldir;

opendir RRDDIR, $my_dir or die "Impossible to open file: $!";
@rrd_files = grep /rrd/, readdir RRDDIR;

foreach my $router (@rrd_files){
        print $router,"\n";
        #Get the last cuin/cuout values
        my ($start,$step,$names,$data) = RRDs::fetch $my_dir.$router,"AVERAGE","--start","now";
        print "$start,$names  \n";
        foreach my $line (@$data) {
            if( defined(@$line[0]) ) {
                (my $name, my $ext)  = split /rrd/,$router;
                $weatherfile = $my_htmldir."wea_".$name."html";
                print $weatherfile,"\n";
                #Open special html weathermap file
                open OUT,"%gt;$weatherfile" or die "bad luck: $!";
                print OUT "%lt;html%gt;\n%lt;body%gt;\n$router\n";
                $nice = sprintf "%lt;!-- cuin d %d --%gt;\n%lt;!-- cuout d %d --%gt;\n", @$line[0], @$line[1];
                print OUT $nice;
                print OUT "%lt;/body%gt;\n%lt;/html%gt;";
                close OUT;
                }
        }
}
[root@cacti-test weathermap]# which perl
/usr/bin/perl
and
When I run the script :
[root@cacti-test weathermap]# perl cacti2weathermap.pl
localhost_mem_buffers_3.rrd
1118909100,ARRAY(0xa016c28)
data/wea_localhost_mem_buffers_3.html
bad luck: No such file or directory at cacti2weathermap.pl line 30
What is the problem?
If howie's script is correct, and my directories are correct in the script, what shoul I do to see wea*html files under data folder?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

TFC wrote:
Howie wrote:I've started writing up the changes I made to weathermap-1.1.1, and a page showing how it can be set up with Cacti. The page is half-finished, but it does have a download for the modified version, and has the documentation for my changes.

etc etc
If howie's script is correct, and my directories are correct in the script, what should I do to see wea*html files under data folder?
If you are using the 'hj3' version, you don't need to use cacti2weathermap.pl, you can just use the names of rrd files directly in the TARGET lines of the config file. If that really is the script you are using, then I think something has cut & pasted wrong, because it has > where it should have >. Just use the rrd filenames in the config, and skip cacti2weathermap.pl

Personally, I'd wait a day or so, and get the php 0.5 version, as things have changed to be a bit friendlier since that perl version, and you'd just have to change your config files again.
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!)
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests