More Q's about SNMP from Expert

Serge Aleynikov serge@REDACTED
Mon Jun 20 14:46:30 CEST 2005


Sanjaya Vitharana wrote:
> 1.) As your quick start guide, how to start "snmp trap daemon" in Windows ?
> Are there any equalent to
> 
> $ sudo snmptrapd -P -F "%02.2h:%02.2j TRAP%w.%q from %A\n  %v\n%" -m
> "snmp/agent/mibs/MY-TRAP-MIB.mib"

As far as I recall NET-SNMP is not ported to Windows, and as a result, 
snmptrapd won't work under Win OS.  However there are plenty of freeware 
tools available for Win that support traps - just google the net.

> 2.) also why the "netstat" showing
>     UDP    0.0.0.0:4000           *:*     ---- as my agent's port

Because the agent didn't explicitely bind to any specific IP, it is 
listening to requests on *all* ips defined on the machine.

> I have configured it to
> {intAgentUDPPort, 4000}.
> {intAgentIpAddress, [127,0,0,1]}.
 >
> I think it should be better, if shown as UDP    127.0.0.1:4000  is it ? Can
> you discribe why this happens ?

If you saw 127.0.0.1:4000 in netstat that would mean that this listener 
would be able to accept requests only coming from that same localhost 
(127.0.0.1), and it wouldn't be visible from other computers.

> 3.) further more my snmp client working as normal in my local mechine.
> But when I try to connect to the same port using another mechine my port it
> invisible ?
> Are you familier with this?
> What will be the reason? Firewall ??

What do you mean by the port being invisible?  Clients from other hosts 
can't issue SNMP requests to this agent and receive a response?

Serge

> Regards.
> 
> Sanjaya Vitharana
> 
> ----- Original Message -----
> From: "Serge Aleynikov" <serge@REDACTED>
> To: "Sanjaya Vitharana" <sanjaya@REDACTED>
> Sent: Friday, June 17, 2005 7:56 PM
> Subject: Re: What I need is ....
> 
> 
> 
>>I don't think it is possible in SNMP.  It is not a restriction of the
>>Erlang's implementation, but rather the SNMP RFC1157 standard.
>>
>>When using get or get_next you are only allowed to pass a valid OID.
>>However, you are not required to have a "known" OID, i.e. you can append
>>.N.M.K ... .Z indexes to any oid, as long as the agent can figure out
>>how to deal with such an OID.
>>
>>Sanjaya Vitharana wrote:
>>
>>
>>>Dear Serge,
>>>
>>>Many thanks for your reply.
>>>
>>>But what I need is not that ... I already picked the concept of MIB OID
>>>concept & how it maped with the general table over the net.
>>>
>>>What I need is to call a funtion like
>>>countLinks(get, BoardID)->
>>>
>>>Shall I change it to
>>>(1.) countLinks(get, AnyName)->
>>>
>>>to get a proper understanding
>>>------------------------------------------------
>>>I'm currently using a function like
>>>
>>>(2)countLinks(get) ->
>>>
>>> to call that I'm simply using
>>>(manager@REDACTED)73>
>>>snmpm:g("user",{127,0,0,1},4000,[[1,3,6,1,3,7,2,1,3,1]]). %% this is
> 
> working
> 
>>>which generate the get,[1],[3]
>>>------------------------------------------------
>>>Assume I want to pass a Variable to above (1): -- if it is possible
>>>So ... I'll create a Variable
>>>(manager@REDACTED)73> Name = "Sanjaya".   %% or any other
>>>
>>>Can I pass that variable to my above (1) method???
>>>
>>>Like
>>>(manager@REDACTED)73>
>>>snmpm:g("user",{127,0,0,1},4000,[{[1,3,6,1,3,7,2,1,3,1], Name}]). %%(
> 
> This
> 
>>>may be wrong --- but you will get what I need)
>>>
>>>to generate a get call something like ,[1],[3], ["Sanjaya"] -This may
> 
> wrong
> 
>>>too ...
>>>
>>>Is it possible ....?
>>>
>>>----------------------------------------------------
>>>Ex: from simple programming
>>>
>>>I can write a method
>>>3.)anyMethod(get)-> and call it like anyMethod(get).
>>>also
>>>I can change it to
>>>anyMethod(get,AnyVar)-> and call it like anyMethod(get,"Sanjaya").
>>>
>>>So....
>>>
>>>If I change my (2)countLinks(get) -> to (1.) countLinks(get, AnyName)->
>>>
>>>How should I call it from Manager???
>>>
>>>Is it possible or not in SNMP ???
>>>----------------------------------------------------
>>>
>>>Regards
>>>
>>>Sanjaya
>>>##############################END####################################
>>>----- Original Message -----
>>>From: "Serge Aleynikov" <serge@REDACTED>
>>>To: "Sanjaya Vitharana" <sanjaya@REDACTED>
>>>Sent: Friday, June 17, 2005 6:27 PM
>>>Subject: Re: get method with extra Variable .... ?
>>>
>>>
>>>
>>>
>>>>If the OID for your MIB's boardObject is [1,3,6,1,3,7,2,1,3,1] you call
>>>>it from the manager as:
>>>>
>>>>boardObject.Index
>>>>
>>>>Where Index is the board number, i.e. BoardID = 4:
>>>>
>>>>[1,3,6,1,3,7,2,1,3,1,4]
>>>>                     ^
>>>>Then the object's instrumentation function will need to figure out that
>>>>4 is the "extra parameter" that corresponds to the index.
>>>>
>>>>You can read about SNMP tables - they are designed specifically to
>>>>handle information of this sort.
>>>>
>>>>Sanjaya Vitharana wrote:
>>>>
>>>>
>>>>
>>>>>The proplem I have is not to write the function. But how it should be
>>>
>>>call
>>>
>>>
>>>>>from manager .... with extra variable ?
>>>>
>>>>>I'm simply using the OID as belows
>>>>>
>>>>>(manager@REDACTED)73>
>>>>>snmpm:g("user",{127,0,0,1},4000,[[1,3,6,1,3,7,2,1,3,1]]).
>>>>>
>>>>>But how I call the get with extra variable...??
>>>>>
>>>>>Assume:
>>>>>(manager@REDACTED)73> BoardID = 4.
>>>>>(manager@REDACTED)73> snmpm:g("user",{127,0,0,1},4000, .... --- How
> 
> write
> 
>>>the
>>>
>>>
>>>>>end with BoardID...?
>>>>>
>>>>>Sanjaya
>>>>>
>>>>>----- Original Message -----
>>>>>From: "Serge Aleynikov" <serge@REDACTED>
>>>>>To: "Sanjaya Vitharana" <sanjaya@REDACTED>
>>>>>Sent: Friday, June 17, 2005 6:01 PM
>>>>>Subject: Re: get method with extra Variable .... ?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>Yes if you define an SNMP table holding information about each Board,
>>>>>>and use RowIndex to reference each table entry (in your case BoardID
>>>>>>will be the RowIndex).
>>>>>>
>>>>>>Sanjaya Vitharana wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>is it possible to call a snmp get method with extra Variable .... ?
>>>>>>>
>>>>>>>something like
>>>>>>>
>>>>>>>countLinks(get, BoardID)->
>>>>>>>
>>>>>>>BoardID should be 1,2,3 ....etc. (to count the links in some board)
>>>>>>>
>>>>>>>Sanjaya
>>>>>>>



More information about the erlang-questions mailing list