I've got 4 "exec" lines setup. 2 are compiled C programs, 2 are perl scripts. 7,8, and 10 (as listed below) work just fine. 9 runs fine from the command line but returns nothing when run by snmpd. example:


# snmpwalk localhost .1.3.6.1.4.1.4502.1.9
SNMPv2-SMI::enterprises.4502.1.9.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.4502.1.9.2.1 = STRING: "cpu"
SNMPv2-SMI::enterprises.4502.1.9.3.1 = STRING: "/tmp/check_local_cpu.pl"
Timeout: No Response from localhost

If I attach 'strace' to the snmpd process, I clearly see the daemon fork and execve() my script at least 3 times before my snmpwalk dies with a timeout. So it's not a matter of needing extra time to execute.

Can anyone give me any clues as to why snmpd refuses to accept my script's output and deliver it back to the user? This has been driving me insane all day.

-Frank

NET-SNMP version:  5.1.2

snmpd.conf:
exec .1.3.6.1.4.1.4502.1.7 load /tmp/check_load -w 15,15,15 -c 20,20,20
exec .1.3.6.1.4.1.4502.1.8 procs /tmp/check_procs
exec .1.3.6.1.4.1.4502.1.9 cpu /tmp/check_local_cpu.pl
exec .1.3.6.1.4.1.4502.1.10 test /tmp/test.pl


The source of check_local_cpu.pl is:

#!/usr/bin/perl -w

use strict;

my $vmstat = '/usr/bin/vmstat';

my @lines = split(/\n/,`$vmstat -n 2 2`);
my $line = $lines[$#lines];
$line =~ s/^\s+//;

my @bits = split(/\s+/,$line);

print STDOUT "u:${bits[12]},s:${bits[13]},i:${bits[14]}\n";
exit(0);


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to