Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Auto TARGET generation?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
wwwdrich
Cacti User


Joined: 03 Feb 2005
Posts: 59
Location: San Jose, CA

PostPosted: Mon Apr 07, 2008 5:01 pm    Post subject: Reply with quote

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:

--- /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?
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2167
Location: United Kingdom

PostPosted: Mon Apr 07, 2008 5:09 pm    Post subject: Reply with quote

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.
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2167
Location: United Kingdom

PostPosted: Mon Apr 07, 2008 5:23 pm    Post subject: Reply with quote

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.

Quote:

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.
Back to top
wwwdrich
Cacti User


Joined: 03 Feb 2005
Posts: 59
Location: San Jose, CA

PostPosted: Thu Apr 10, 2008 2:18 pm    Post subject: Reply with quote

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....
Back to top
wwwdrich
Cacti User


Joined: 03 Feb 2005
Posts: 59
Location: San Jose, CA

PostPosted: Thu Oct 09, 2008 3:36 pm    Post subject: Reply with quote

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!
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 2167
Location: United Kingdom

PostPosted: Thu Oct 09, 2008 3:48 pm    Post subject: Reply with quote

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?
Back to top
wwwdrich
Cacti User


Joined: 03 Feb 2005
Posts: 59
Location: San Jose, CA

PostPosted: Tue Nov 04, 2008 11:08 am    Post subject: Reply with quote

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:

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.
Back to top
wwwdrich
Cacti User


Joined: 03 Feb 2005
Posts: 59
Location: San Jose, CA

PostPosted: Tue Nov 04, 2008 11:25 am    Post subject: Reply with quote

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.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map) All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group