network map

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

Moderators: Developers, Moderators

Post Reply
Pelin
Posts: 3
Joined: Wed Apr 13, 2005 12:40 am
Location: Sweden

Post by Pelin »

Hey guys. Great job on this module.

I wrote a small script which uses CDP to discover other equipment in the network. It's not bug-proof and it might not work for you, but it works for me. It creates a good startingpoint for a weathermap.conf file.

Run the script as

Code: Select all

./cdp_traversal.pl 192.168.0.254 > weathermap.conf
Where 192.168.0.254 is the startingpoint.

Warning: It can only fill in the TARGETs correctly if you have used IP-numbers when you created the device in cacti.

It only works with equipment that has CDP (Cisco Detection Protocol??) enabled. I have only tested it with Cisco equipment.

The generated weathermap.conf file will need to be edited.

I also had to edit the weathermap script a bit, here is the diff

Code: Select all

--- weathermap~ 2005-04-12 16:11:29.000000000 +0200
+++ weathermap  2005-04-12 16:18:23.000000000 +0200
@@ -396,7 +396,7 @@
                        print "found HEIGHT: $HEIGHT\n" if($DEBUG);
                }
        }
-       if(/^\s*NODE\s+(\w+)/i){
+       if(/^\s*NODE\s+(\S+)$/i){
                $node=$1;
                $last_item = "node";
                print "found NODE: $node\n" if($DEBUG);
@@ -406,7 +406,7 @@
                $ypos{$node}=$2;
                print "found NODE: $node XPOS: $xpos{$node} YPOS: $xpos{$node}\n" if($DEBUG);
        }
-       if(/^\s*LABEL\s+(\S+)/i){
+       if(/^\s*LABEL\s+(.+)$/i){
                $label{$node}=$1;
                print "found NODE: $node LABEL: $label{$node}\n" if($DEBUG);
        }
Otherwise it does not work with IP's as NODEs or with spaces in LABELs.
Attachments
cdp_traversal.pl.txt
(5.78 KiB) Downloaded 325 times
jeroenh
Posts: 2
Joined: Thu Apr 14, 2005 3:22 am

Post by jeroenh »

solefald wrote:here is my map
just felt like braging abouit it :)
Looking good, can you post your weathermap.conf file?

thanks,


Jeroen
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

@Howie

How does the php version of weathermap come along? can I help in coding or testing. I'm very interrested in your version.
Currently using your perl version with some minor mods. Great tool.

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

Post by Howie »

mgb wrote:@Howie

How does the php version of weathermap come along? can I help in coding or testing. I'm very interrested in your version.
Currently using your perl version with some minor mods. Great tool.
I have a version now that Works For Me ;-)

If I get time today I'll put it up somewhere for people to try. The only dependency that is beyond Cacti's own (rrdtool, php) is the gd PHP extension, which many people have anyway, I think.
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

@Howie,

Just checked,

GD library has been loaded. Maybe it's a good idea to alternative use the imagemagick library since I know from own experience not all providers have GD compiled together with php.

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

Post by Howie »

mgb wrote: GD library has been loaded. Maybe it's a good idea to alternative use the imagemagick library since I know from own experience not all providers have GD compiled together with php.
It's for drawing, not for converting images so I don't think Imagemagick would help. I've only ever used convert and mogrify though, so I can't be sure :-)

Also, if you are using a hosted website, I don't understand what you'd be using cacti for... surely only someone with a decent-sized network (and their own servers) would bother with it?
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

@Howie

Agreed, Although I'm running cacti also on my home network graphing 2 routers, 4 computers and some other things just for the fun of it.

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

Post by Howie »

Howie wrote: I have a version now that Works For Me ;-)

If I get time today I'll put it up somewhere for people to try. The only dependency that is beyond Cacti's own (rrdtool, php) is the gd PHP extension, which many people have anyway, I think.
I've had time, and here's a test version. Please let me know of anything odd you find. http://wotsit.thingy.com/haj/cacti/

Please don't download this if you just want to click-and-go - it's not fully tested. Please do if you don't mind helping work out why it doesn't work ;-)
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Hi Howie,

Tested your scrips and it seems to work fine. Had to add $gotline = ""; to the function ReadFromRRD and after that it worked. Just a few remarks.

Is it possible to add ICON to the configfile to display a small ICON on the weathermap. I use this function a lot. Than it would be possible to create a weathermap without a background picture. Maybe place the icons around like it's done on this site http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Further if labels are empty no box should be dawn. That one should be easy.

Also I'm curieus about you're editor. Is it posible to test a beta?

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

Post by Howie »

mgb wrote:Hi Howie,

Tested your scrips and it seems to work fine. Had to add $gotline = ""; to the function ReadFromRRD and after that it worked. Just a few remarks.
Fixed.
mgb wrote: Is it possible to add ICON to the configfile to display a small ICON on the weathermap. I use this function a lot. Than it would be possible to create a weathermap without a background picture. Maybe place the icons around like it's done on this site http://www.walterzorn.com/dragdrop/dragdrop_e.htm
The icon is just an image pasted into the map? Not attached to a node? OK. I'll look at that. The dragdrop thing is nice but I don't think it would work for the editor - the arrows can't be done as bitmaps, because they need to be at any angle or size, so you could only ever use it for nodes. It'd be better to use the same method for all of the editor, IMHO.
mgb wrote: Further if labels are empty no box should be dawn. That one should be easy.
Fair enough :-)
mgb wrote: Also I'm curieus about you're editor. Is it posible to test a beta?
I'll put a copy up later - it's not a beta at all. It's very rough.
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Howie wrote:
The icon is just an image pasted into the map? Not attached to a node? OK. I'll look at that. The dragdrop thing is nice but I don't think it would work for the editor - the arrows can't be done as bitmaps, because they need to be at any angle or size, so you could only ever use it for nodes. It'd be better to use the same method for all of the editor, IMHO.
I use the icons just as an image pasted into the map. I Believe they the coordinates give the center of the icon. Below just an example from one of my weathermaps.

NODE Internet
POSITION 573 287
ICON Wolk.png
LABEL Internet

ICONS are not required but I use them sometimes when I have to add a node to my map and I don't want to recreate the map again.
Hope this helps.

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

Post by Howie »

One more version for today. 0.3 is up at
http://wotsit.thingy.com/haj/cacti/

ICONs are in there. The editor rough demo is there. A few bugs are fixed.

I also uploaded the auto-overlib.pl script that it seems I posted about but never put on my site. This takes a weathermap.conf with Cacti RRD targets in it, and goes through it adding all the OVERLIBGRAPH and INFOURL directives it can. It's perl, and needs DBI, DBD::mysql and access to your Cacti database (edit the top of the script).
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

regarding version 0.3

Post by mgb »

Hello Howie,

Tested your php version today. Didn't had the time earlier on. Version 0.3 creates nearly the same output as my perl script. It looks like I'm missing just one pixel from the right side and the bottom side of the picture.

Currently you are using the same config file for the perl version of weathermap. Although this moght come in handy when using old config files. I think for a cacti version it would be better to use an XML file since most external cacti files are xml files. Also for the future you can use the standard cacti import and export functionality for the weathermap files too.

Didn't find the time yet to test the editor. The PHP version is working great though.

Michael
mgb
Cacti User
Posts: 124
Joined: Mon Jun 21, 2004 4:06 am
Location: North of the Netherlands

Post by mgb »

Hi Howie,

Just tested the editor. Seems there is missing a file called wm.php used for creating / displaying the weathermap. Could you supply this file also?

Thanx,
Michael
predou
Posts: 45
Joined: Fri Jan 07, 2005 8:42 am

Post by predou »

Hi howie !
Great php script you do :D :D
It works fine :D

But , editor don't work, i don't knwo why ?
I'll search why !

Thx for your work :)

Pierre
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests