I'm working with NetSNMP and hoping to use it to return some useful info on my machines. I have entered the example module from
http://docs.fedoraproject.org/en-US/Fedora/16/html/System_Administrators_Guide/sect-System_Monitoring_Tools-Net-SNMP-Extending.html and this works just fine.
If I add a
use dbsize.pm; line to this file to import my additional module it stops working. Below I have included the module and some test code to show that the module works ok.
Here is my extension module:
package dbsize;
sub new
{
my $package = shift;
my $self = bless ({}, $package);
return $self;
}
sub getseq
{
return 25;
}
1;
If I use dbsize.pm in the sample code it stops working. I don't even have to call the getseq() function. No error messages.
If I use dbsize.pm in a piece of test code it works fine.
Example:
#!/usr/bin/perl -w
use dbsize;
$dbs = new dbsize();
print $dbs->getseq();
print "\n";
root@plugpc-002:/usr/local/bin# ./dbtest.pl
25
Question: Is there something in SNMP or NetSNMP that prevents importing a module? I can't imagine why there would be.. so the problem must be in my implementation.
EDIT:
It was a path issue. My module was in /usr/local/bin (as was the main file). When I added this to the path it worked out ok. Never did see any error messages though.