Thanks to Thomas.Anders for reply to my first posting. I'm having
problems with my subscription to the list so I could see your reply in
the archive, but I couldn't see any way to send mail back other than
start a new thread. Apologies for that. I've adjusted a subscription
option, with luck that'll fix it...

 

 

Ref your questions Thomas, hopefully this provides the information....

 

Building software - I just ran configure, it appears everything I need
is in by default. The only difference was the PREFIX meant it installed
in a different place from the OS supplied binaries etc. The Net-SMP
version is 5.6.1.1

 

I didn't remove OS-supplied package first, but I was running the correct
one installed in the new PREFIX (although I got caught out by location
of conf file, so my previous comment about it not looking for any conf
file was incorrect, it was however looking for perl.conf not
<subagentname>.conf where the agent name is passed into the agent
object)

 

I have now removed the OS supplied package and re-run make install (did
not re-configure and re-build completely) I am going to try this now and
what the compilation more closely...

 

Make completed without error at all times. When building, installing
over existing packages and installing with existing packages.

 

This is how I ran snmpd

 

/usr/local/sbin/snmpd -f -Lf /tmp/snmpd.log
-Dregister_mib,handler::register,agentx/subagent -c /etc/snmp/snmpd.conf

 

I don't know if there may be any issue around the conf file being in
standard location and my build defaulting to /usr/local/etc/snmp. I'm
guessing not as I use the -c option

 

As for configuring and starting the subagent, not quite sure what you
mean here, I have now created a /usr/local/etc/snmp/perl.conf (well a
link to the usual location) and this is being opened (I can see in
strace) It contains:-

 

 

agentx-master   /var/agentx/master

#agentx-master  localhost:705

 

This is how I run my subagent

 

strace -f -o /tmp/strace.out ./multipath-subagent.pl

 

 

 

 

As for the subagent code, I have pretty much taken the example code and
just cut it right back to perform a registration to see if I could get
that going (I can't) plus also made changes I though might help. Here is
the code:-

 

 

 

 

#!/usr/bin/perl -w

 

use     strict;

use     NetSNMP::agent (':all');

use     NetSNMP::OID (':all');

use     NetSNMP::ASN (':all');

use     Data::Dumper;

 

#-----------------------------------------------------------------------
-----------------------------

my      ($gAgentObj);

my      ($gRunning);

my      $gMbloxBaseOID = '.1.3.6.1.4.1.19774';

my      $gBaseOID = $gMbloxBaseOID . '.255';

#-----------------------------------------------------------------------
-----------------------------

my      ($err);

my      ($regOID);

 

$regOID = new NetSNMP::OID($gBaseOID);

 

$SIG{'INT'} = 'SigINTHandler';

 

$gAgentObj = new NetSNMP::agent(

        Name    =>      'multipath',

        AgentX  =>      1,

        );

 

print "About to register \n";

if (($err =
$gAgentObj->register('multipath',$regOID,\&MultipathHandler)) != 0)

{

        print "Failed to register our OID $gBaseOID Error: $err Exiting
\n";

        print $gAgentObj,"\n";

        print Data::Dumper->Dump([$gAgentObj]);

        #sleep 3;

        #$gAgentObj->shutdown();

        #exit 1;

}

 

$gRunning = 1;

 

while($gRunning)

{

        $gAgentObj->agent_check_and_process(1);

}

 

print   "SIGINT received - Shutting down...\n";

 

$gAgentObj->shutdown();

 

exit 0;

#-----------------------------------------------------------------------
-----------------------------

sub     SigINTHandler

{

        $gRunning = 0;

}

#-----------------------------------------------------------------------
-----------------------------

sub     MultipathHandler

{

        my      ($handler, $reg_info, $request_info, $requests) = @_;

 

        print "Handler called \n";

}

#-----------------------------------------------------------------------
-----------------------------

 

 

 

A bit of the strace dump file...

 

1008  gettimeofday({1342596642, 428277}, NULL) = 0

1008  pipe([3, 4])                      = 0

1008  pipe([5, 6])                      = 0

1008  write(1, "About to register \n", 19) = 19

1008  write(1, "Failed to register our OID .1.3."..., 130) = 130

1008  write(1, "NetSNMP::agent=HASH(0x18683450)\n", 32) = 32

1008  write(1, "$VAR1 = bless( {\n               "..., 126) = 126

1008  gettimeofday({1342596642, 429604}, NULL) = 0

1008  select(6, [3 5], NULL, NULL, NULL

 

 

You can see between my two debug messages 'About to register' and
'Failed to register' there is no attempt to communicate with the master.
On the half working system I do see some socket send/recv activity at
this point. The select is it blocking on the
'$gAgentObj->agent_check_and_process(1);' call. 

 

 

 

 

Finally here is the mini-MIB I created, again not really supposed to be
functional just enough to prove the registration. Again this was lifted
from a tutorial, with a few changes

 

 

 

 

MBLOX-MULTIPATH-MIB DEFINITIONS ::= BEGIN

 

 

-- A Comment!

 

-- IMPORTS: Include definitions from other mibs here, which is always

-- the first item in a MIB file.

IMPORTS

        OBJECT-TYPE, Integer32, enterprises,

        MODULE-IDENTITY                       FROM SNMPv2-SMI

        MODULE-COMPLIANCE, OBJECT-GROUP       FROM SNMPv2-CONF;

 

 

mblox          OBJECT IDENTIFIER ::= { enterprises 19774 }

 

 

--

-- A brief description and update information about this mib.

--

mbloxMultipathMIB MODULE-IDENTITY

    LAST-UPDATED "201207120000Z"            --  midnight

    ORGANIZATION "mBlox"

    CONTACT-INFO "postal:   Bill Melotti

 

                  email:    [email protected]

                 "

    DESCRIPTION  "A simple mib for demonstration purposes.

                  Not anywhere near complete yet

                 "

    ::= { mblox 255 }

 

-- Define typical mib nodes, like where the objects are going to lie.

-- we'll prefix everything in this mib with nst (net snmp tutorial)

mmMIBObjects     OBJECT IDENTIFIER ::= { mbloxMultipathMIB 1 }

 

 

-- define 3 objects, which will all be implemented in different ways

-- within the tutorial.

 

mmAgentModules   OBJECT IDENTIFIER ::= { mmMIBObjects 1 }

 

 

mmAgentModuleObject OBJECT-TYPE

    SYNTAX      Integer32

    MAX-ACCESS  read-write

    STATUS      current

    DESCRIPTION

        "This is an object that simply supports a writable integer

         when compiled into the agent.  See

         http://www.net-snmp.org/tutorial-5/toolkit/XXX for further

         implementation details."

    DEFVAL { 1 }

    ::= { mmAgentModules 1 }

 

<snip - Lots of commented lines removed>

 

END

 

 

 

 

 

I could start with the example code, but unless I'm being really stupid
I can't see any significant difference.

 

 

 

Any ideas?

 

 

Regards 

 

 

 

 

 

 

 

 

 

 


NOTICE - This message and any attached files may contain information that is 
confidential and/or subject of legal privilege intended only for use by the 
intended recipient. If you are not the intended recipient or the person 
responsible for delivering the message to the intended recipient, be advised 
that you have received this message in error and that any dissemination, 
copying or use of this message or attachment is strictly forbidden, as is the 
disclosure of the information therein.  If you have received this message in 
error please notify the sender immediately and delete the message.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to