Re: Debugging SNMP

2012-10-29 Thread Sverre Moe
I have checked the contents of each elements inputted into 
int returnValue = netsnmp_register_read_only_scalar( 
netsnmp_create_handler_registration(buffy, 
handle_snmp, 
scalar_oid, 
OID_LENGTH(scalar_oid), 
HANDLER_CAN_RONLY 
)); 



For each iteration of the loop the OID and scalar name is unique. So why does 
it returns MIB_DUPLICATE_REGISTRATION? 





/Sverre - Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 26. oktober 2012 14:52:18 
Emne: Re: Debugging SNMP 

On 26 October 2012 13:29, Sverre Moe sve...@spacetec.no wrote: 
 Full code of my scalar registration. Changed to register all scalars one by 
 one instead of in group. 
 
 The oid_wrapper class is a wrapper around oid that contains an oid pointer 
 and the length of that oid. 

Try printing out the value of 'scalar_oid' (and 'scalar_length') 
each time round the loop. 
What is the registration call *actually* being invoked with? 
(as opposed to what you think it _should_ be invoked with) 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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


Re: Debugging SNMP

2012-10-29 Thread Sverre Moe

I have checked and there is only once instance of my subagent running. It is 
running as a separate process using AgentX protocol.


I have tried to manually register 3 hard coded scalars, one by one, each with 
its own handler:
int returnValue1 = netsnmp_register_read_only_scalar(
netsnmp_create_handler_registration(test1,
handle_snmp,
test1_oid,
OID_LENGTH(test1_oid),
HANDLER_CAN_RONLY
));



int returnValue2 = netsnmp_register_read_only_scalar(
netsnmp_create_handler_registration(test2,
handle_snmp,
test2_oid,
OID_LENGTH(test2_oid),
HANDLER_CAN_RONLY
));

etc...



This works fine and snmpget returns a value. However , if I put these 3 hard 
coded scalars OID in a list, iterate over that list and register them, I get a 
duplicate error.

for (oid_iterator) { //Overlook pseudocode here

const oid *oid_value = (*oid_iterator);
const char *buffy = tmp_string.c_str();
int returnValue = netsnmp_register_read_only_scalar(
netsnmp_create_handler_registration(buffy,
handle_snmp,
oid_value,
OID_LENGTH(oid_value),
HANDLER_CAN_RONLY
));
}





- Original Message -

Fra: Jatin Bodarya jatin.boda...@elitecore.com
Til: Sverre Moe sve...@spacetec.no
Sendt: 29. oktober 2012 09:59:23
Emne: RE: Debugging SNMP



I don’t know in your case, but one reason is because of execution of a subagent 
code multiple times. So when you run your subagent with “./XXX ” make sure 
that the previous execution has already been stopped. And if you have compiled 
the code with master agent, In that case you have to replace your “ 
libnetsnmpmibs.so.X... “ files... and then you have to execute it as subagent.



From: Sverre Moe [mailto:sve...@spacetec.no]
Sent: 29 October 2012 13:57
To: Dave Shield
Cc: net-snmp-users
Subject: Re: Debugging SNMP


I have checked the contents of each elements inputted into
int returnValue = netsnmp_register_read_only_scalar(
netsnmp_create_handler_registration(buffy,
handle_snmp,
scalar_oid,
OID_LENGTH(scalar_oid),
HANDLER_CAN_RONLY
));

For each iteration of the loop the OID and scalar name is unique. So why does 
it returns MIB_DUPLICATE_REGISTRATION?


/Sverre
- Original Message -


Fra: Dave Shield d.t.shi...@liverpool.ac.uk
Til: Sverre Moe sve...@spacetec.no
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net
Sendt: 26. oktober 2012 14:52:18
Emne: Re: Debugging SNMP

On 26 October 2012 13:29, Sverre Moe sve...@spacetec.no wrote:
 Full code of my scalar registration. Changed to register all scalars one by
 one instead of in group.

 The oid_wrapper class is a wrapper around oid that contains an oid pointer
 and the length of that oid.

Try printing out the value of 'scalar_oid' (and 'scalar_length')
each time round the loop.
What is the registration call *actually* being invoked with?
(as opposed to what you think it _should_ be invoked with)

