CPU Graph Problem

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Boulad
Posts: 27
Joined: Fri Jun 13, 2008 7:55 am

Post by Boulad »

Ok, I know I'm bringing this back from the dead.. but I believe I'm very close to a solution.

Here is my scripts:

Code: Select all

#!/usr/bin/perl
#
# Usage: f5-bigip-tmm-cpu.pl <hostname> <snmp community>
#
#
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;
I know the problem is from the script. When I go to run from the cmd line in Linux (perl f5-bigip-tmm-cpu.pl) I get the following error message:

Code: Select all

Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/lib/perl5/5.8.5/i386-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl .) at f5-bigip-tmm-cpu.pl line 6.
BEGIN failed--compilation aborted at f5-bigip-tmm-cpu.pl line 6.
Line 6 is the

Code: Select all

use Net::SNMP qw(:snmp);
.

I verified my NET-SNMP is installed. What suggestions are there to fix this problem?
Boulad
Posts: 27
Joined: Fri Jun 13, 2008 7:55 am

Post by Boulad »

CASE CLOSED! :)

Found out what to do from here: http://nagios.manubulon.com/faq.html#FAQ1

Yay, CPU graph finally works!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest