Board index

Cheshire Cat Software

Steve Shipway's Discussion Groups
Locations of visitors to this page
It is currently Wed 08 Sep, 2010 11:59 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Cisco ACE Module Template
PostPosted: Thu 21 Aug, 2008 6:55 am 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
This template needs a bit of work. All of the contexts can be mapped using ContextID's and run with a single command, but I haven't written the discovery piece for that yet.

Code:
$head_lines .= <<ECHO
#.....................................................................
# Router processor utilization.
#
     
ECHO
;
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-SMI-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-TC-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-PROCESS-MIB.my");

my %cpu;

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotalMonIntervalValue');
foreach my $tempi(@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   my ($duration) = snmpget($router,$v3opt,"cpmCPUMonInterval.$instance");
   my $target_name=$router_name.".cpu".$instance;
   $cpu{$instance}++;
   $target_lines .= <<CPUMON
Target[$target_name]: cpmCPUTotalMonIntervalValue.$instance&cpmCPUTotal1minRev.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: $duration Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  $duration sec :
LegendO[$target_name]:  1 min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
  <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
  </TABLE>
CPUMON
;
}

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotal5secRev');
foreach my $tempi(@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   next if exists $cpu{$instance};
   my $target_name=$router_name.".cpu".$instance;
   $cpu{$instance}++;
   $target_lines .= <<CPU
Target[$target_name]: cpmCPUTotal5secRev.$instance&cpmCPUTotal1minRev.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: 5 Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  5sec :
LegendO[$target_name]:  1min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CPU
;
}

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotal5sec');
foreach my $tempi(@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   next if exists $cpu{$instance};
   my $target_name=$router_name.".cpu".$instance;
   $cpu{$instance}++;
   $target_lines .= <<CPUOLD
Target[$target_name]: cpmCPUTotal5sec.$instance&cpmCPUTotal1min.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: 5 Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  5sec :
LegendO[$target_name]:  1min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
CPUOLD
;
}

#snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-QOS-PIB-MIB-V1SMI.my");


#snmpMIB_to_OID("/usr/share/snmp/mibs/SNMPv2-SMI-V1SMI.my");
#snmpMIB_to_OID("/usr/share/snmp/mibs/SNMP-FRAMEWORK-MIB-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/ENTITY-MIB-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-ENHANCED-MEMPOOL-MIB-V1SMI.my");
my (@temp) = snmpwalk($router,$v3opt,'cempMemPoolName');
foreach my $tempi(@temp) {
   $tempi =~ /^([\d\.]+):(.+)/;
   my $instance=$1;
   next if $2 !~ /Processor/;
   my ($entity,$in2) = split('\.',$instance);
   my ($used, $free, $pool_descr) = snmpget($router,$v3opt,
      'cempMemPoolUsed.'.$instance,
      'cempMemPoolFree.'.$instance,
      'entPhysicalName.'.$entity
   );
   my $target_name=$router_name.".memory".$instance;
   my $maxsize = $used+$free;
   $target_lines .= <<DISK
#--------------------------------------------------------------------------------------
# Memory Utilization
   
Target[$target_name]: cempMemPoolFree.$instance&cempMemPoolLargestFree.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: Bytes Free
Options[$target_name]: gauge, unknaszero
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxsize
ShortLegend[$target_name]: bytes
routers.cgi*ShortDesc[$target_name]: Memory
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: memory
bb*red[$target_name]: 99%
bb*yellow[$target_name]: 98%
Legend1[$target_name]: Free Mem
Legend2[$target_name]: Largest Block
LegendI[$target_name]: Free
LegendO[$target_name]: Block
WithPeak[$target_name]: ymw
Title[$target_name]: $sysname $pool_descr
PageTop[$target_name]: <H1>Memory on $sysname $pool_descr </H1>
   <TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
   </TABLE>
DISK
;
}


edit: code tag added, SJS

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Tue 10 Feb, 2009 6:19 am 
Offline
User

Joined: Thu 02 Oct, 2008 3:28 am
Posts: 9
Hi,

Is there an update finished version of this template, I have a requierment to monitor some ACE blades and was just checking to see if this would be fit for the purpose.

Any help would be great.

Thanks

Tim


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Tue 10 Feb, 2009 7:44 am 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
NetBod wrote:
Is there an update finished version of this template, I have a requierment to monitor some ACE blades and was just checking to see if this would be fit for the purpose.


