Forum Discussion

CLDU's avatar
CLDU
Icon for Nimbostratus rankNimbostratus
Aug 17, 2007

cpu monitoring

Hello,

 

I try to monitor tmm cpu usage on a 9.2.4 bigip

 

a top command says cpu used at 100%

 

how can i get the real tmm cpu used?

 

 

thanks for your help

 

 

Clement

6 Replies

  • Here's a stdout version of a perl script I use to graph TMM utilization in cacti:

    
    !/usr/bin/perl
     Usage: tmm-cpu.pl  
    use Net::SNMP qw(:snmp);
    my $host = $ARGV[0];
    my $snmp_comm = $ARGV[1];
    chomp $host;
    chomp $snmp_comm;
    my $oid_tmm_tc = '.1.3.6.1.4.1.3375.2.1.1.2.1.41.0';
    my $oid_tmm_ic = '.1.3.6.1.4.1.3375.2.1.1.2.1.42.0';
    my $oid_tmm_sc = '.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 =>
                      [$oid_tmm_tc, $oid_tmm_ic, $oid_tmm_sc] );
     calculate CPU Utilization
    my $tmm_cpu = ( ( $polled_oids->{$oid_tmm_tc} - ( $polled_oids->{$oid_tmm_ic} + $polled_oids->{$oid_tmm_sc} ) ) / $polled_oids->{$oid_tmm_tc} ) * 100 ;
     Round to integer
    $tmm_cpu = int($tmm_cpu + .5);
     print CPU Utilization to stdout for cli validation
    print $tmm_cpu;
  • ..hmm, didn't like my lt / gt brackets on the usage line, edited the post for clarity
  • Actually, doesn't look like the edit link exists on this forum. Usage is:

     

     

    tmmcpu.pl myHost mySNMPstring
  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Thanks, citizen_elah.

    Looking into it now.

    But if you wouldn't mind posting to the codeshare instead, I just added a new section to the AdvDesign & Config codeshare collector page for Management Scripts like this one & the one hoolio posted yesterday. If you flag them with the following keyword line:
    :SAMPLE_CATEGORIES: ,MgmtScript,

    it will show up there.

    thanks!

    /deb

  • A much less robust option than Citizen's perl script for SNMP polling (but closer to top functionality) would be to run tmstat from the CLI. The CPU stats in the upper left are accurate for CPU1, the TMM CPU.

     

     

    I don't think this is an officially supported command, but it provides real-time CPU stats for TMM.

     

     

    Aaron
  • CLDU's avatar
    CLDU
    Icon for Nimbostratus rankNimbostratus
    Hello,

     

    Thanks for your perl script but I always get 0 on TmIdle cycle.

     

    snmpwalk -c xxxxxx -v 2c A.B.C.D .1.3.6.1.4.1.3375.2.1.1.2.1.43

     

    SNMPv2-SMI::enterprises.3375.2.1.1.2.1.43.0 = Counter64: 0

     

    However on tmstat my cpu utilizations is about 20%

     

     

    regards,

     

    Clement