Dave



CONFIDENTIALITY This e-mail and any attachment contain KONGSBERG information 
which may be proprietary, confidential or subject to export regulations, and is 
only meant for the intended recipient(s). Any disclosure, copying, distribution 
or use is prohibited, if not otherwise explicitly agreed with KONGSBERG. If 
received in error, please delete it immediately from your system and notify the 
sender properly.





CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly.
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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


Re: Debugging SNMP

2012-10-29 Thread Dave Shield
On 29 October 2012 09:34, Sverre Moe sve...@spacetec.no wrote:
 I have tried to manually register 3 hard coded scalars, one by one, each
 with its own handler:
[snip]
 This works fine and snmpget returns a value. However, if I put these 3 hard
 coded scalars OID in a list, iterate over that list and register them, I get
 a duplicate error.

Hmm  that sounds suspiciously as if the OID that's getting passed
to the registration code isn't the same OID that you're expecting..
Unfortunately, there doesn't seem to be any debug code within the
registration processing, that can be used to check this.
   (but see below)

Things that are perhaps worth trying:

* Separate out this call:
int returnValue = netsnmp_register_read_only_scalar(
 netsnmp_create_handler_registration(buffy, ));

into two separate statements:
 netsnmp_handler_registration *r =
   netsnmp_create_handler_registration(buffy, ));
 returnValue = netsnmp_register_read_only_scalar( r );

which will at least indicate which of the two calls is failing.

* Craft a dummy version of this module that just registers
the three scalars (using the same approach), but doesn't
try to implement the actual handler.   Then try compiling this
into the main agent code, rather than as an AgentX subagent.

This will indicate whether it's an AgentX-specific problem
or more general.

* Turn on packet dumps in the AgentX subagent, to show
the exact registration requests that are being made.

This will confirm whether the OIDs being registered are
indeed what you expect.


That third is probably the easiest to start with.
If you try the second, and still get nowhere, then please
post the complete code of that dummy module, so we
can try to reproduce the problem.

Dave

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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


Re: Debugging SNMP

2012-10-29 Thread Sverre Moe

I have tried to seperate the registration call into two separate statements, 
same result. None of these are actually failing. When I call 
netsnmp_register_scalar(handler), it returns -1 which is 
MIB_DUPLICATE_REGISTRATION. 


How do I  Turn on packet dumps in the AgentX subagent ? 




/Sverre 

- Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 29. oktober 2012 11:01:33 
Emne: Re: Debugging SNMP 

On 29 October 2012 09:34, Sverre Moe sve...@spacetec.no wrote: 
 I have tried to manually register 3 hard coded scalars, one by one, each 
 with its own handler: 
[snip] 
 This works fine and snmpget returns a value. However, if I put these 3 hard 
 coded scalars OID in a list, iterate over that list and register them, I get 
 a duplicate error. 

Hmm that sounds suspiciously as if the OID that's getting passed 
to the registration code isn't the same OID that you're expecting.. 
Unfortunately, there doesn't seem to be any debug code within the 
registration processing, that can be used to check this. 
(but see below) 

Things that are perhaps worth trying: 

* Separate out this call: 
 int returnValue = netsnmp_register_read_only_scalar( 
 netsnmp_create_handler_registration(buffy, )); 

into two separate statements: 
netsnmp_handler_registration *r = 
netsnmp_create_handler_registration(buffy, )); 
returnValue = netsnmp_register_read_only_scalar( r ); 

which will at least indicate which of the two calls is failing. 

* Craft a dummy version of this module that just registers 
the three scalars (using the same approach), but doesn't 
try to implement the actual handler. Then try compiling this 
into the main agent code, rather than as an AgentX subagent. 

This will indicate whether it's an AgentX-specific problem 
or more general. 

* Turn on packet dumps in the AgentX subagent, to show 
the exact registration requests that are being made. 

This will confirm whether the OIDs being registered are 
indeed what you expect. 


That third is probably the easiest to start with. 
If you try the second, and still get nowhere, then please 
post the complete code of that dummy module, so we 
can try to reproduce the problem. 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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


Re: Debugging SNMP

2012-10-29 Thread Dave Shield
On 29 October 2012 10:10, Sverre Moe sve...@spacetec.no wrote:
 I have tried to seperate the registration call into two separate statements,
 same result. None of these are actually failing. When I call
 netsnmp_register_scalar(handler), it returns -1 which is
 MIB_DUPLICATE_REGISTRATION.

So the 'netsnmp_create_handler_registration'  call succeeds
(returns a non-null value), but the 'netsnmp_register_scalar'
call fails (returns -1)  -  correct?


 How do I Turn on packet dumps in the AgentX subagent ?

Either
   netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,
   NETSNMP_DS_LIB_DUMP_PACKET,
   ++snmp_dump_packet);
 or
debug_register_tokens(dump);
snmp_set_do_debugging(1);

Put one or other of these statements into the main block of your
subagent code - before the 'init_snmp' and similar setup.
The first will turn on raw packet dumps (which are more compact,
but less immediately meaningful).  The second enables parsed
dumps which are probably easier to follow, if a little verbose.

If you're not sure what you are seeing, post the text of these dumps,
together with what you think the OIDs being registered should be.

Dave

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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


Re: Debugging SNMP

2012-10-29 Thread Sverre Moe

Thats correct, its the netsnmp_register_scalar which returns -1. Function 
netsnmp_create_handler_registration returns a pointer to an 
netsnmp_handler_registration. I have also tried to output the handler memory 
address, and its not always unique. Don't know if it has anything to do with 
the problem. My hypothesis is that perhaps it doesn't create an unique handler 
for each scalar. 


Could I create an netsnmp_handler_registration without the helper-function 
netsnmp_create_handler_registration? Perhaps that would solve the problem. 


Packaged dump output. Doesn't look like have any information about the scalar 
registration as I can see. 

dumph_send: AgentX Header 
dumpx_send: 01 03 00 00 
dumpv_send: Version: 1 
dumpv_send: Command: 3 (Register) 
dumpv_send: Flags: 00 
dumph_send: Session ID 
dumpx_send: 1B 00 00 00 
dumpv_send: Integer: 27 (0x1B) 
dumph_send: Transaction ID 
dumpx_send: 00 00 00 00 
dumpv_send: Integer: 0 (0x00) 
dumph_send: Request ID 
dumpx_send: C1 E5 31 3A 
dumpv_send: Integer: 976348609 (0x3A31E5C1) 
dumph_send: Dummy Length :-( 
dumpx_send: 00 00 00 00 
dumpv_send: Integer: 0 (0x00) 
dumph_send: AgentX Payload 
dumph_send: (Un)Register Header 
dumpx_send: 00 7F 00 00 
dumpv_send: Timeout: 0 
dumpv_send: Priority: 127 
dumpv_send: Range SubID: 0 
dumph_send: (Un)Register Prefix 
dumpv_send: OID: iso 
dumph_send: OID Header 
dumpx_send: 01 00 00 00 
dumpv_send: # subids: 1 (0x01) 
dumpv_send: prefix: 0 (0x00) 
dumpv_send: inclusive: 0 (0x00) 
dumph_send: OID Segments 
dumpx_send: 01 00 00 00 
dumpv_send: Integer: 1 (0x01) 
dumpx_send:0C 00 00 00 
dumpv_send: Integer: 12 (0x0C) 
dumpx_recv:14 00 00 00 
dumpv_recv: Integer: 20 (0x14) 
dumph_recv: AgentX Header 
dumph_recv: Version 
dumpx_recv: 01 
dumpv_recv: Version: 1 
dumph_recv: Command 
dumpx_recv: 12 
dumpv_recv: Command: 18 (Response) 
dumph_recv: Flags 
dumpx_recv: 00 
dumpv_recv: Flags: 0x0 
dumph_recv: Reserved Byte 
dumpx_recv: 00 
dumpv_recv: Reserved: 0x0 
dumph_recv: Session ID 
dumpx_recv: 1B 00 00 00 
dumpv_recv: Integer: 27 (0x1B) 
dumph_recv: Transaction ID 
dumpx_recv: 00 00 00 00 
dumpv_recv: Integer: 0 (0x00) 
dumph_recv: Packet ID 
dumpx_recv: C1 E5 31 3A 
dumpv_recv: Integer: 976348609 (0x3A31E5C1) 
dumph_recv: Payload Length 
dumpx_recv: 14 00 00 00 
dumpv_recv: Integer: 20 (0x14) 
dumph_recv: PDU 
dumpx_recv: 7D EE 0D 00 
dumpv_recv: Integer: 913021 (0xDEE7D) 
dumpx_recv: 00 00 
dumpv_recv: Short: 0 (0x00) 
dumpx_recv: 00 00 
dumpv_recv: Short: 0 (0x00) 
dumph_recv: VarBindList 
dumph_recv: VarBind: 
dumph_recv: Type 
dumpx_recv: 05 00 
dumpv_recv: Short: 5 (0x05) 
dumph_recv: OID Header 
dumpx_recv: 01 00 00 00 
dumpv_recv: # subids: 1 (0x01) 
dumpv_recv: prefix: 0 (0x00) 
dumpv_recv: inclusive: 0 (0x00) 
dumph_recv: OID Segments 
dumpx_recv: 01 00 00 00 
dumpv_recv: Integer: 1 (0x01) 
dumpv_recv: OID: iso 

- Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 29. oktober 2012 11:20:30 
Emne: Re: Debugging SNMP 

On 29 October 2012 10:10, Sverre Moe sve...@spacetec.no wrote: 
 I have tried to seperate the registration call into two separate statements, 
 same result. None of these are actually failing. When I call 
 netsnmp_register_scalar(handler), it returns -1 which is 
 MIB_DUPLICATE_REGISTRATION. 

So the 'netsnmp_create_handler_registration' call succeeds 
(returns a non-null value), but the 'netsnmp_register_scalar' 
call fails (returns -1) - correct? 


 How do I Turn on packet dumps in the AgentX subagent ? 

Either 
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
NETSNMP_DS_LIB_DUMP_PACKET, 
++snmp_dump_packet); 
or 
debug_register_tokens(dump); 
snmp_set_do_debugging(1); 

Put one or other of these statements into the main block of your 
subagent code - before the 'init_snmp' and similar setup. 
The first will turn on raw packet dumps (which are more compact, 
but less immediately meaningful). The second enables parsed 
dumps which are probably easier to follow, if a little verbose. 

If you're not sure what you are seeing, post the text of these dumps, 
together with what you think the OIDs being registered should be. 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps

Re: Debugging SNMP

2012-10-29 Thread Dave Shield
On 29 October 2012 10:46, Sverre Moe sve...@spacetec.no wrote:
 I have also tried to output the handler memory address, and its not
 always unique. Don't know if it has anything to do with the problem.

Hmmm  as far as I can tell, this structure should be unique,
but this duplication could well be a symptom of the problem,
rather than the underlying cause.



 Packaged dump output. Doesn't look like have any information about the
 scalar registration as I can see.
 dumph_send: (Un)Register Prefix
 dumpv_send: OID: iso
 dumph_send: OID Header
 dumpx_send: 01 00 00 00
 dumpv_send: # subids: 1 (0x01)
 dumpv_send: prefix: 0 (0x00)
 dumpv_send: inclusive: 0 (0x00)
 dumph_send: OID Segments
 dumpx_send: 01 00 00 00
 dumpv_send: Integer: 1 (0x01)
 dumpx_send:0C 00 00 00
 dumpv_send: Integer: 12 (0x0C)


This is the section that specifies the OID being registered.
Personally, I've always tended to use the raw packet dump
rather than this formatted version - but as far as I can tell,
this is trying to register either   .1(or possibly.1.12,
though I can't immediately see where the 12 comes from!)

What is the OID that this is intended to register?
What do the other packet dumps look like?
If they are all trying to register the OID .1, then this would
explain where the duplicate registration failures are coming from!


Have you managed to put together a dummy version of this
module that we can use to try and reproduce the problem?

Dave

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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


Re: Debugging SNMP

2012-10-29 Thread Sverre Moe

I'm not sure if I found a solution to my problem, but anyway 
netsnmp_handler_registration *handler_reg = 
netsnmp_create_handler_registration(buffy, 
handle_snmp, 
scalar_oid, 
OID_LENGTH(scalar_oid), 
HANDLER_CAN_RONLY); 



I tried to output each handler, and rootoid_len that comes from 
OID_LENGTH(scalar_oid) was 1 for all scalars. I reckon this value should be the 
length of the OID (1.3.6.1.4.1.40463.2.1 = 9). 


I have my own wrapper class around an OID with the length, when I used this 
length instead of OID_LENGTH(scalar_oid), it registered all my scalars with no 
duplicates. 


Why does this work for my 3 hard coded scalars, but not my list of scalars? 
const oid scalar_oid[] = { 1,3,6,1,4,1,45678,1,1 }; 
OID_LENGTH(scalar_oid) gives value 9. 
const oid *scalar_oid = wrapper.getOid(); //Has same oid within. Returns a 
pointer to an oid. 
OID_LENGTH(scalar_oid) gives value 1. 


Both of these is just a pointer right? So why does OID_LENGTH work one the 
first, but not the second? 





My immediate problem is solved. Thanks for all assistance. 




/Sverre 
- Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 29. oktober 2012 12:38:51 
Emne: Re: Debugging SNMP 

On 29 October 2012 10:46, Sverre Moe sve...@spacetec.no wrote: 
 I have also tried to output the handler memory address, and its not 
 always unique. Don't know if it has anything to do with the problem. 

Hmmm as far as I can tell, this structure should be unique, 
but this duplication could well be a symptom of the problem, 
rather than the underlying cause. 



 Packaged dump output. Doesn't look like have any information about the 
 scalar registration as I can see. 
 dumph_send: (Un)Register Prefix 
 dumpv_send: OID: iso 
 dumph_send: OID Header 
 dumpx_send: 01 00 00 00 
 dumpv_send: # subids: 1 (0x01) 
 dumpv_send: prefix: 0 (0x00) 
 dumpv_send: inclusive: 0 (0x00) 
 dumph_send: OID Segments 
 dumpx_send: 01 00 00 00 
 dumpv_send: Integer: 1 (0x01) 
 dumpx_send:0C 00 00 00 
 dumpv_send: Integer: 12 (0x0C) 


This is the section that specifies the OID being registered. 
Personally, I've always tended to use the raw packet dump 
rather than this formatted version - but as far as I can tell, 
this is trying to register either .1 (or possibly .1.12, 
though I can't immediately see where the 12 comes from!) 

What is the OID that this is intended to register? 
What do the other packet dumps look like? 
If they are all trying to register the OID .1, then this would 
explain where the duplicate registration failures are coming from! 


Have you managed to put together a dummy version of this 
module that we can use to try and reproduce the problem? 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/___
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


Re: Debugging SNMP

2012-10-29 Thread Dave Shield
On 29 October 2012 11:56, Sverre Moe sve...@spacetec.no wrote:
 Why does this work for my 3 hard coded scalars, but not my list of scalars?

 const oid scalar_oid[] = { 1,3,6,1,4,1,45678,1,1 };
 OID_LENGTH(scalar_oid) gives value 9.

 const oid *scalar_oid = wrapper.getOid(); //Has same oid within. Returns a
 pointer to an oid.
 OID_LENGTH(scalar_oid) gives value 1.

 Both of these is just a pointer right?

No.

The first case is an array,
so sizeof(scalar_oid) gives 36 (assuming a 32-bit system),
and hence  OID_LENGTH gives 9
(sizeof(scalar_oid)/sizeof(oid))

The second case is a pointer,
so sizeof(scalar_oid) gives 4 (again, assuming a 32-bit system)
and hence  OID_LENGTH gives 1
(sizeof(scalar_oid)/sizeof(oid))

Glad you got things sorted.

Dave

--
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
___
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


Debugging SNMP

2012-10-26 Thread Sverre Moe

Hello, me again. Have been sending a few messages lately. Hope I am not nagging 
to much. 



Is there a way I could debug snmp. I have gotten my C++ program to work as an 
SNMP AgentX. I have managed to register 3 hard coded test scalars and it works 
when I snmpget on those scalars. 


Thus removing these hard coded scalars I then try to add my own scalars. 
const char *buffy = group_name.c_str(); 
netsnmp_register_scalar_group( 
netsnmp_create_handler_registration(buffy, 
handle_snmp, 
group_oid, 
OID_LENGTH(group_oid), 
HANDLER_CAN_RONLY 
), 1, scalars_total); //up to the max number of scalars in this group 




When I try to snmpget on scalars I just get: 

SNMPv2-SMI::enterprises.40463.2.1.0 = No Such Object available on this agent at 
this OID 



I know I have a scalar group of OID 1.3.6.1.4.1.40463.2 which have 8 scalars. 
After I have registered all my scalars is there a way to check if there really 
is any scalars registered and which ones? 



Content of net-snmp.log. This is actually alot for only one snmpget. The last 3 
lines continues every few seconds. 

agentx/master: transport connect on session 0x7fdf24cd7840 
agentx/master: handle pdu (req=0x48a4f838,trans=0x0,sess=0x0) 
agentx/master: open 0x7fdf24cd7840 
agentx/master: opened 0x7fdf24cd75b0 = 57 with flags = a0 
agentx/master: send response, stat 0 (req=0x48a4f838,trans=0x0,sess=0x0) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f839,trans=0x0,sess=0x39) 
agentx/master: in register_agentx_list 
agentx/master: registered ok 
agentx/master: send response, stat 0 (req=0x48a4f839,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
Connection from UDP: [127.0.0.1]:48784-[127.0.0.1]:161 
agentx/master: handle pdu (req=0x48a4f83a,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83a,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83b,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83b,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83c,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83c,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83d,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83d,trans=0x0,sess=0x39) 
agentx_build: packet built okay 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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


Re: Debugging SNMP

2012-10-26 Thread Sverre Moe

Update: 


Checked the value returned from netsnmp_register_scalar_group 

The first scalar group I tried to register got value 0(MIB_REGISTERED_OK). 
All the others got value -1(MIB_REGISTRATION_FAILED or 
MIB_DUPLICATE_REGISTRATION). 


I have checked all scalars that was registered and there was no duplicate on 
either name or oid. 
So what could the cause be for this failure to register my scalars? 


Anyway, trying to snmpget the one scalar that got OK still returned No Such 
Object available on this agent at this OID. 


I even tried registering all scalars one by one, instead of in groups. 




/Sverre 

- Original Message -

Fra: Sverre Moe sve...@spacetec.no 
Til: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 26. oktober 2012 10:19:24 
Emne: Debugging SNMP 



Hello, me again. Have been sending a few messages lately. Hope I am not nagging 
to much. 



Is there a way I could debug snmp. I have gotten my C++ program to work as an 
SNMP AgentX. I have managed to register 3 hard coded test scalars and it works 
when I snmpget on those scalars. 


Thus removing these hard coded scalars I then try to add my own scalars. 
const char *buffy = group_name.c_str(); 
netsnmp_register_scalar_group( 
netsnmp_create_handler_registration(buffy, 
handle_snmp, 
group_oid, 
OID_LENGTH(group_oid), 
HANDLER_CAN_RONLY 
), 1, scalars_total); //up to the max number of scalars in this group 




When I try to snmpget on scalars I just get: 

SNMPv2-SMI::enterprises.40463.2.1.0 = No Such Object available on this agent at 
this OID 



I know I have a scalar group of OID 1.3.6.1.4.1.40463.2 which have 8 scalars. 
After I have registered all my scalars is there a way to check if there really 
is any scalars registered and which ones? 



Content of net-snmp.log. This is actually alot for only one snmpget. The last 3 
lines continues every few seconds. 

agentx/master: transport connect on session 0x7fdf24cd7840 
agentx/master: handle pdu (req=0x48a4f838,trans=0x0,sess=0x0) 
agentx/master: open 0x7fdf24cd7840 
agentx/master: opened 0x7fdf24cd75b0 = 57 with flags = a0 
agentx/master: send response, stat 0 (req=0x48a4f838,trans=0x0,sess=0x0) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f839,trans=0x0,sess=0x39) 
agentx/master: in register_agentx_list 
agentx/master: registered ok 
agentx/master: send response, stat 0 (req=0x48a4f839,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
Connection from UDP: [127.0.0.1]:48784-[127.0.0.1]:161 
agentx/master: handle pdu (req=0x48a4f83a,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83a,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83b,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83b,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83c,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83c,trans=0x0,sess=0x39) 
agentx_build: packet built okay 
agentx/master: handle pdu (req=0x48a4f83d,trans=0x0,sess=0x39) 
agentx/master: send response, stat 0 (req=0x48a4f83d,trans=0x0,sess=0x39) 
agentx_build: packet built okay 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be
proprietary, confidential or subject to export regulations, and is only meant
for the intended recipient(s). Any disclosure, copying, distribution or use is
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in
error, please delete it immediately from your system and notify the sender
properly. 



-- 
Everyone hates slow websites. So do we. 
Make your web apps faster with AppDynamics 
Download AppDynamics Lite for free today: 
http://p.sf.net/sfu/appdyn_sfd2d_oct 
___ 
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 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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

Re: Debugging SNMP

2012-10-26 Thread Dave Shield
On 26 October 2012 12:16, Sverre Moe sve...@spacetec.no wrote:
 The first scalar group I tried to register got value 0(MIB_REGISTERED_OK).

 All the others got value -1(MIB_REGISTRATION_FAILED or
  MIB_DUPLICATE_REGISTRATION).

Do the other groups use the same root OID as the first registration,
or do they all use different roots?

The usual cause of a duplicate registration would be having two
invocations of netsnmp_register_xxx() with the same root OID
(i.e. the third/fourth parameters to the
netsnmp_create_handler_registration call)

If that's not the case, it's probably worth posting the full code
of the block used to register these groups.


Dave

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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


Re: Debugging SNMP

2012-10-26 Thread Dave Shield
On 26 October 2012 13:29, Sverre Moe sve...@spacetec.no wrote:
 Full code of my scalar registration. Changed to register all scalars one by
 one instead of in group.

 The oid_wrapper class is a wrapper around oid that contains an oid pointer
 and the length of that oid.

Try printing out the value of 'scalar_oid' (and 'scalar_length')
each time round the loop.
   What is the registration call *actually* being invoked with?
(as opposed to what you think it _should_ be invoked with)

Dave

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
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


Re: Debugging SNMP

2012-10-26 Thread Sverre Moe

I have tried to output the scalar name, oid and oid length. On every iteration 
it prints out a new unique scalar. 


Many scalars, but here is the output of a few: 
Scalar: version 1.3.6.1.4.1.40463.2.1 
Scalar: primary 1.3.6.1.4.1.40463.2.2 
Scalar: available 1.3.6.1.4.1.40463.2.3 
Scalar: hostname 1.3.6.1.4.1.40463.2.4 

And none of these occur more than once. 


Don't understand you last question. 



/Sverre 

- Original Message -

Fra: Dave Shield d.t.shi...@liverpool.ac.uk 
Til: Sverre Moe sve...@spacetec.no 
Kopi: net-snmp-users net-snmp-users@lists.sourceforge.net 
Sendt: 26. oktober 2012 14:52:18 
Emne: Re: Debugging SNMP 

On 26 October 2012 13:29, Sverre Moe sve...@spacetec.no wrote: 
 Full code of my scalar registration. Changed to register all scalars one by 
 one instead of in group. 
 
 The oid_wrapper class is a wrapper around oid that contains an oid pointer 
 and the length of that oid. 

Try printing out the value of 'scalar_oid' (and 'scalar_length') 
each time round the loop. 
What is the registration call *actually* being invoked with? 
(as opposed to what you think it _should_ be invoked with) 

Dave 



CONFIDENTIALITY
This e-mail and any attachment contain KONGSBERG information which may be 
proprietary, confidential or subject to export regulations, and is only meant 
for the intended recipient(s). Any disclosure, copying, distribution or use is 
prohibited, if not otherwise explicitly agreed with KONGSBERG. If received in 
error, please delete it immediately from your system and notify the sender 
properly.
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
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