No, I haven't written the multi-context piece. As written, this will monitor a single context, meaning you need to create an snmp user and policy on every context to be monitored, not just the admin context.

Patches welcome!

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Tue 10 Feb, 2009 1:16 pm 
Offline
User

Joined: Thu 02 Oct, 2008 3:28 am
Posts: 9
HI Daniel,

Thanks for the update.

I currently have a problem where by I can not get cfgmarker to use this template or any other template, I have added the template name to the --if-template and --host-template lines in the cfgmaker file and then dropped the file ir.tp or .htp in to the same directory as the cfgmaker file, but no luck.

Must be doing something wrong somewhere, I have had alook around steve forum plus other trying diff things but getting no where fast, any help or pointers would be great.

Not a programmer but don't like it when things get the better of me.

Thanks
Tim


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Tue 10 Feb, 2009 4:21 pm 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
NetBod wrote:
I currently have a problem where by I can not get cfgmarker to use this template or any other template,


I posted a sample cfgmaker command on the mrtg users newsgroup recently:

usr/bin/cfgmaker --if-template=iosv3.iftemplate --ifref=name --interfaces --host-template=iosv3.template --subdir=site1/HOSTNAME --username='foo' --authkey='0x21de...' --authproto='sha' --privkey='0xa897...' --privproto=aesfcb128 --output=/var/mrtg/cfg/site1/site1-router.cfg 'foo'@site1-router.example.com::2:1:1:3

This one should be a host-template

You might need to edit the template to remove Directory statements if you are not using --subdir

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Fri 20 Feb, 2009 4:57 am 
Offline
User

Joined: Thu 02 Oct, 2008 3:28 am
Posts: 9
Hi Daniel,

Thats for the info, finally worked it out and got MRTG to use the templates ok. So i have tried to use you ACE template, I am further on with it, but I am seeing this error, have you any idea what it may relate to

Unknown SNMP var cpmCPUTotalMonIntervalValue
at (eval 8) line 14
Unknown SNMP var cpmCPUMonInterval.
at (eval 8) line 18
Unknown SNMP var cpmCPUTotal5secRev
at (eval 8) line 50

I have found the MIBs in the template on the web and pointed the template to them as per below

snmpMIB_to_OID("/MRTG/MIBS/CISCO-SMI-V1SMI.my");
snmpMIB_to_OID("/MRTG/MIBS/CISCO-TC-V1SMI.my");
snmpMIB_to_OID("/MRTG/MIBS/CISCO-PROCESS-MIB-V1SMI.my");

snmpMIB_to_OID("/MRTG/MIBS/ENTITY-MIB-V1SMI.my");
snmpMIB_to_OID("/MRTG/MIBS/CISCO-ENHANCED-MEMPOOL-MIB-V1SMI.my");

I am just not sure sure why the error is showing up, the .cfg file looks OK, but it does not generate the .ok file, I asume that is because of the above error.

Any ideas would be helpful.

Also does this template collect number of connection for real servers, I have had alook at it and don't think it does, do you have a template to do that by any chance to save reinventing the wheel.. :D

Thanks for the help

Tim


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Fri 20 Feb, 2009 6:25 am 
Offline
User

Joined: Thu 02 Oct, 2008 3:28 am
Posts: 9
Hi Daniel,

OK, fix that, I was using the wrong MIB by the looks of it.

snmpMIB_to_OID("/MRTG/MIBS/CISCO-PROCESS-MIB-V1SMI.my");

Tried this one and I do not get the error now.

snmpMIB_to_OID("/MRTG/MIBS/CISCO-PROCESS-MIB.mib");

Still got a problem thou, does not seem to be able to graph the CPU, seeing this error in the MRTG log, it is updating the .ok file now.

ERROR: Target[10.90.0.121.cpu1][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
ERROR: Target[10.90.0.121.cpu1][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data

Also I had this error in the MRTG log after fixing the other error

ERROR: Line 58 (<TABLE>) in CFG file (c:/mrtg/mrtg/bin/cfg-files/10.90.0.121.cfg) does not make sense

Had a look atr the cfg file and changed it to look like this, which solved the error I was seeing.

PageTop[10.90.0.121.cpu1]: <H1>WWK6509ACE-1 Processor Load</H1>
<div id="sysdetails">
<table>
<tr>
<td>System:</td>
<td>WWK6509ACE-1 </td>
</tr>
<tr>
<td>Location:</td>
<td> </td>
</tr>
</table>
</div>



Cheers

Tim


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Sun 22 Feb, 2009 3:58 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
The 'did not eval into defined data' error would indicate that the required OID is not supported by your device.

The '<TABLE>' error is because those lines following PageTop should all start with a space, which seems to have been removed in the code above (because it is not in a [code] tag)

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Mon 16 Mar, 2009 5:59 pm 
Offline
Silver User

Joined: Fri 03 Oct, 2003 11:47 am
Posts: 28
Location: Austin, TX
I've re-written my template to pull more useful things. If there are other OIDs that someone might find useful, please let me know.

This needs to be run once per context. So, for example, if you have three contexts, you might do something like this:

Code:
/usr/bin/cfgmaker --if-template=ace.iftemplate --ifref=name --interfaces --host-template=ace.template --subdir=site1/HOSTNAME --username='foo' --authkey='0x75' --authproto='sha' --privkey='0xed' --privproto=aescfb128 --contextname=context1 --output=/var/mrtg/cfg/site1/context1.site1-ace-left.cfg context1@site1-ace-left.example.com::3:1:1:3
/usr/bin/cfgmaker --if-template=ace.iftemplate --ifref=name --interfaces --host-template=ace.template --subdir=site1/HOSTNAME --username='foo' --authkey='0x75' --authproto='sha' --privkey='0xed' --privproto=aescfb128 --contextname=context2 --output=/var/mrtg/cfg/site1/context1.site1-ace-left.cfg context2@site1-ace-left.example.com::3:1:1:3
/usr/bin/cfgmaker --if-template=ace.iftemplate --ifref=name --interfaces --host-template=ace.template --subdir=site1/HOSTNAME --username='foo' --authkey='0x75' --authproto='sha' --privkey='0xed' --privproto=aescfb128 --contextname=context3 --output=/var/mrtg/cfg/site1/context1.site1-ace-left.cfg context3@site1-ace-left.example.com::3:1:1:3


I tried to cram the multi-context detection into the template, but it was just too hard. So I wrote it into my wrapper script that generates the cfgmaker lines for me. My wrapper is probably too hard to sanitize enough that it can be shared, but this host-template should be generic enough...

Code:
#
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-SMI-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-TC-V1SMI.my");
$head_lines .= <<ECHO
#.....................................................................
# Router processor utilization.
#
     
ECHO
;
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-PROCESS-MIB.my");

my %cpu;

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotalMonIntervalValue');
foreach my $tempi (@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   my ($duration) = snmpget($router,$v3opt,"cpmCPUMonInterval.$instance");
   my $target_name;   
   if (exists $$v3opt{contextname} ) {
      $target_name=$router_name.".cpu".$instance.'.'.$$v3opt{contextname};
   } else {
      $target_name=$router_name.".cpu".$instance;
   }
   $cpu{$instance}++;
   $target_lines .= <<CPUMON
Target[$target_name]: cpmCPUTotalMonIntervalValue.$instance&cpmCPUTotal1minRev.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: $duration Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  $duration sec :
LegendO[$target_name]:  1 min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
CPUMON
;
}

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotal5secRev');
foreach my $tempi(@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   next if exists $cpu{$instance};
   my $target_name;   
   if (exists $$v3opt{contextname} ) {
      $target_name=$router_name.".cpu".$instance.'.'.$$v3opt{contextname};
   } else {
      $target_name=$router_name.".cpu".$instance;
   }
   $cpu{$instance}++;
   $target_lines .= <<CPU
Target[$target_name]: cpmCPUTotal5secRev.$instance&cpmCPUTotal1minRev.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: 5 Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  5sec :
LegendO[$target_name]:  1min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
CPU
;
}

my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotal5sec');
foreach my $tempi(@temp) {
   $tempi =~ /(\d+):\d/;
   my $instance=$1;
   next if exists $cpu{$instance};
   my $target_name;   
   if (exists $$v3opt{contextname} ) {
      $target_name=$router_name.".cpu".$instance.'.'.$$v3opt{contextname};
   } else {
      $target_name=$router_name.".cpu".$instance;
   }
   $cpu{$instance}++;
   $target_lines .= <<CPUOLD
Target[$target_name]: cpmCPUTotal5sec.$instance&cpmCPUTotal1min.$instance:$router
SnmpOptions[$target_name]: $v3options
MaxBytes[$target_name]: 100
routers.cgi*ShortDesc[$target_name]:  CPU # $instance
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: cpu
bb*red[$target_name]: 90
bb*yellow[$target_name]: 80
Options[$target_name]:  gauge, unknaszero
Directory[$target_name]: $directory_name
WithPeak[$target_name]: wmy
YLegend[$target_name]: % Utilization
ShortLegend[$target_name]: %
Legend1[$target_name]: 5 Second Load
Legend2[$target_name]: 1 Minute Load
LegendI[$target_name]:  5sec :
LegendO[$target_name]:  1min :
Title[$target_name]: $sysname
PageTop[$target_name]: <H1>$sysname Processor Load</H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
CPUOLD
;
}

#snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-QOS-PIB-MIB-V1SMI.my");


#snmpMIB_to_OID("/usr/share/snmp/mibs/SNMPv2-SMI-V1SMI.my");
#snmpMIB_to_OID("/usr/share/snmp/mibs/SNMP-FRAMEWORK-MIB-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-ENHANCED-MEMPOOL-MIB-V1SMI.my");
my (@temp) = snmpwalk($router,$v3opt,'cempMemPoolName');
foreach my $tempi(@temp) {
   $tempi =~ /^([\d\.]+):(.+)/;
   my $instance=$1;
   next if $2 !~ /Processor/;
   my ($entity,$in2) = split('\.',$instance);
   my ($used, $free, $pool_descr) = snmpget($router,$v3opt,
      'cempMemPoolUsed.'.$instance,
      'cempMemPoolFree.'.$instance,
      'entPhysicalName.'.$entity
   );
   my $target_name;   
   if (exists $$v3opt{contextname} ) {
      $target_name=$router_name.".memory".$instance.'.'.$$v3opt{contextname};
   } else {
      $target_name=$router_name.".memory".$instance;
   }
   my $maxsize = $used+$free;
   $target_lines .= <<DISK
#--------------------------------------------------------------------------------------
# Memory Utilization
   
Target[$target_name]: cempMemPoolFree.$instance&cempMemPoolLargestFree.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: Bytes Free
Options[$target_name]: gauge, unknaszero
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxsize
ShortLegend[$target_name]: bytes
routers.cgi*ShortDesc[$target_name]: Memory
routers.cgi*Options[$target_name]: nototal
bb*host[$target_name]: $router_name
bb*svc[$target_name]: memory
bb*red[$target_name]: 99%
bb*yellow[$target_name]: 98%
Legend1[$target_name]: Free Mem
Legend2[$target_name]: Largest Block
LegendI[$target_name]: Free
LegendO[$target_name]: Block
WithPeak[$target_name]: ymw
Title[$target_name]: $sysname $pool_descr
PageTop[$target_name]: <H1>Memory on $sysname $pool_descr </H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
DISK
;
}
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-SLB-MIB.my");
my (@temp) = snmpwalk($router,$v3opt,'slbStatsCreatedHCConnections');
foreach my $tempi(@temp) {
   $tempi =~  /^([\d\.]+):(.+)/;
   my $instance=$1;
   my $target_name;   
   if (exists $$v3opt{contextname} ) {
      $target_name=$router_name.".conn".$instance.'.'.$$v3opt{contextname};
   } else {
      $target_name=$router_name.".conn".$instance;
   }

       $target_lines .= <<CONN
#--------------------------------------------------------------------------------------
# Total Connections

Target[$target_name]: slbStatsEstablishedHCConnections.$instance&slbStatsDestroyedHCConnections.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: connections
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 4294967295
ShortLegend[$target_name]: Connections
routers.cgi*ShortDesc[$target_name]: Connections
routers.cgi*Options[$target_name]: nototal,nomax,nopercent
routers.cgi*GraphStyle[$target_name]: range
Legend1[$target_name]: Established
Legend2[$target_name]: Destroyed
LegendI[$target_name]: Estab
LegendO[$target_name]: Dest
WithPeak[$target_name]: ymw
Title[$target_name]: $sysname Connections
PageTop[$target_name]: <H1>Total Connections on $sysname</H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
CONN
;
}
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-ENHANCED-SLB-MIB.my");
my (@temp) = snmpwalk($router,$v3opt,'cesServerFarmRserverOperStatus');
foreach my $tempi(@temp) {
   $tempi =~ /^([\d\.]+):(.+)/;
   my $instance=$1;
   my @instchar = split(/\./,$instance);
   shift @instchar;
   my ($farm,$rserver,$on);
   $on = 0;
   foreach my $char (@instchar) {
      if ($char < 32) {
         $on++;
         next;
      };
      if ($on == 1) {
         $farm .= chr($char);
      } else {
         $rserver .= chr($char);
      }
   }
   my $target_name = $router_name.".total.".$farm.".".$rserver.".".$$v3opt{contextname};
   $target_lines .= <<FARM1
#--------------------------------------------------------------------------------------
# $farm $rserver Connections

Target[$target_name]: cesServerFarmRserverTotalConns.$instance&cesServerFarmRserverTotalConns.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: connections
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 4294967295
ShortLegend[$target_name]: Connections
Options[$target_name]: noo
routers.cgi*ShortDesc[$target_name]: cnx $farm / $rserver
routers.cgi*Options[$target_name]: nomax,nopercent
Legend1[$target_name]: Established
LegendI[$target_name]: Estab
WithPeak[$target_name]: ymw
Title[$target_name]: Connections on $farm / $rserver
PageTop[$target_name]: <H1>Total Connections on $sysname for Farm $farm $rserver </H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>

FARM1
;

   my $target_name = $router_name.".current.".$farm.".".$rserver.".".$$v3opt{contextname};
   $target_lines .= <<FARM2
#--------------------------------------------------------------------------------------
# $farm $rserver Current Connections

Target[$target_name]: cesServerFarmRserverCurrentConns.$instance&cesServerFarmRserverCurrentConns.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: connections
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 4294967295
ShortLegend[$target_name]: Connections
Options[$target_name]: gauge, noo
routers.cgi*ShortDesc[$target_name]: cur $farm / $rserver
routers.cgi*Options[$target_name]: nomax,nopercent,nototal
Legend1[$target_name]: Current
LegendI[$target_name]: Estab
WithPeak[$target_name]: ymw
Title[$target_name]: Connections on $farm / $rserver
PageTop[$target_name]: <H1>Current Connections on $sysname for Farm $farm $rserver </H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>

FARM2
;

   my $target_name = $router_name.".status.".$farm.".".$rserver.".".$$v3opt{contextname};
   $target_lines .= <<FARM3
#--------------------------------------------------------------------------------------
# $farm $rserver Status

Target[$target_name]: cesServerFarmRserverOperStatus.$instance&cesServerFarmRserverAdminStatus.$instance:$router
SnmpOptions[$target_name]: $v3options
YLegend[$target_name]: connections
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: 24
ShortLegend[$target_name]: Status
Options[$target_name]: gauge
routers.cgi*ShortDesc[$target_name]: cnx $farm / $rserver
routers.cgi*Options[$target_name]: nomax,nopercent,nototal
bb*host[$target_name]: $router_name
bb*red[$target_name]: 1.5:2.5:2:3
Legend1[$target_name]: Operational
Legend2[$target_name]: Administrative
LegendI[$target_name]: Oper
LegendO[$target_name]: Admin
WithPeak[$target_name]: ymw
Title[$target_name]: Status of $farm / $rserver
PageTop[$target_name]: <H1>Status on $sysname for Farm $farm $rserver </H1>
<TABLE>
   <TR><TD>System:</TD><TD>$sysname  </TD></TR>
   <TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>

FARM3
;


};


Since the same vlan might be found in multiple contexts, I also wrote an interface template that made that adjustment. It also ignores the NoHC directive that would be put in without the iftemplate. The ACE has working HC counters, but doesn't have a working ifSpeed or ifHighSpeed OID.

Code:
#
if ($if_ok and $if_snmp_descr !~ /(unrouted|Stack)/ and $if_snmp_descr !~ /Null/i) {
$target_name .= "." . $$v3opt{contextname} if exists $$v3opt{contextname};
$target_lines .= <<TOPPART
Target[$target_name]: $if_ref:$router_connect
SnmpOptions[$target_name]: $v3options
routers.cgi*ShortDesc[$target_name]: $html_if_snmp_name - $html_if_snmp_alias
routers.cgi*Extension[$target_name]: "Show current interface status" /cgi-bin/ifstatus.cgi camera2-sm.gif
TOPPART
;
# Only add to big brother if it is a routed interface or a trunk line, not a "regular" vlan interface
if ($if_ip || $if_cisco_trunk) {
   $target_lines .= <<IPPART
bb*host[$target_name]: $router_name
IPPART
;
} else {
# if it is a "normal user port", then mark it with the service name "bw"
   $target_lines .=<<NUPART
bb*host[$target_name]: $router_name
bb*svc[$target_name]: bw
NUPART
;
}

$target_lines .= <<LASTPART
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $if_speed
Options[$target_name]: bits
WithPeak[$target_name]: wmy
Title[$target_name]: $html_if_snmp_name - $html_if_snmp_alias
PageTop[$target_name]: <H1>$html_if_snmp_alias - Traffic </H1>
LASTPART
;

if ($if_is_ethernet && ($if_ip || $if_cisco_trunk)
    && ($target_name =~ /(tlc|ecc|rlc|811|kramer|decker|sandhill|stelmo)-(net|voip|3560)/)
) {
       $target_name .= "_drop";
       my $maxpps = int($if_speed / 70);
       $target_lines .= <<DROPS
Target[$target_name]: locIfInputQueueDrops$if_ref&locIfOutputQueueDrops$if_ref:$router
SnmpOptions[$target_name]: $v3options
routers.cgi*ShortDesc[$target_name]: Drops $html_if_snmp_name - $html_if_snmp_alias
bb*host[$target_name]: $router_name
bb*svc[$target_name]: drops
bb*yellow[$target_name]: 1%
bb*red[$target_name]: 2%
Directory[$target_name]: $directory_name
MaxBytes[$target_name]: $maxpps
WithPeak[$target_name]: wmy
YLegend[$target_name]: Drops per second
ShortLegend[$target_name]: Packets
Title[$target_name]: Drops $html_if_snmp_name - $html_if_snmp_alias
PageTop[$target_name]: <H1>$html_if_snmp_alias - Drops </H1>
DROPS
;
}

}
else {
    $head_lines="";
    $problem_lines="";
    $target_lines="";
    $separator_lines="";
}

_________________
Daniel J McDonald, CCIE #2495, CISSP # 78281, CNX
Austin Energy


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Sun 28 Jun, 2009 10:51 am 
Offline
User

Joined: Thu 02 Oct, 2008 3:28 am
Posts: 9
Hi Daniel,

Wonder if you can help me out here, I have been trying to get your new template to work, some of it works ok arounf interface stats, the parts around CPU, Current connection, Total Connections, Op and admin state don't work.

I am getting the below errors in the mrtglog

2009-06-28 16:36:04 -- Unknown SNMP var cpmCPUTotalMonIntervalValue.1
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cpmCPUTotal1minRev.1
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverTotalConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverTotalConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverCurrentConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverCurrentConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverOperStatus.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverAdminStatus.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.49.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverTotalConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverTotalConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverCurrentConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverCurrentConns.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverOperStatus.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0
at c:/mrtg/mrtg/bin/mrtg line 2202
2009-06-28 16:36:04 -- Unknown SNMP var cesServerFarmRserverAdminStatus.4.10.77.65.66.66.67.85.65.84.83.70.10.87.71.82.78.66.67.87.48.48.50.0

Must be doing something wrong but can't figure out what, SNMP is not my strong point but learning alot about it curently.

Any help would be good.

On a side note if a run an SNMP walk fiind the above in the the walk and then graph them in that tool it works OK, I have check the number string on the end of the SNMP var above and that seems to be OK, so I am assuming the issue id around the SNMP var name bit at the begining.

Any help would be great

Thanks in advance


Tim


Top
 Profile  
 
 Post subject: Re: Cisco ACE Module Template
PostPosted: Sun 28 Jun, 2009 4:44 pm 
Offline
Site Admin
User avatar

Joined: Mon 28 Jul, 2003 5:42 pm
Posts: 3005
Location: Auckland, New Zealand
You may need to use LoadMIB: to load in the Cisco MIBs, but which one I'm not sure as I don't use this. Also read the abovbe posts about the SnmpMIB_to_OID function changes.

_________________
Steve Shipway
UNIX Systems, ITSS, University of Auckland, NZ
Woe unto them that rise up early in the morning... -- Isaiah 5:11


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group