Forum Discussion
banjoooooooooo_
Nimbostratus
Oct 08, 2008Cpu and TMM monitor script
Hmm... I've been trying today to get the same results as the graphs in the TMUI for CPU and TMM usage I'm not sure why I'm getting different results and I noticed the results with my scripts below is ...
Kevin_51676
Nimbostratus
Nov 06, 2008Here is what I use for the TMM CPU:
$ more f5-bigip-tmm-cpu.pl
!/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_0 = $session->get_request(
-varbindlist =>
[$tmmTotalCyl, $tmmIdleCyl, $tmmSleepCyl] );
sleep 10;
my $polled_oids_1 = $session->get_request(
-varbindlist =>
[$tmmTotalCyl, $tmmIdleCyl, $tmmSleepCyl] );
calculate CPU Utilization
my $tmm_cpu = (( ($polled_oids_1->{$tmmTotalCyl} - $polled_oids_0->{$tmmTotalCyl
}) -
( ($polled_oids_1->{$tmmIdleCyl} - $polled_oids_0->{$tmmIdleCyl}
) +
($polled_oids_1->{$tmmSleepCyl} - $polled_oids_0->{$tmmSleepCyl}
) ))
/ ($polled_oids_1->{$tmmTotalCyl} - $polled_oids_0->{$tmmTotalCy
l}) ) * 100 ;
Round to integer
$tmm_cpu = int($tmm_cpu + .5);
print CPU Utilization to stdout for cli validation
print $tmm_cpu;
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects