[mrtg] CPU on Cisco Switch and router
Daniel J McDonald
dan.mcdonald at austinenergy.com
Fri Mar 9 22:54:37 CET 2007
On Fri, 2007-03-09 at 15:20 -0500, Garth Williams wrote:
> 5 min CPU utilization
> Target[CISCO_CPU_USAGE]:
> 1.3.6.1.4.1.9.2.1.58.0&1.3.6.1.4.1.9.2.1.58.0:public at 127.0.0.1
Not always. There are a couple of OID's that might be used. I use this
template to find the correct number:
$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-V1SMI.my");
my %cpu;
my (@temp) = snmpwalk($router,$v3opt,'cpmCPUTotal5secRev');
foreach my $tempi(@temp) {
$tempi =~ /(\d+):\d/;
my $instance=$1;
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
;
}
>
>
> FWIW ...
> Available Memory
> Target[CISCO_MEM_FREE]:
> 1.3.6.1.4.1.9.9.48.1.1.1.6.1&1.3.6.1.4.1.9.9.48.1.1.1.6.1:public at 127.0.0.
> 1
>
Not always. The instance can move (I've seen zero, 1, 3, and 9), and
Catalyst 6500s running IOS modularity have values in these OID's, but
they are worthless. For non-modularity boxes I use this template:
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-QOS-PIB-MIB-V1SMI.my");
snmpMIB_to_OID("/usr/share/snmp/mibs/CISCO-MEMORY-POOL-MIB-V1SMI.my");
my (@temp) = snmpwalk($router,$v3opt,'ciscoMemoryPoolName');
foreach my $tempi(@temp) {
$tempi =~ /(\d+):(.+)/;
my $instance=$1;
next if $2 !~ /Processor/;
my ($used, $free) = snmpget($router,
$v3opt,'ciscoMemoryPoolUsed.'.$instance,
'ciscoMemoryPoolFree.'.$instance);
my $target_name=$router_name.".memory";
my $maxsize = $used+$free;
$target_lines .= <<DISK
#--------------------------------------------------------------------------------------
# Memory Utilization
Target[$target_name]:
ciscoMemoryPoolFree.$instance&ciscoMemoryPoolLargestFree.$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]: 5%:99%
bb*yellow[$target_name]: 7%: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
PageTop[$target_name]: <H1>Memory on $sysname/H1>
<TABLE>
<TR><TD>System:</TD><TD>$sysname </TD></TR>
<TR><TD>Location:</TD><TD>$syslocation </TD></TR>
</TABLE>
DISK
;
}
and for modularity images I use this template:
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
;
}
>
>
> Garth
>
>
>
> > I would like to monitor the CPU % on my Cisco switches and routers...
>
>
>
> _______________________________________________
> mrtg mailing list
> mrtg at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
More information about the mrtg
mailing list