Auto TARGET generation?

Support questions about the Network Weather Map plugin

Moderators: Developers, Moderators

User avatar
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Here's a quick patch to turn the auto-width patch into a range and get rid of the error message above. This isn't the best way to do this, but it works. :) (ignore the overwrite_targets line, I was going to look at adding some code to auto-overwrite the targets, but haven't really thought about that yet).

Code: Select all

--- /home/drich/cacti_integratephp_110.txt      2008-04-07 14:22:09.942962000 -0700
+++ random-bits/cacti-integrate.php     2008-04-07 14:58:32.000000000 -0700
@@ -1,25 +1,31 @@
 <?php

-$mapfile = "configs/int.conf";
-$outputmapfile = "output.conf";
+$mapfile = "configs/gld-desktop.conf.orig";
+$outputmapfile = "configs/gld-desktop.conf";

 # defaults. Should be overwritten by the cacti config.
-$cacti_base = '../../';
-$cacti_url = '/';
+$cacti_base = '/var/www/html/cacti/';
+$cacti_url = '/cacti/';

 include_once 'editor-config.php';

 # set this to 1 to adjust the width of links according to speed
 $map_widths = 1;

+# set this to 1 to overwrite existing targets
+$overwrite_targets = 1;
+
 # adjust width of link based on bandwidth.
 # NOTE: These ARE NOT bands - the value has to be EXACTLY the one in the table. $width_map = array(
        '1000000'=>'1', # 1meg
        '2000000'=>'1', # 2meg
        '10000000'=>'2', # 10meg
+       '99999999'=>'2', # 10meg-100M
        '100000000'=>'4', # 100meg
+       '999999999'=>'4', # 100meg-1G
        '1000000000'=>'6', # 1gig
+       '9999999999'=>'6', # 1gig-10G
        '10000000000'=>'8' # 10gig
                );

@@ -218,10 +224,14 @@

                        if($map_widths)
                        {
-                               if($width_map{$total_speed})
+                               foreach($width_map as $map_speed => $map_width)
+                               {
+                                       if($total_speed < $map_speed)
                                {
-                                       $map->links[$name]->width = $width_map{$total_speed};
-                                       print "    WIDTH ".$width_map{$total_speed}."\n";
+                                               $map->links[$name]->width = $map_width;
+                                               print "    WIDTH ".$map_width."\n";
+                                               continue 2;
+                                       }
                                }
                        }
Oh, and I realized what my comment problem is -- I have the comments set to pull the data directly from in_comment and out_comment, i.e. INCOMMENT {link:this:in_interface}. What's the chance of your code building the comments (with abbreviations :) ) if they don't already exist, and/or creating new values I can use like abbrev_in_interface?
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

wwwdrich wrote:Ok, you dont' expect the value in the MIBs to actually be correct, now do you?! :) I'll have to query our Foundry devices to see what they are really reporting. Our MG8s report the correct numbers, all of the other ones are the 32-bit values. I supposed if you're querying with SNMP v2 there is no reason they couldn't return the full 64-bit value.
But for both traffic counters and this thing the 64-bit or highspeed version is an entirely different OID. That's why I was puzzled.
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 »

wwwdrich wrote:Here's a quick patch to turn the auto-width patch into a range and get rid of the error message above. This isn't the best way to do this, but it works. :) (ignore the overwrite_targets line, I was going to look at adding some code to auto-overwrite the targets, but haven't really thought about that yet).
I was going to suggest something similar actually. In 0.96 there will be something different again - templates. You will be able to say 'copy settings from *that* link' instead of DEFAULT, so you can have a template link for 100M, 1G etc with completely different styles. Same for nodes, so you can have a 'router' template and a 'switch' template with different icons, different labelling etc.
Oh, and I realized what my comment problem is -- I have the comments set to pull the data directly from in_comment and out_comment, i.e. INCOMMENT {link:this:in_interface}. What's the chance of your code building the comments (with abbreviations :) ) if they don't already exist, and/or creating new values I can use like abbrev_in_interface?
How about if I store up all those ifAlias, ifName and ifDescr results and put them into SETs, like I do for the node? On Cisco, one of those is Gi0/34, one is GigabitEthernet0/34 and the other other is server22_primary (i.e. your description). It'd have to be a string of each of those, separated by spaces or something, where there are multiple links. Does at least one of them show the right thing on Foundry?

That would be the most flexible way, if so. Much like Cacti's graph title selection thing.

In fact if any of those *do* show the right thing, then you can use that name in the in_interface string in the first place too - the script looks in all 3 OIDs.

Think yourself lucky though, on a Nortel Baystack, the interface description is: "Nortel Networks BayStack 450_201 Ethernet Switch Module - Unit 2 Port 8" :-) and it lets you put in a friendly name which then appears absolutely nowhere.
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
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Howie wrote:
wwwdrich wrote: Oh, and I realized what my comment problem is -- I have the comments set to pull the data directly from in_comment and out_comment, i.e. INCOMMENT {link:this:in_interface}. What is the chance of your code building the comments (with abbreviations :) ) if they do not already exist, and/or creating new values I can use like abbrev_in_interface?
How about if I store up all those ifAlias, ifName and ifDescr results and put them into SETs, like I do for the node? ... Does at least one of them show the right thing on Foundry?
Of course not! :) I just checked, IfAlias is what we put in, ifDescr has the long name, and ifName has a "short" name. Personally, I have a hard time considering "ethernet" to be a short version of "GigabitEthernet", but apparently Foundry thinks it is.
Howie wrote: Think yourself lucky though, on a Nortel Baystack, the interface description is: "Nortel Networks BayStack 450_201 Ethernet Switch Module - Unit 2 Port 8" :-) and it lets you put in a friendly name which then appears absolutely nowhere.
Eewwww. I will add that to my list of "why not to buy Nortel". Admittedly, my list of "why not to buy Foundry" is as long as my arm and we keep purchasing equipment from them, so I am not sure how useful that is.... :)
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Howie,

I'm back in the Cacti world these days (been buried under other projects for the past few months), and was wondering if you have done any more with cacti-integrate.php? I am in the process of moving a bunch of my rrd files around due to a network re-arch, and am hoping that I don't have to find all of the target files by hand again.

Thanks!
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Not really... templates are done in 0.96test1, mentioned just up there.

I haven't used it in anger myself, but I think it should do the trick as long as you have a node name and and interface name of some sort for each link.

Doesn't it?
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
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Sorry Howie, I got pulled into another project and hadn't had a chance to get back to this.

I was hoping that you might have had a chance to make it take filename arguments, but if 0.96 is going to have templates than I probably won't need this script any more anyway!

One problem I ran into is with Foundry's new 10Gb interfaces. The script doesn't like interface names that start with "10", so it is throwing errors on those:

Code: Select all

11/03/2008 06:15:55 PM - WEATHERMAP: Poller[0] Unrecognised config on line 222: ernet6/1:::10GigabitEthernet6/2:::10GigabitEthernet7/1
11/03/2008 06:15:55 PM - WEATHERMAP: Poller[0] Unrecognised config on line 224: rnet6/1:::10GigabitEthernet6/2:::10GigabitEthernet7/1
NODE gld-core-1-header
If you don't have time to take a look at it let me know and I'll see if I can track down the offending code and fix it.
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Ignore that error, I was bitten by the RHEL5 gnome-terminal cut-n-paste bug. It split the line in two. Joining the line back together made the error go away.
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
zeki
Cacti User
Posts: 92
Joined: Fri Feb 09, 2007 10:55 pm
Location: So. Cal
Contact:

Post by zeki »

how do i get this to work? i put it in the weathermap folder and creates an empty output.conf

I was thinking for auto generation, it would be cool if in the editor we can select the device then it would create all links associated to the device.

so say i select a foundry switch device then hit auto generate button. Then it would create all links from existing graphs that are associated with that device. Kinda like the 2nd graph on this page
http://forums.cacti.net/about24433-0-asc-15.html

I have a 100port switch and it would be painfully time consuming to create it manually.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

zeki wrote:how do i get this to work? i put it in the weathermap folder and creates an empty output.conf
You draw the map. You edit the top of the script to look at your new config file. You add the SET commands with interface names and host_ids or host IPs, and the script fills in all the speeds, TARGETs, OVERLIB and INFOURL lines, and produces a new config with all that in it. Just like it says in this thread.
I was thinking for auto generation, it would be cool if in the editor we can select the device then it would create all links associated to the device.

so say i select a foundry switch device then hit auto generate button. Then it would create all links from existing graphs that are associated with that device. Kinda like the 2nd graph on this page
http://forums.cacti.net/about24433-0-asc-15.html

I have a 100port switch and it would be painfully time consuming to create it manually.
Where would those links go to? A link has two ends... I have another small script I call 'bristle' that produces switches with no destination, that looks like this attached image. It doesn't really scale very well, to big switches though...
Attachments
bristle.example.png
bristle.example.png (12.14 KiB) Viewed 5754 times
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
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

Howie,

Is bristle something you can post? That would be a really nice map to have for my smaller switches.

I can see it working for larger devices if there is a way to explode out the individual blades. It would require more configuration on the front end though, as the user would have to specify the SNMP indexes that made up each blade in the device.
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Sure, here it is. You'll need to edit the top bit, and you'll need to run the result through cacti-integrate.php to fill in the TARGETs and so on.

It generates a piece of map config, ready to drop into an existing map.
Attachments
bristler.php.txt
'Bristle' script.
(1.87 KiB) Downloaded 273 times
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!)
zeki
Cacti User
Posts: 92
Joined: Fri Feb 09, 2007 10:55 pm
Location: So. Cal
Contact:

Post by zeki »

Howie wrote:Where would those links go to? A link has two ends... I have another small script I call 'bristle' that produces switches with no destination, that looks like this attached image. It doesn't really scale very well, to big switches though...
The other end of the link should be just labelled the |query_ifAlias| data from the switch.
User avatar
wwwdrich
Cacti User
Posts: 91
Joined: Thu Feb 03, 2005 5:53 pm
Location: San Jose, CA
Contact:

Post by wwwdrich »

I have a little more tweaking to do on it when I come up for air, but I have patches to both bristle and the cacti-integrate scripts to allow them to take arguments from the command line. I got tired of editing the script every time I needed to update a device.

I hope to post them early next week if things don't get crazy around here.
- Dan
[i] "Step up to red alert!" "Are you sure, sir?[/i]
[i] It means changing the bulb in the sign..." - Red Dwarf[/i]
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Weathermap 0.97a adds getopt (command-line options) support, and also the ability to generate dsstats targets instead of rrd file targets.

I'm planning to add in another option to generate interface-error links underneath any links that it can find error data for, with a lower zorder and width of 120% bigger than the main link. With the right SCALE, this gets you a big red outline around links with errors, but nothing otherwise. It's just really tedious to set up by hand.
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 1 guest