jaskel_40663
Feb 05, 2009Nimbostratus
Odd issues with SNMP and TMM Usage
I'm using this script (which is floating around in the forums):
!/usr/bin/perl
Usage: f5-bigip-tmm-cpu.pl
use Net::SNMP qw(:snmp);
my $host = $ARGV[0];
my $snmp_comm = $ARGV[1];
chomp $host;
chomp $snmp_comm;
my $tmmTotalCyl = '.1.3.6.1.4.1.3375.2.1.1.2.1.41.0';
my $tmmIdleCyl = '.1.3.6.1.4.1.3375.2.1.1.2.1.42.0';
my $tmmSleepCyl = '.1.3.6.1.4.1.3375.2.1.1.2.1.43.0';
my ($session, $error) = Net::SNMP->session(
-hostname => $host,
-community => $snmp_comm,
-port => 161,
-version => 'snmpv2c',
-nonblocking => 0
);
if (!defined $session)
{
print "Received no SNMP response from $host\n";
print STDERR "Error: $error\n";
exit -1;
}
poll CPU oids
my $polled_oids = $session->get_request(
-varbindlist =>
[$tmmTotalCyl, $tmmIdleCyl, $tmmSleepCyl] );
calculate CPU Utilization
my $tmm_cpu = (( $polled_oids->{$tmmTotalCyl} -
($polled_oids->{$tmmIdleCyl} + $polled_oids->{$tmmSleepCyl}))
/ $polled_oids->{$tmmTotalCyl} ) * 100 ;
Round to integer
$tmm_cpu = int($tmm_cpu + .5);
print CPU Utilization to stdout for cli validation
print $tmm_cpu;
The odd thing is that is seems to be giving me incorrect values. I've done some traffic moves recently that greatly reduced the TMM CPU usage on one of my nodes, and the Big-IP GUI has correctly noted the change in traffic as has tmstat. Currently the TMM cpu utilization is at about 10%, yet this script through cacti is giving me 54%.
02/04/2009 10:55:04 PM - CMDPHP: Poller[0] Host[28] DS[651] CMD: perl /var/www/cacti/resource/script_queries/f5-bigip-tmm-cpu.pl f5-01a-mgmt sb-snmp, output: 54
Is there anything obvious in this script that would cause this? I've been playing around with it, but I haven't come to anything so far.
Thanks.
-jaskel