I am getting the following error from the server log for two plug-ins that worked fine until my upgrade to 5.1 SP1. [ERROR] Undefined value returned by plug-in module X agent Y. Is the server out of memory? I have confirmed permissions for the folder and files for apache, checked for timeouts, and tested that the scripts run from terminal and return one value. Any other ideas? Both plugins are Perl scripts and the code for one of the scripts is below. It is a simple script that combines in and out octets for total network usage. And again, it works from the terminal command line.
#!/usr/bin/perl -w
use strict;
use warnings;
sub get_param($) {
my $param = shift;
my $value = undef;
$param = "-".$param;
for(my $i=0; $i<$#ARGV; $i++) {
if ($ARGV[$i] eq $param) {
$value = $ARGV[$i+1];
last;
}
}
return $value;
}
sub usage () {
print "iface_bandwith.pl version v1r1n";
print "nusage: $0 -ip -com -if n";
print "nIMPORTANT: This plugin uses SNMP v1nn";
}
#Global variables
my $ip = get_param("ip");
my $community = get_param("com");
my $ifname = get_param("if");
if (!defined($ip) ||
!defined($community) ||
!defined($ifname) ) {
usage();
exit;
}
#Browse interface name
my $res = `snmpwalk -L n -c $community -v1 $ip .1.3.6.1.2.1.2.2.1.2 -On`;
my $suffix = undef;
my @iface_list = split(/n/, $res);
foreach my $line (@iface_list) {
#Parse snmpwalk line
if ($line =~ m/^([d|.]+) = STRING: (.*)$/) {
my $aux = $1;
#Chec if this is the interface requested
#if ($2 eq $ifname) {
# Changed to ifname substring of inteface desc for changing ifsuffix on CP.
if (index($2, $ifname) != -1) {
my @suffix_array = split(/./, $aux);
#Get last number of OID
$suffix = $suffix_array[$#suffix_array];
}
}
}
#Check if iface name was found
if (defined($suffix)) {
#Get octets stats
my $inoctets = `snmpget -L n $ip -c $community -v1 .1.3.6.1.2.1.2.2.1.10.$suffix -OUevqt`;
my $outoctets = `snmpget -L n $ip -c $community -v1 .1.3.6.1.2.1.2.2.1.16.$suffix -OUevqt`;
print $inoctets+$outoctets;
}



