Forum Discussion

Claret_Carvalho's avatar
Claret_Carvalho
Icon for Nimbostratus rankNimbostratus
Sep 08, 2009

CPU reporting of F5 devices

Hi,

 

 

Has anyone successfully managed to get SevOne tool (www.sevone.com) to do performance reporting of LTM/GTM devices, specifically on CPU and Memory utilization? Just a general question, does anyone what snmp oid's the RRDtool uses and how they derive the utilization figure to generate graphs locally on the device? I have read the snmp configuration guides but it is still not clear.

 

 

Thanks,

 

Claret

3 Replies

  • Hi Claret,

     

     

    Citizen_elah has done some very helpful work in this area with Perl / Cacti. Here is a post where he added an example of using SNMP to track CPU usage:

     

     

    cpu monitoring

     

    http://devcentral.f5.com/Default.aspx?tabid=53&forumid=32&tpage=1&view=topic&postid=1623716242

     

     

    Aaron
  • Pre-v.10, you have to do all manual calculations. New in v10 is a ratio oid for 5 second, 1 minute, & 5 minute cpu usage, per processor and globally. These are:

     

    (indexed, there is a value for each processor present)

     

    sysMultiHostCpuUsageRatio5s

     

    sysMultiHostCpuUsageRatio1m

     

    sysMultiHostCpuUsageRatio5m

     

    (singular value)

     

    sysGlobalHostCpuUsageRatio5s

     

    sysGlobalHostCpuUsageRatio1m

     

    sysGlobalHostCpuUsageRatio5m

     

    I'll have a tech tip up later this week complete with a cacti template for multi-processor systems, but here's the perl script for displaying CPU goodies to the console (you'll need the Net-SNMP perl module)

     

       
     !/usr/bin/perl -w   
      This code is not supported by F5 Network and is offered under the GNU General Public License.  Use at your own risk.   
     use strict;   
     use Net::SNMP qw(:snmp);   
     my ($host, $snmp_comm);   
     $host = $ARGV[0];   
     $snmp_comm = $ARGV[1];   
     chomp ($host , $snmp_comm);   
     my $cpuID        = ".1.3.6.1.4.1.3375.2.1.7.5.2.1.3.1.48";   
     my $cpuIndex     = ".1.3.6.1.4.1.3375.2.1.7.5.2.1.2.1.48";   
     my $cpuUsageRatio5s = ".1.3.6.1.4.1.3375.2.1.7.5.2.1.19.1.48.";   
     my $cpuUsageRatio1m = ".1.3.6.1.4.1.3375.2.1.7.5.2.1.27.1.48.";   
     my $cpuUsageRatio5m = ".1.3.6.1.4.1.3375.2.1.7.5.2.1.35.1.48.";   
     my $gcpuUsageRatio5s = ".1.3.6.1.4.1.3375.2.1.1.2.20.21.0";   
     my $gcpuUsageRatio1m = ".1.3.6.1.4.1.3375.2.1.1.2.20.29.0";   
     my $gcpuUsageRatio5m = ".1.3.6.1.4.1.3375.2.1.1.2.20.37.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;   
     }   
     my $allCPU = $session->get_table ( -baseoid => $cpuIndex );   
     my %cpu_table = %{$allCPU};   
     my $x = 0;   
     print "\n\nCPU Utilization:\t5s\t1m\t5m\n\n";   
     foreach my $key (sort keys %cpu_table) {   
     my @oid_index = split(/\./, $key);   
     my $ltm_cpu5s = $cpuUsageRatio5s . $oid_index[-1];   
     my $ltm_cpu1m = $cpuUsageRatio1m . $oid_index[-1];   
     my $ltm_cpu5m = $cpuUsageRatio5m . $oid_index[-1];   
     my $oid_ratios = $session->get_request(   
     -varbindlist =>   
     [$ltm_cpu5s, $ltm_cpu1m, $ltm_cpu5m] );   
     print "\tCPU$x\t\t$oid_ratios->{$ltm_cpu5s}\t$oid_ratios->{$ltm_cpu1m}\t$oid_ratios->{$ltm_cpu5m}\n";   
     $x++;   
     }   
     my $oid_gratios = $session->get_request(   
     -varbindlist =>   
     [$gcpuUsageRatio5s, $gcpuUsageRatio1m, $gcpuUsageRatio5m] );   
     print "\tGlobal\t\t$oid_gratios->{$gcpuUsageRatio5s}\t$oid_gratios->{$gcpuUsageRatio1m}\t$oid_gratios->{$gcpuUsageRatio5m}\n\n\n";   
     

     

    Output for my 3600:

     

      
     vadmin@vadmin:/tmp$ ./ltmcpu.pl 10.10.20.5 public   
     CPU Utilization:        5s      1m      5m   
             CPU0            3       3       3   
             CPU1            2       3       3   
             Global          2       3       3  
     

     

     

  • BTW, if these intervals (5s/1m/5s) don't work for you, you can still use the other oids and do the calculations manually, as you have to do for the TMM utilization as well. They are:

     

     

    For CPUn:

     

     

    sysMultiHostCpuUser

     

    sysMultiHostCpuNice

     

    sysMultiHostCpuSystem

     

    sysMultiHostCpuIdle

     

    sysMultiHostCpuIrq

     

    sysMultiHostCpuSoftirq

     

    sysMultiHostCpuIowait

     

     

    For Global:

     

     

    sysGlobalHostCpuUser

     

    sysGlobalHostCpuNice

     

    sysGlobalHostCpuSystem

     

    sysGlobalHostCpuIdle

     

    sysGlobalHostCpuIrq

     

    sysGlobalHostCpuSoftirq

     

    sysGlobalHostCpuIowait

     

     

    Calculation for both CPUn & Global is:

     

     

    ((dUser + dNice + dSystem)/(dUser + dNice + dIdle + dSystem + dIrq + dSoftirq + dIowait))*100

     

     

    For TMM:

     

     

    sysStatTmTotalCycles

     

    sysStatTmIdleCycles

     

    sysStatTmSleepCycles

     

     

    Calculation is:

     

     

    ((deltaTotal - (deltaIdle + deltaSleep)) / deltaTotal)*100

     

     

    HTH...Jason