Re: How to manipulate variables outside of SNMP gets / sets?

2013-01-23 Thread Dave Shield
On 22 January 2013 21:21, Guillermo Veneranda guillev...@gmail.com wrote:
 I try what you say and... It's Works! :)

But of course, oh ye of little faith

 Let's go now for the SET!

OK.
So go back to the code generated by mib2c.
Add the declaration of 'example1' as before,
and tweak the MODE_GET block to report this value
(directly, *not* read from the /tmp file just yet).

Now look at the other blocks - the ones that handle
SET processing.

At it's simplest, you just need to use two of these:
   MODE_SET_RESERVE1 and either
MODE_SET_ACTION or MODE_SET_COMMIT

The RESERVE1 code is probably OK as it stands.
It checks to see if the incoming assignment is an
integer value (as opposed to a string or an OID),
and complains if it's not.
If your MIB object can only accept a particular
range of values (say 1 to 10), then this is the place
where you would check that the new value was OK,
and reject the request if it was out of range.

Acting on the assignment is simply a matter of
putting the new value into the 'example1' variable.
i.e.
 example1 =  *(request-requestvb-val.integer);

This operation is so simple that it cannot possibly fail
(at least as long as the 'request' structure is valid!),
so it can go in either ACTION or COMMIT.

Try that - with the other SET blocks left empty
(i.e.
 case MODE_SET_XXX;
 break;
)
Compile that into the agent as before - you should find
that you can issue an snmpset command for this object
and have the new value returned by a subsequent GET
or snmpwalk request.


Try that, and then come back, and we can talk about how
to extend this to saving the new value in a file.
   (Please note that this is *not* simply a matter of adding
suitable   'fopen/write/fclose' calls - there are other
considerations that need to be taken into account)

But get the basic SET processing working first,
and then we can move on to the next stage.

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: How to manipulate variables outside of SNMP gets / sets?

2013-01-22 Thread Dave Shield
On 21 January 2013 20:20, Guillermo Veneranda guillev...@gmail.com wrote:
 Hi,
 I'm reading the files examples/netSnmpHostsTable* but I find these quite
 difficult to understand, This is going to take a while. Maybe I should try
 something easier that use subhandler function.

 Could you please show me a simple example of a subhandler function?

If you started by looking at the code in 'example/scalar_int.c'
then perhaps a sensible approach would be to look at a handler-based
version of that.

Try running the following command:

  mib2c  -c   mib2c.scalar.conf
NET-SNMP-EXAMPLES-MIB::netSnmpExampleInteger

That will generate template code that is broadly equivalent to the
'example/scalar_int.c' module.
   The main difference is that instead of GET/SETs being handled
automatically by an internal helper, the requests are passed to the
MIB handler routine (i.e. the generated code) for processing.

What I would suggest is that you start with a read-only version of the
above template - i.e. take the generated code, change
HANDLER_CAN_RWRITE to be HANDLER_CAN_RONLY, and
delete the blocks MODE_SET_RESERVE1 through to MODE_SET_UNDO

Then add the declaration of 'example1' from example/scalar_int.c
and use this value to fill in the MODE_GET block.
   Compiling that into the agent (*instead* of example/scalar_int)
should allow you to query the same OID as before.


Then amend the code of the MODE_GET block so that instead of
returning a fixed value for 'example1',  this value is read from a file.
(i.e. open the file, scan in a line, convert this line to a number,
 and return that number - not forgetting to close the file again!)


That would give you the first part of what you were asking about.
(Handling GET requests from a file).

Try that - and come back when you've got it working, and we can
look at the SET processing.

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Problem in receiving traps

2013-01-22 Thread Dave Shield
On 22 January 2013 10:23, Geet Bhatia geetbhati...@gmail.com wrote:
 I am trying to build a simple C trap receiver.

Is there any reason why you don't wish to use the standard 'snmptrapd'
application?


 Here I am calling function netsnmp_transport_open_server with application
 name and udp:162 as parameters. But this function is returning NULL every
 time.

Who are you running the application as?  Root, or an unprivileged user?
Is there another application already listening on this socket?
What happens if you specify a different port to listen on?

Does anything get logged?
Try setting the debug flag 'tdomain' - what gets logged then?

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Index of table in SNMP Agent

2013-01-16 Thread Dave Shield
On 16 January 2013 08:31, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 I spend some time to study the iterator helper to retrieve external data 
 outside from SNMP agent.
 I found that iterator uses a 'get first' and 'get next' way for get and 
 getbulk requests.

The iterator uses 'get_first' and 'get_next' hooks to work through the
table data,
in order to find the appropriate row for a particular (individual) request.
This holds true for *all* SNMP requests - Get, GetNext, GetBulk and Set.

 And for GET request, agent will also use this hook routine to find the index.
 What's the reason behind this?

In order to find the row that it needs to use in order to process the request.
Remember, the external data may not be ordered in the same way as required
for SNMP requests - the agent needs to iterate through the rows in order to
find the correct one.
   The clue is in the name!   :-)


 Is there a document I can refer to know how the get first get next works?

Have you read the documentation about the table_iterator on the project
website?


 For external data, is there a better way for GETBULK request?
 Suppose external data can be get via blocks(one block has multiple OID data).

If you can grab the external data in a block, then the usual approach
would be to use an internal cache to hold a complete copy of the table,
and use that for processing incoming requests.   The timeout of the cache
can be set to force a reload whenever the data will be regarded as too old.

The mib2c.iterator.conf template can support that approach (using -Scache=1)
but will still walk through the rows for each incoming request.
It would be more efficient to use the mib2c.table_data.conf template
(again using -Scache=1), which can go direct to the required row.
Or possible the MfD template - but I don't have a great deal of experience
with that one.

Dave

--
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Working on net-snmp

2013-01-14 Thread Dave Shield
On 13 January 2013 14:30, Vivek Nagaraj nagaraj.vi...@gmail.com wrote:
 I had a quick question. Can you please suggest me platform (OS) and tools
 (IDE) used to develop and test feature/bugs?

Basic advice - use what you are most comfortable with.
I do most of my development on Linux, with a command-line terminal.

If you're happier using an IDE, or on a different OS, then use that.
For most things, it doesn't really matter.
   The main exception is when you're implementing an agent MIB module,
where you need to pull data from the underlying system.  This *does*
tend to be very O/S-specific.
   But most of the client-side stuff, the main agent framework, and the
library code should be more-or-less O/S independent.


 I seem a bit confused at the moment considering a few options such as
 Windows with Cygwin or MSVC and Linux (any flavor) with gcc.

Linux/gxx is probably the core development environment for most
of the development team.   But there will be some who naturally
work in a different setup.
   Don't worry too much about it - go for what works best for you.
Whatever you come up with will be tested/tweaked to work with
other systems anyway.

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Working on net-snmp

2013-01-10 Thread Dave Shield
On 10 January 2013 16:00, Vivek Nagaraj nagaraj.vi...@gmail.com wrote:
 Any bugs / feature requests in net-snmp that you might think I can handle as
 a fresher, can you please point me to?

One relatively self-contained feature that should be reasonably straightforward
to implement would be to extend the forward mechanism of  snmptrapd.conf,
in order to accept version/community/authentication information.
   At the moment, traps are forwarded using the same version/credentials taken
from the incoming trap - it would be very useful to be able to specify these in
the config file, and hence forward traps using a different version
and/or credentials.

At heart, this would essentially be merging in the behaviour of the
'trapsess' directive.
(See Feature Request #164)
Does that sound the sort of thing you were looking for?


Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Working on net-snmp

2013-01-09 Thread Dave Shield
On 9 January 2013 14:03, Vivek Nagaraj nagaraj.vi...@gmail.com wrote:
 My passion was always to contribute a little bit to the opensource softwares.
 This might also provide me a good insight of how net-snmp works behind the
 scenes.

OK - so you're looking for some idea about what you might do
with/for the project   -   rather than wanting assistance with a
particular task that you've already got.   Is that correct?

   What O/S setups do you have access to?
One possible task might be to look at some of the MIBs that are
only supported on selected environments, and look at porting
them to another O/S.   That would typically involve discovering how
the necessary information could be retrieved from the target O/S,
and merging this in with the existing code for that MIB.

Or see if there's a MIB that isn't currently supported, and look
at implementing that.  (Which is similar to the above, but would
involve the SNMP/MIB side too)

Another option might be to look through the list of feature requests
(found under the 'ticket' section of the project's S/F site), and
see if there's anything that catches your interest there.

Or if you were feeling really keen, have a look through the 'bugs'
tickets, and see if you could tackle some of those.   That would
really make you friends among the core development team!


If I've misunderstood what you're looking for - or if you've got
an idea about what you'd like to work at, but would need some
guidance/advice - just let us know, and we'll try to help.

Dave

--
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Working on net-snmp

2013-01-08 Thread Dave Shield
On 8 January 2013 11:16, Vivek Nagaraj nagaraj.vi...@gmail.com wrote:
 I am interested to work on net-snmp.

What are you wanting to do with the software?
It's a bit difficult to offer advice given the level of detail
you have provided so far :-)

Dave

--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: need net-snmp 5.4.1 version source for debian

2013-01-08 Thread Dave Shield
On 8 January 2013 21:33, Suna Sana sureshsciluti...@gmail.com wrote:
 I need net-snmp 5.4.1 source. Could you please share the link to get it.

See
 http://sourceforge.net/projects/net-snmp/files/OldFiles/net-snmp-5.4.x/

Dave

--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP Agent engineboot

2013-01-07 Thread Dave Shield
On 7 January 2013 02:45, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 What I did is to store the engineboot somewhere else from Agent,
 when agent restarts will read the last engineboot and increase 1,
 and response with new engineboot=2

But that's exactly what the Net-SNMP library should be taking care of for you.
You shouldn't need to do this yourself - it's already handled by the
shutdown code.
(see snmplib/snmpv3.c:snmpv3_store())

If this isn't happening, then there's probably something wrong with
your agent code
(or else the agent isn't being shut down cleanly)

I really would suggest that you strongly consider using the Net-SNMP provided
agent framework, which is known to work correctly.   Re-implementing your own
agent from scratch seems an unnecessary duplication of effort

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP Agent engineboot

2013-01-07 Thread Dave Shield
On 7 January 2013 08:53, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 I am using net-snmp provided agent.

Now I'm confused.

When you first posted, you said
I am trying to implement an SNMP agent using net-snmp APIs

and the code that you listed there doesn't look much like the standard
Net-SNMP agent.



 I didn't read the snmpv3_store thoroughly, is the old engineboots saved in 
 the config file?

Yes.
(As long as the agent is shut down cleanly - if it crashes, then this
may not happen
  or if it's is killed using kill -9, then the syseadmin deserves
everything they get!)

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Looking for H file

2013-01-06 Thread Dave Shield
On 6 January 2013 17:24, Summers, Scott H scott.summ...@unisys.com wrote:
 At this point I'm simply trying to figure out how to generate the CONF files.

The configuration files are simple plain text files.
You can create them using your preferred text editor

There's no need to use any specialised tools for this.

See the snmp.conf(5),  snmpd.conf(5)  and/or  snmptrapd.conf(5)
man pages for guidance as to what should go in them.

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Looking for H file

2013-01-06 Thread Dave Shield
On 6 January 2013 17:40, Summers, Scott H scott.summ...@unisys.com wrote:
 One of the first things that MAN pages reference is to run SNMPCONF (which 
 I've found I need to create).

snmpconf is one way to generate configuration files, yes.
But it's not actually necessary to use this.

As I said, these are simply text files, and you can quite reasonably create
them using a text editor.

The idea of snmpconf is to guide you through the process of creating a
config file by answering questions, rather than by inserting the config
directives directly.
  Personally, I've never been particularly happy about the idea of
encouraging people to write config files that they don't understand! :-)
(Which is why I tend to give the required directives directly,
 rather than suggest using snmpconf)

But you can use whatever mechanism you find easiest - all that
matters is the config file that comes out at the end.

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP Agent engineboot

2013-01-05 Thread Dave Shield
On 5 January 2013 13:21, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 I try to use  set_enginetime() by set the engineboots to a value stored in 
 out side of agent.

I don't understand what you are trying to do here.
Is this call to 'set_enginetime' in the agent, or in the manager?

You shouldn't need to touch the engine boot information in the agent.
The boot count and time values are handled automatically by the
Net-SNMP library.
They will be updated when the agent re-started, and maintained as the
agent runs.
You shouldn't need to meddle with them.

I'm also not entirely sure why you are trying to re-implement an agent
in the first place?
Why not simply use the standard Net-SNMP agent - which we know works!


 Then when Manager side send request, agent will return with new engineboot,
 then manager side will send request again with new engineboot and time.
 I thought this time, agent will think its in sync with manager side.

Yes - that should be what happens.
It's probably worth checking this - try running the agent with packet
dumps turned on
(either '-d' or '-Ddump'), and compare the values in the (first) Report packet
with those in the (second) Request packet


 But unfortunately, seems usm_check_and_update_timeliness() will still return 
 error,
 it will compare the the static engineBoots stored in agent with the new 
 engineboots
 value. boots_uint != myBoots

And which one is right?
What are the two values, and how do they compare with the value in the
Report message
(and with the engineBoot value from before the agent was restarted) ?


 myBoots is get from snmpv3_local_snmpEngineBoots:
 snmpv3_local_snmpEngineBoots(void)
 {
 return engineBoots;
 }

 Seems I can not set this static engineBoots?

No - it's maintained by the library code, and updated automatically
when the agent restarts.   You shouldn't need to change it directly.

I'm actually wondering whether the manager software is updating
the boot count value correctly - or whether it's using the same value
for both requests?

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP requested timed out on windows

2013-01-04 Thread Dave Shield
On 4 January 2013 19:19, Niels Baggesen n...@users.sourceforge.net wrote:
 Is there a firewall . on the Linux host, that blocks SNMP?


That was my immediate reaction too.
If you're running iptables, and haven't tweaked the default settings,
it probably only accepts incoming requests for specific, known services
(which wouldn't include SNMP)

That wouldn't affect the localhost queries, as the default iptables
setup would typically allow anything from 127.0.0.1
But it would block queries from another source, unless you open
up the firewall to allow them (or turn it off altogether)

The other thing to check is how the agent has been started.
If it's only listening on interface 127.0.0.1, then it wouldn't
respond to remote queries either.
   But I'd start by looking at iptables.

Dave

--
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP Agent log

2013-01-02 Thread Dave Shield
On 2 January 2013 08:45, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 I am trying to implement an SNMP agent using net-snmp APIs,
 I used below method to setup a SNMP agent process,called SNMP_agt.
  :
 This agent works but I can not find the deamon process using ps -ef|grep 
 snmpd?

What about   ps -ef | grep SNMP_agt  ?

If the process is called SNMP_agt, then that's probably what you should
be looking for - not 'snmpd'


 I got another question: where can I set the debug log?

See the routine 'snmp_log_options' in the file 'snmplib/snmp_logging.c'
This is where the standard agent logging configuration is handled.
You can either try calling this directly as part of your command-line
processing or similar,   or reproduce the particular aspects of this code
that you want to use.

Dave

--
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: netsnmp register char instance

2013-01-01 Thread Dave Shield
On 30 December 2012 23:08, SureshCilutions S sureshsciluti...@gmail.com wrote:
 Is there any function for register  string/char variable similar to
 netsnmp_register_long_instance?

   netsnmp_register_watched_instance

This can be used to handle strings or OID-valued variables.

See 'examples/watched.c' in the source tree.

Dave

--
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Regarding snmp agent, subagent using AgentX

2012-12-30 Thread Dave Shield
On 30 December 2012 14:16, SureshCilutions S sureshsciluti...@gmail.com wrote:
 I have compiled the sub agent using AgentX 

 Run the agent[snmpd] exe and subagent[exampled] exe separately, both are
 running fine. Request the GET operation for the OID
 .1.3.6.1.4.1.8072.2.4.1.1.2.0 and received the response as 2 in MIB
 browser.

Congratulations.

 I want to clarify how this request and response works, 1 or 2?

Model 1
The client application is always talking to the master agent (snmpd)
This agent looks at the OID(s) being requested and decides whether
to pass the request on to your subagent.

Hope this helps

Dave

--
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Index of table in SNMP Agent

2012-12-17 Thread Dave Shield
On 17 December 2012 01:18, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 Thanks for your response, it's really helps.
 Is there an example I can refer that SNNP can retrieve data from outside?

Hmmm...
   there are probably not many examples of using the iterator to
walk through external data.

   As I indicated last week, it's not exactly the most efficient of
the table helpers, so a more common technique is to read in a
snapshot of the external data, cache it, and use that cache to
process incoming requests.   The cache is only reloaded when
it's deemed too old.

  A quick look through the code shows about a dozen modules
that use the iterator helper.  Some of these (nsCache, nsDebug, etc)
are reporting on internal data anyway, so aren't really relevant here.
Probably the most promising for you to look at would be

examples/netSnmpHostTable{,_access}.c
  which uses a variant of the iterator approach to read
  from /etc/hosts
or
mibII/icmp.c
mibII/ipCidrRouteTable.c
mibII/tcpTable.c
mibII/udpTable.c

which are probably the closest to what you're trying to do.

Dave

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Index of table in SNMP Agent

2012-12-17 Thread Dave Shield
On 18 December 2012 05:53, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 We have concern to keep a cache of index, we might need audit to detect
 the mismatch between cache and external data.

How rapidly is the data changing?
If you took two snapshots, say 5 seconds apart, how likely is it that
they would be different?
What about 2 seconds?

It depends on the size and complexity of the table (and the exact
approach you use
to implement the table), but it's not implausible that walking an
external table directly
might actually end up *more* likely to have the underlying data change
during the
course of traversing the table, leading to inconsistent information.
  At least with a cache, the admin knows (or can be reasonably
confident) that the
information received is consistent.

The other question is how often are rows added/deleted?
If the number and indexing of rows is relatively static (and it's just the
data values that change rapidly), then you could keep a local cache of
the row indexes (and use a more efficient approach to detecting which
row(s) were required), and then retrieve the current live data from
within the handler itself.

Just a thought.

Dave

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Index of table in SNMP Agent

2012-12-14 Thread Dave Shield
On 14 December 2012 06:45, Zheng, Wenjie (Barclay)
barclay.zh...@alcatel-lucent.com wrote:
 I am trying to setup a SNMP Agent to manage data from outside of SNMP Agent.
 I try to use mib2c.iterate.conf to generate code, I found that the table 
 handler need
 to keep a index list of the table data, but as my data is from out side of 
 SNMP Agent,
 I am confused why SNMP need to keep a copy of the index list

It doesn't.

The table handler needs to know the *structure* of the indexing of the table
(whether it's a single integer, three octet strings and a dog, or whatever),
but it doesn't necessarily need to know the actual index list, or keep a copy
of this.
   The iterator helper has a pair of hook routines - get_first and get_next
which can be used to query the external data source to determine the current
list of valid row indexes.   But these will be invoked afresh for each
individual
request, so would pick up any changes in the meantime.

(Please don't be mislead by the fact that the default template code
 generated by mib2c.iterate.conf uses a linked list of data structures,
 and hence does hold the list of valid indexes internally.   This is purely
 to provide a starting framework for the MIB code.
You can replace the traversal of this list with calls to the
external source).



 Is this a must that SNMP Agent need to keep a index list for table handler?

No.

There may well be a performance hit when using an external data source
(particularly with the iterator helper, which isn't particularly
efficient anyway).
But the agent can work quite happily by retrieving the list of valid rows from
outside.

Dave

--
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: cache reload issue in agentX

2012-11-02 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy
 at the best of times - let alone at the moment.  Keep
 discussions to the list, where others can both learn and
 offer advice.  Thanks.   ]

On 2 November 2012 05:03, Jatin Bodarya jatin.boda...@elitecore.com wrote:
 Actually sir I have tried this way alsobut as  sscanf was a failure to
 NULL value handling There is a possibility to mismatch the returned data.
 Here in case like..
 1,2,3
 1,,
 ,2,4

 It was not returning 0 value at the NULL reading, but the next value.

Two thoughts here:

If there should only be the occasional incomplete line, then you could
start by using sscanf, and then fall back to a more detailed parser.
i.e. something like:

if ( sscanf(line, %ld,%ld,%ld,
record[i].a,record[i].b,record[i].c) != 3 )
{
 my_robust_parser( line, record[i] );
}


If a significant proportion of the lines would be affected,
you could have an external process that took the raw
data file, and pre-processed it to insert the missing 0s.
   (Either tweaking the code that produces this file
in the first place, or some intermediate process)
Or that process could convert from text-based CSV,
to a binary data file.
   The point here is that the slow processing would be
taken out of the time-critical portion - i.e. the agent's
processing of an incoming request.


That's assuming that this is the cause of the problem,
of course.As I said yesterday, you probably need
to do some timing tests to check that.

Dave

--
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: cache reload issue in agentX

2012-11-01 Thread Dave Shield
On 1 November 2012 09:13, Jatin Bodarya jatin.boda...@elitecore.com wrote:
 Hi Dave,

I'm actually taking something of a sabbatical from Net-SNMP support at the
moment.  It would be sensible to address your queries to the general community,
rather than to me personally, as I'm relatively unlikely to respond

 I have implemented C code using mib2c.create-dataset.conf ( with cache
 enabled)

 Here I suppose to  read very large amount of data  from file. And so I m
 Facing problem while reloading the cache...

The obvious thing would be to investigate one of the other table helpers.
The 'dataset' helper uses a very generic approach - the data for the table
is stored as a list of rows, each of which is stored as a list of individual
entries.  As such, it is very flexible, with minimal MIB-specific code
required, but not particularly fast.

Personally, I'd be inclined to look at using the 'tdata' helper
(mib2c.table_data.conf), which also stores the table as a list of rows.
But each row is stored as a single (MIB-specific) data structure.
So accessing an individual value uses hard-wired code for that
particular column object, and avoids searching the per-row list.
As such, it should be noticeably faster than the create-dataset approach
(though I haven't done any timing tests to confirm this).

Alternatively you could look at the MFD framework,
which again has a greater amount of MIB-specific code - mostly
automatically generated by the mib2c command.
Personally, I don't particularly like the style of code this uses,
but that's as much taste as anything else - it should also be
noticeably faster than the create-dataset style.


Have a look at one or both of those, and see if they're any better
suited for your needs.

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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: cache reload issue in agentX

2012-11-01 Thread Dave Shield
On 1 November 2012 10:50, Jatin Bodarya jatin.boda...@elitecore.com wrote:
 (With attachment there is a full code)

First question:
   Why are you creating two caches?
I would expect this to double the loading time

   (Though given that poolTable_load1 doesn't
 seem to be defined anywhere, I can't see
 how this code would even compile!)

Second:
   If the problem is the time taken to load the data,
it's perhaps worth doing some profiling on the code
used for this, to see where the bottlenecks are.

   For example, is it actually necessary to dynamically
allocate memory within the 'getfield' routine?
This is then parsed as a decimal number, and
then released immediately.
   How about if you did the 'strtol' parsing within the
'getfield' routine, and returned a pointer to a (static)
structure that contained the three values.
Or perhaps use 'sscanf' to combine the tokenisation
and parsing steps.
  Either or both of those might or might not be faster,
but it's worth doing some simple timing tests to find out.


If that's still not fast enough, perhaps you could convert
the data file to a binary format, which should be much
faster to load.

Or allocate a single fixed array for the whole table,
rather than calling 'netsnmp_tdata_create_row()'
to allocate memory for each row individually.

If the index values are guaranteed to be sequential,
you might even wish to avoid the linked-list approach
of the table_tdata helper altogether, and craft your
own handler that went straight for the appropriate row.
Which should be faster still.


Anyway - that should give you several possible avenues
to follow.   Now I must get back to my paid employment.

Good luck

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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: cache reload issue in agentX

2012-11-01 Thread Dave Shield
On 1 November 2012 13:34, Jatin Bodarya jatin.boda...@elitecore.com wrote:
For example, is it actually necessary to dynamically
 allocate memory within the 'getfield' routine?
 This is then parsed as a decimal number, and
 then released immediately.

 - yes as the original CSV file is very dynamically change its data ,I
 suppose to use this method.

No - that's not what I meant.

I was suggesting you compare the current
   3 x getfield()   (involving malloc + assorted strchr, etc)
   3 x strtol()
   2 x free() (plus the memory leak from not releasing 'index'!)

vs a single statement along the lines of

   sscanf( tmp, %d,%d,%d,  index, inOctets, outOctets );


I'm talking about the way that you read in and parse the data
at a given point in time -  not how dynamic the data file is.


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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Notification on parameter change

2012-10-16 Thread Dave Shield
On 16 October 2012 08:32, Giuseppe Modugno g.modu...@elettronika.it wrote:
 Now I'd like to have an agent that sends a notification for *each*
 parameter: if an alarm occurs, if the user change a setting (even
 through SNMP SET) and so on.

 The only approach I know is to define in the MIB a different
 NOTIFICATION-TYPE for each parameter, so I'll have a MIB composed by two
 main trees: one for the parameters and the second for the related
 notifications. Is this approach good?

No.

Why not simply define a single notification   somethingChanged
which takes one payload varbind - the OID of the instance that was updated.

You'd need to define a MIB object for that (with max-access
accessible-for-notify),  but that's just two definitions - not a whole tree.


 Can you suggest a better approach? Maybe defining a generic trap related
 to a parameter change? In this case, I can add to this generic
 notification a service parameter with an OID value: the OID will be
 the parameter that has changed.

Exactly.

But how can I add the new value of 
 the
 parameter in a generic way (it could be an integer, an octet string and
 so on).

Remember that you can always append additional varbinds to a
notification payload - over and above those listed in the MIB definitions.
So as well as the
 somethingChangedOID.0 = theOidThatChanged

varbind, the notification could also contain a copy of the incoming SET
varbind. i.e:

 somethingChangedOID.0 = theOidThatChanged
 theOidThatChanged  =  theNewValue


One thing to bear in mind is how you wish to handle multiple values
being updated in a single SET request.  Would that trigger a series
of notifications (one per incoming varbind), or would all the information
be included in the same trap?

Dave

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Notification on parameter change

2012-10-16 Thread Dave Shield
On 16 October 2012 09:05, Giuseppe Modugno g.modu...@elettronika.it wrote:
 Remember that you can always append additional varbinds to a
 notification payload - over and above those listed in the MIB definitions.
 Really?  I thought I was forced to append just the varbinds defined in
 the MIB.  Which is the RFC where I can study the composition of the
 notification?

RFC 1905 - section 4.2.6 - last sentence.

Dave

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Notification on parameter change

2012-10-16 Thread Dave Shield
On 16 October 2012 14:10, Giuseppe Modugno g.modu...@elettronika.it wrote:
 In this case, why to use the service object somethingChangedOID? The
 OID of the changed instance can be retrieved from the extra (not
 specified in the MIB) varbind that contains the value too, so the
 OBJECTS clause for the notification can be empty/absent.

 Do I forget something?

No - that would work too.

Dave

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpwalk - Alternative SNMP port not available

2012-10-09 Thread Dave Shield
On 9 October 2012 14:02, Glenn Gagné glenn.ga...@.gouv.qc.ca wrote:
 May be, it could be a good update to add this information in specific
 manpage of snmpwalk

  $ man snmpwalk

  OPTIONS
  [snip]

   In addition to these options, snmpwalk takes the common options
   described in the snmpcmd(1) manual page.

 It's not user-friendly to search information about snmpwalk
 option in snmpcmd manpage !

There are something like 60+ options that apply to all of the
command-line tools (including snmpwalk) - not counting the
detailed explanation of how the agent address syntax works.

It would be just as unhelpful to repeat the whole of that explanation
in each of the dozen or more individual man pages.  Not to mention a
nightmare to maintain these to ensure that they all stayed in synch.

That is why we took the decision to document the common options in
one place (snmpcmd(1)), and reference this from each of the individual
command-specific man pages.

Dave

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpwalk - Alternative SNMP port not available

2012-10-08 Thread Dave Shield
On 5 October 2012 15:55, Glenn Gagné glenn.ga...@.gouv.qc.ca wrote:
 But I have a problem with some equipments due to the lack of using an
 alternative UDP port (non-standard UDP/161).  I searched on the Internet to
 known how to use an alternative port with snmpwalk and the answer was : This
 option was removed in new versions !

I don't know where you found this information, but it's not correct.
It is perfectly possible to specify an alternative port with snmpwalk
and friends - this is something that most of the developers will be
using all the time.

Please see the man page for snmpcmd - in particular the section
headed AGENT SPECIFICATION.   This describes how to give
the destination to send queries to - including how to specify a
non-default port with a variety of transport mechanisms.

  What was removed some time ago was the command-line option
flag to specify an IPv4 port.   This IPv4-specific option was essentially
redundant, given the more powerful transport-address syntax
described in the above man page.


 I submit you this message to let my opinion that having an alternative port
 option is almost necessary with any network application ! In hope that my
 suggestion will be heard and you will add this option again in snmpwalk !!!

This functionality was never removed.

Dave

--
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: How to manage scalars without serialization

2012-09-21 Thread Dave Shield
On 21 September 2012 08:23, Giuseppe Modugno g.modu...@elettronika.it wrote:
 Another idea would be the use of caching data helper, but I don't if it
 could be a real solution. Consider that many variables accessed from the
 serial bus are analog signals (voltages, currents, ...) and they may
 change frequently over time, so the cache timeout period could be around
 100-500ms, no more. Usually the user polls the agent every 1-10s with
 multiple-variables requests, so the serial bus access won't be avoided.

Using a cache with a very low timeout (say 1s) would probably be the
simplest approach here.Processing the first varbind in each query
would trigger the cache reload (and hence the serial bus access).
Subsequent varbinds within the same request could then use this
cached datam thus avoiding the serial delays (as well as reporting
consistent values - all retrieved via the same serial bus query).

By the time of the next poll, the cache would be stale, so the process
would begin again.

Dave

--
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: net-snmp agent problem

2012-09-12 Thread Dave Shield
On 12 September 2012 10:02, Jatin Bodarya jatin.boda...@elitecore.com wrote:
 But the issue is with popen(); call... when I am using SNMPWALK
 command to get value it is working perfectly and returning me correct
 value... but  only 10-15 time... then after popen fails !

Have you considered closing the pipe after you have finished with it?

Dave

[I would also suggest you give full consideration to Walter's eminently
 sensible suggestions.   Ignoring warnings and error values is very
 poor practise.  Those messages are there to help you, and indicate
 that something is wrong - saying but it seems to work and ignoring
 them is very short sighted.]

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: How to solve this problem.

2012-09-11 Thread Dave Shield
On 11 September 2012 05:32, Jatin Bodarya jatin.boda...@elitecore.com wrote:
 If the port is allocated to another process kill it with
 Kill -9 PROCESSID

Arggg   No!!
Do not NOT *NOT* use kill -9 as your weapon of choice.

Use a simple kill by all means - that at least allows the
process a chance to tidy up before shutting down.
  (Though it would be preferable to use the proper service
control commands - typically service xxx stop)

But kill -9 should always be a last resort, when everything
else has failed.


Sunitha - the other question would be whether you are
starting the agent as root or as a normal user.
Port 161 is a privileged port, so can only be used when
starting the agent as root.   If you run the command as
a normal user, it won't be able to open this port.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: CFV: Fix possible memory overrun in fsys_getfsstats.c

2012-08-22 Thread Dave Shield
On 22 August 2012 09:11, Schmoll Walter walter.schm...@andritz.com wrote:
 ... as far as I know, strlcpy is not standard and only available on BSD 
 related
 systems and slightly incompatible on Solaris (the return value is different)
 but not on Linux related systems nor on Windows (just checked with my Ubuntu 
 10.04 and VS2010).

The issue of compatability was my first reaction too.

 Probably the module/code you are discussing is only used on BSD
 or there is an implementation of strlcpy  somewhere in net-snmp for systems 
 without.

The second is actually true.   (See snmplib/strlcpy.c)

I have no great preference between the two.
However a quick analysis of the current code base seems to
indicate an overwhelming preponderance of 'strlcpy' rather
than 'strncpy'

$ git checkout  V5-6-patches
$ find . -name \*.c | xargs grep strlcpy | wc -l
187
$ find . -name \*.c | xargs grep strncpy | wc -l
1
 (in snmplib/snmptsm.c)

$ git checkout  master
$ find . -name \*.c | xargs grep strlcpy | wc -l
185
$ find . -name \*.c | xargs grep strncpy | wc -l
6
 (four in ucd-snmp/dlmod.c,
  one in snmplib/sd-daemon.c, plus snmptsm.c)


For consistency, it would seem sensible to use the same
approach throughout  (always assuming that the null-terminated
assumption of strlcpy holds).

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: OID name to numeric mapping.

2012-08-07 Thread Dave Shield
On 7 August 2012 12:16, Siva Esana -X (sesana - Tech Mahindra at
Cisco) ses...@cisco.com wrote:
 I would like to know whether the net-snmp derives and keeps an array of all
 the OID names to OID number.

 I know a simple walk from the root will give all the OIDs implemented in
 this agent. But what I am interested is the OID name to numeric identifier
 mapping.

The mapping between numeric OIDs and MIB object names is handled by the
MIB files loaded by the client.   See the FAQ entry
   How do I add a MIB to the tools
for further details.

Note that the information returned by the agent is exactly the same.
regardless of whether or not the relevant MIBs are available to the client.
These MIB files are purely used for how the client application will
*display* the information returned from the agent.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: OID name to numeric mapping.

2012-08-07 Thread Dave Shield
On 7 August 2012 13:09, Siva Esana -X (sesana - Tech Mahindra at
Cisco) ses...@cisco.com wrote:
 The situation is we do not have MIB files as such and I want to generate the 
 MIB from the code.
 Some kind of reverse engineering the MIB to say...

If you don't have the MIB - then there is no way to (automatically) convert
OIDs to names.   That's the main purpose of the MIB file - without that,
there's nothing for the APIs to work with.

Is this a MIB module that your group has written yourselves?
Or is it something from elsewhere?
Do you have the source code for the MIB module, or just binaries?

What are the OIDs that you are concerned with?


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: OID name to numeric mapping.

2012-08-07 Thread Dave Shield
On 7 August 2012 15:59, Siva Esana -X (sesana - Tech Mahindra at
Cisco) ses...@cisco.com wrote:
 No, the MIB modules are written by my group.
 I have the source code.
 The OIDs that I am working are enterprises OIDs.

If these are enterprise OIDs being written by your own group,
then I would have though you'd need the MIB files in place before
you ever start writing code.
   The MIB is effectiovely your design document - it specifies
what the MIB module code needs to implement.   If you don't have
the design in place before you start, how can you write the code?

I know that our students have a tendency to write the code first,
and then put together the design documentation based on that.
But it's a bit worrying if the same sort of thing goes on in industry!

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: 5.7.2.pre3 published for testing

2012-08-06 Thread Dave Shield
On 5 August 2012 11:41, Bart Van Assche bvanass...@acm.org wrote:
 --- a/agent/mibgroup/utilities/execute.h
 +++ b/agent/mibgroup/utilities/execute.h
 @@ -4,8 +4,8 @@
  config_belongs_in(agent_module)

  int run_shell_command(char *command, char *input,
 -  char *output,  size_t  *out_len);
 +  char *output,  int  *out_len);
  int run_exec_command( char *command, char *input,
 -  char *output,  size_t  *out_len);
 +  char *output,  int  *out_len);


Doesn't this introduce a change in the API ?
As such, shouldn't it require a new name for these routines?
(perhaps with the old API retained as a compatability wrapper)

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: 5.7.2.pre3 published for testing

2012-08-06 Thread Dave Shield
On 6 August 2012 08:34, Bart Van Assche bvanass...@acm.org wrote:
 Doesn't this introduce a change in the API ?

 That change restores the API to what it has always been before July 30,
 2012 (see also commit 7374b84fe4c2ef8497fde3dae80a69aa89eba19c). So I'm
 not breaking the API but restoring it ...

Fair enough.
Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: How to convert Port_instance to portnumber

2012-08-02 Thread Dave Shield
On 26 July 2012 11:46,  najmudheen.thod...@emc.com wrote:
 I want to convert a port instance internal name to its corresponding port
 number.

 for example when I query a get Bulk for OID name  =fcsPortState

You need to consult the MIB file that defines the tables
and other objects that you are looking at.
For example, it appears that you are retrieving

CISCO-FCS-MIB::fcsPortState

which is part of the fcsPortTable.
One entry of this is:


fcsPortPhyPortNum  OBJECT-TYPE
SYNTAX   Integer32 (1..2147483647)
MAX-ACCESS   read-only
STATUS   current
DESCRIPTION  The physical number corresponding to this port entry.
::= { fcsPortEntry 5 }


Which appears to be the information you are looking for.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpwalk not working but snmpget is working on net-snmp 5.6.2

2012-08-01 Thread Dave Shield
On 1 August 2012 07:23, Madhu Sudhana Rao madhu...@gmail.com wrote:
 I think table is registering correctly, as I am getting snmpget output looks
 correct

Yes - that sounds reasonable.


   only problem is with snmpwalk and getnext

I see from your code that you are using the iterator helper.
This is designed to walk through the list of rows (using
your 'get_first/get_next' hook routines), identify the appropriate
row of the table for a GetNext request, and turn this into the
equivalent Get request before passing it on to the MIB handler.

So your myifTable_handler() will only ever see GET requests.


I presume if you issue a snmpget request for an entry in this
table, then you will see assorted in mode-get debug statements
printed by the agent.   Are you seeing these?

What happens if you issue a single snmpgetnext request for
the same MIB object?   Do you see any in mode-get output or not?

What about the 'get_first' debug statement?
Try running the agent using '-Dtemp':
   Do you see the 'if table get first' message with an snmpget request?
   Do you see it with an snmpgetnext request?




 I tried snmpwalk on nsModuleTable but I endup getting no such object for
 this OID even though I added agent_mibs.h for --with-mib-modules option.

You shouldn't need to give any additional options to configure.
nsModuleTable is part of the standard build.   So it's a little worrying
that you don't see it.


 I gave few more details in the attachment please check and give your
 suggestions/comments.

First thing - your MIB file looks broken.
From a quick glance:

  - The name of the MIB must start with a capital letter
(MY-MIB, rather than my-MIB)

  - The IMPORTS statement is incomplete.
There's a whole load of names (trapIdentifier, etc)
which are listed, but without the name of a MIB that
they are imported from.

  - The module is rooted at 'my', but this is never defined or imported
(I'm actually very surprised you were able to run mib2c at all!)

  - The SEQUENCE definition of the structure of a row of the table
 must start with a capital letter
(MyifEntry, not myifEntry)

  - myifTableIndex is defined as 'not-accessible' (which is correct)
but the code that registers the table has
   table-min_column = 1
i.e. implies that myifTableIndex *is* accessible
(again, this indicates a mis-match between this MIB,
 and whatever was passed to 'mib2c'

I *strongly* suggest that you run any MIB you are developing through
the smilint validation tool (or something similar) before trying to do
anything with it.   That will pick up these errors - and probably many
many more.



Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmp table entry creation - issue

2012-07-31 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]


On 31 July 2012 04:39, Rajeesh R rajeesh.thinkp...@gmail.com wrote:
 Hi,

 In my snmpd.conf file rocommunity: a SNMPv1/SNMPv2c read-only access
 community name  is commented one

[snip]
 # rocommunity: a SNMPv1/SNMPv2c read-only access community name
 #   arguments:  community [default|hostname|network/bits] [oid]

 #rocommunity  public

 # rwcommunity: a SNMPv1/SNMPv2c read-write access community name
 #   arguments:  community [default|hostname|network/bits] [oid]

 rwcommunity  public
 rwcommunity  private 192.168.3.163

OK - yes, that should allow write access.


 Please see my snmpd file below which is in /usr/local/share/snmp

So the config file is under /usr/local.
Is this an agent that you have compiled yourself?
Or are you using the vendor supplied one?


 While creating a table entry using the command
   snmpset -v2c -c public  192.168.3.163 .1.3.111.2.802.1.1.8.1.5.2.1.8 i 4

That OID isn't part of one of the standard MIBs.
(In fact, it looks extremely strange
  I have no idea who looks after .iso.org.111  !)

Is this a MIB module that you have developed yourself?
Or from somewhere else?
   Where did this MIB come from?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpwalk not working but snmpget is working on net-snmp 5.6.2

2012-07-31 Thread Dave Shield
On 30 July 2012 15:27, Madhu Sudhana Rao madhu...@gmail.com wrote:
 I replaced net-snmp version 5.2.1 to 5.6.2 which is working on all the
 tables but for one of the table,

Which table?
Is this one you wrote yourself, or part of the standard agent?


snmpget command is working 
 fine but
 snmpwalk command is giving  NO SUCH OBJECT ON THIS OID and for snmptable I
 am getting No entries.

What does 'snmpgetnext' report?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpwalk not working but snmpget is working on net-snmp 5.6.2

2012-07-31 Thread Dave Shield
On 31 July 2012 13:14, Madhu Sudhana Rao madhu...@gmail.com wrote:
   It is not part of the standard agent, I added this proprietary table.

 Copied .c and .h files of myifTable from (agent/mibgroup), which is working
 properly (both snmpget  snmpwalk) in version 5.2.1 to version 5.6.2 but in
 latest version only snmpget is working but snmpwalk is giving no such
 object. I didn't change anything related to .c and .h files.

Hmmm

Things to check:
- is your table getting registered correctly?
   (try walking the nsModuleTable and look for your OIDs)
   - are GetNext requests being passed to your handler routine?
   (try turning on any debugging within the handler)

What does the code of your MIB table look like?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmp table entry creation - issue

2012-07-30 Thread Dave Shield
On 30 July 2012 13:44, Rajeesh R rajeesh.thinkp...@gmail.com wrote:
 While creating a table entry using the command nmpset -v2c -c public
 192.168.3.163 .1.3.111.2.802.1.1.8.1.5.2.1.8 i 4
 I am geting a error like below

 Error in packet.
 Reason: noAccess
 Failed object: IEEE8021-CFM-MIB::dot1agCfmMdRowStatus

Have you checked the access control settings on the agent?
Please see the FAQ entry
Why can't I set any variables in the MIB?

In particular, note the last paragraph of that entry

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Snmp walk

2012-07-27 Thread Dave Shield
On 26 July 2012 16:44, Anthony Bush anthonybus...@gmail.com wrote:
 I need a bit of help with the snmpwalk command. Im trying to run a simple
 test on a network switch to see if the ports are on or off using snmpwalk
 but I can't seem to figure out the proper command to use in terms of the
 arguments and options that need to be included.

What are the command(s) that you are currently using?
If we know what you're trying, we can probably point out what is wrong.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Option to change the output format of the command line tools

2012-07-27 Thread Dave Shield
On 11 July 2012 23:56, Wes Hardaker harda...@users.sourceforge.net wrote:
 Andreas Köster andreas.koes...@web.de writes:

 -Op PRECISION_STRING
 which allows to change the default behavior and inserts this precision
 string into the sprintfs used for output.
 ...
 Another idea is to define a corresponding snmp.conf item.

 I think both options should be done and that sounds like a great idea!

This patch has now been applied to the trunk.

The only aspect that I'm not entirely convinced about is the handling
of command-line vs config file settings.   I can see why the patch is
written the way it is (and why this was probably necessary), but it
doesn't feel quite right.   And why it's needed here, but not for other
config/command-line settings.

But that's a discussion for another time

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-snmp compilation errors

2012-07-26 Thread Dave Shield
On 26 July 2012 09:11, Madhu Sudhana Rao madhu...@gmail.com wrote:
 Problem is if I comment interface line, I am getting no such object
 available at this OID for one my properity table which is related to
 ifTable.

OK - please post the code for your properity table
(as attachments), so that we can take a look at it

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-snmp compilation errors

2012-07-25 Thread Dave Shield
On 25 July 2012 06:51, Madhu Sudhana Rao madhu...@gmail.com wrote:
 I replaced my old net-snmp (5.2.1) to 5.6.1.

 With old version 5.2.1 I didn't have any issues but with new version while
 compiling I am getting errors,

What O/S distribution (and version) are you working with?
What was the full configure command you used?

It's probably not relevant to this particular problem, but you
might want to consider using 5.6.2 instead (which was just
released last week).

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-snmp compilation errors

2012-07-25 Thread Dave Shield
On 25 July 2012 09:50, Madhu Sudhana Rao madhu...@gmail.com wrote:
 Coming to net-snmp issue:
 I am using my_mibs.h file in the agent/mibgroup to configure net-snmp
 modules and my project related modules, where it has both lines...

 config_require(if-mib/ifTable)
 config_require(mibII/interfaces)

No - that won't work.
These are two alternative implementations of the same table.
Use one or the other - not both.



 I commented interfaces, now it is compiling without any issues.

 Any side effect, if I comment *config_require(mibII/interfaces)*

No - that will work fine.

Strictly speaking, the best thing would be to require 'mibII/ifTable'
which will then pull in one or the other of these two versions,
depending on how the build configuration is set up.
   But pulling in if-mib/ifTable directly will work too

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Implementing IP-MIB UDP-MIB Standard mibs

2012-07-23 Thread Dave Shield
On 23 July 2012 07:52, Madhu Sudhana Rao madhu...@gmail.com wrote:
 I want to implement udpEndpointTable of UDP-MIB.txt.

Why?
There is already an implementation of this table
(The code for this is under 'mibgroup/udp-mib/udpEndpointTable')
Why repeat something that has already been done?



 I found that there are some files (below) missing in
 agent/mibgroup/udp-mib/data_access for the same
 udp_endpoint_linux.h
 udp_endpoint_ioctl.h

There is no explicit architecture-specfic header files,
because there are no architecture-specific interfaces
that need to be exported.
   The only routines in the code files tend to be the
common architecture-specific hooks (defined in
udp_endpoint_private.h),  and a handful of static
internal routines.   Being static, there's no point in
declaring these in a header file!




 Where as I found similar files for IP-MIB in
 agent/mibgroup/ip-mib/data_access
 ipaddress_linux.h
 ipaddress_ioctl.h

  Have you tried looking at the contents of these files?
The linux-specific header file is basically just pulling
in the ioctl module.
The ioctl header file is defining various structures and
interfaces that the linux code will need to use.
The implementation is not all contained within a single
code file, so *does* need to declare things for external use.



 my question is without these files can we implement udpEndpointTable of
 UDP-MIB and IpSystemStatsTable of IP-MIB ?

My question is - have you actually tried compiling the code?
You should find that yes - it *is* possible to implement these
tables with the files as they currently stand.
   And the existing code does precisely that!


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: 答复: check snmp storage have problem.

2012-07-23 Thread Dave Shield
On 23 July 2012 02:12, robin yin robin@asiantrailschina.com wrote:
 # snmpwalk -v 2c -c public 10.101.161.131 .1.3.6.1.2.1.25.2.3.1
 hrStorageDescr.4 = STRING: E:\ Label:data  Serial Number 88074d8d
 hrStorageAllocationUnits.4 = INTEGER: 4096 Bytes
 hrStorageSize.4 = INTEGER: 78642183
 hrStorageUsed.4 = INTEGER: 56748751

 The value is correct.  Used/Total Size is around 70-80%.

Good - so our software is reporting things correctly.


 But in nagios it display as 18% used.

I suggest you take this up with the Nagios people.
They understand their software better than we do,
and are more likely to be able to explain/fix this problem.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Implementing IP-MIB UDP-MIB Standard mibs

2012-07-23 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]


On 23 July 2012 09:59, Madhu Sudhana Rao madhu...@gmail.com wrote:
 In my current project we are using net-snmp 5.2.1 version which didn't have
 udp-mib support.

That version is something like 7 years old, and is no longer supported.


 My task is to add udpEndpointTable of UDP-MIB, for that I downloaded latest
 5.6.2 version

If you've got a more recent version, why not use that?
There are a *lot* of bug fixes that have gone in since then.

 .   and copied all the required files to agent/mibgroup/.

That's too vague to be helpful.
Exactly what files did you copy across?
   Did you select individual files from the mibgroup tree,
or did you copy across complete directories?   Which?

What about the files in the 'include' tree?



 I looked into udpEndpointTable_data_access.c, line #14 and found the
 following line ...

 #include net-snmp/data_access/udp_endpoint.h

 I am not getting why this line is giving error!

Probably because you haven't copied it across.
(It's part of 5.6.x but not in 5.2.x)

Note that the filename is enclosed in angle brackets, not quotes.
As such, it indicates a header file that will be _installed_
(i.e. under the 'include/net-snmp' tree) rather than one from
the agent source code tree.
   I suspect you simply didn't copy these additional header files across.


However I would strongly encourage you to look at switching
to the 5.6.2 version entirely, rather than trying to back-port
individual elements into an obsolete release.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re:

2012-07-20 Thread Dave Shield
On 18 July 2012 08:41,  najmudheen.thod...@emc.com wrote:
 To reproduce an  issue ,we want  to introduce delay on how Switch(SNMP
 agent) responds when SNMP calls are made from our SNMP manger.  Is there any
 config change will do it from switch/agent side.

I don't believe so, no.
You are probably going to have to write code to do this.

Either within the relevant MIB module handlers (if you want
delays for particular MIB objects), or within a routine such
as netsnmp_agent_check_packet() if you want this applied
to all requests.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: check snmp storage have problem.

2012-07-20 Thread Dave Shield
On 17 July 2012 10:48, robin yin robin@asiantrailschina.com wrote:
 When I use check_snmp_storage script to check windows server 2003’s storage,

That's not part of the Net-SNMP suite, so it's a bit difficult to
know exactly what it is doing.


 I found the percentage is not correct on E drive. But on the other it is ok,
 can you tell what is wrong?

Try using the 'snmpwalk' command to retrieve the underlying data
for the filesystem in question.  What values do you get?
  How do these compare with the actual figures for that disk?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Embedded linux install

2012-07-20 Thread Dave Shield
On 2 July 2012 12:50, Scales, Neil neil.sca...@dmh-global.com wrote:
 I’m trying to install net-snmp 5.7.1 on an embedded linux system (fedora 7).
 There aren’t any binaries on sourceforge for 5.7.1

 I can’t do “yum install” or “rpm get” or whatever, so I need to transfer the
 required files manually.

 Is there some resource somewhere that shows what is required?

The simplest would probably be to use the example spec file to
build your own RPM packages.   That's typically safer than trying
to copy files individually.
   See dist/net-snmp.spec as a possible starting point.

There should be some instructions on building an RPM version on
the project wiki

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: got a Do command in h file

2012-07-20 Thread Dave Shield
On 2 July 2012 08:09, Chris Cossman crcgrap...@gmail.com wrote:
 What is Do the .h file refer to?

This is a comment within the 'mib2c' template - not the header file.
It's indicating that this is the part of the template which generates
the .h file

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Using Context-Name in Snmpv3 returns Authorization Error

2012-07-19 Thread Dave Shield
On 19 July 2012 15:55,  basil.jos...@wipro.com wrote:
 I am using VACM approach


 My snmpd.conf file without contextname
 createUser V3User MD5 Password
This really belongs in the /var/net-snmp/snmpd.conf  file


 com2sec V3User default community
This is not relevant for SNMPv3
It's concerned with mapping from community strings to (internl)
security names - and hence only applies to SNMPv1/2c


 group v3_group usm V3User
 view v3_view included .1.3.6.1
 access v3_group  any authNoPriv  exact  v3_view v3_view all

Those are the important bits.



 After reading the man page for snmpd.conf I modified the file as below
 createUser V3User MD5 Password

 com2sec –Cn context-name V3User default community
 Not relevant (see above)

 group v3_group usm V3User
 view v3_view included .1.3.6.1
 access v3_group context-name any authNoPriv  prefix  v3_view v3_view all

Yes - that looks right.
The one thing that I'd suggest would be to have this
*as well* as the original access line - to allow the agent
to be queried without a context, as well as with it.
   As it stands, the agent will *only* respond to requests
with this context - the default context is not authorised.


 proxy -Cn context-name -v 3 -u V3User -a md5 -A Password -l authnopriv 
 localhost .1.3.6.1

Hmmm...   you are taking any requests received for .1.3.6.1 (with the
specified context)
and passing them back to the same agent (but with the default (empty) context)
So it's the same agent answering with the same information.
The only difference is the lack of an explicit context.
Is that correct?


In which case, you almost certainly do need the access control settings
to allow requests with the default (empty) context.
   Try with the two access lines.


 Now I modified the snmpd.conf file as above
 Now the application shows   “ Timeout: No Response from 10.140.185.228.”

What *exactly* is the request that the application is sending?
Have you tried querying the agent using the Net-SNMP command-line tools?
That might be useful while you're trying to get things responding properly.


 The second line I think is SecEngineId Discovery.

Actually, I suspect the first packet is the engineID discovery,
and the second one is the request itself.

 The third line I believe it forwards the packet to itself and may be drops
 it inside.

Yes - that looks like the proxy forwarding the request to itself.


 If I remove the proxy part from snmpd.conf, this third line won’t be
 printed. But same timeout will happen

It's very difficult to suggest what's happening, without knowing
the exact SNMP requests that are being sent.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Tables and Indexes

2012-07-09 Thread Dave Shield
On 9 July 2012 06:41, Harvey Shepherd harvey.sheph...@aviatnet.com wrote:
 I’m trying to design a MIB that contains two tables as follows:
[snip]
 Is it valid to define a table that is indexed by an external table’s object
 that is not itself an index (hwAlarmDescPrivileged)?

 Any advice greatly appreciated.


I'm not sure offhand whether it's valid or not.
But my immediate reaction would be to structure the indexing
of the two tables in the same way.
i.e.
hwAlarmDescTable
(indexed by hwAlarmDescPrivileged, hwAlarmDescIndex)

hwAlarmStatusTable
(indexed by entPhysicalIndex, hwAlarmDescPrivileged, hwAlarmDescIndex)
   or by hwAlarmDescPrivileged, hwAlarmDescIndex, entPhysicalIndex)


Whether you define the second table using (hardware/alarm) or (alarm/hardware)
will depend in part on how it's expected to be used.
   The second might well be easier from an implementation point of view - but if
you're mostly going to be looking at all the alarms for a given piece
of kit (rather
than all the boxes exhibiting a particular characteristic), then the
first approach
might make more sense.

But it you want to use hwAlarmDescPrivileged as an index in the Status table,
then I'd make it one in the Desc table as well.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-SNMP Significant Figures

2012-07-06 Thread Dave Shield
On 5 July 2012 22:28, Alex Zannos azan...@stanford.edu wrote:
 I am trying to use the snmpgetx method

Where did you find mention of this method?
What package are you using?

I've just done a search of the Net-SNMP source code,
and there's absolutely no mention of the name snmpgetx
anywhere within our code, or documentation.

  In fact, a Google search for this term reveals it only ever
appears within the W-Ie-Ne-R MPOD Power Supply System
documentation.   Unless this is a typo, it may be a private
extension made by them to the standard Net-SNMP code.
  If that's what you are using, then I suggest you talk to
them about this.

   If not, then perhaps you could give us more information
about exactly what you are trying to do.
But the standard Net-SNMP suite does not have any
concept of high precision commands or methods.
We certainly haven't defined any form of snmpgetx


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Received response for SNMPv3 inform; but Agent still sending inform for the number of retries configured.

2012-06-20 Thread Dave Shield
On 20 June 2012 15:56, Suresh kumar skjaiswa...@hotmail.com wrote:
 Following is the snmpd.conf configuration:

 trapsess -v 3 -Ci -r 1 -t 5 -e 0x80001f8880386a8adc0005946b -n  -a SHA -A
 mypassword -l authNoPriv -u traptest 192.168.101.226


and the snmptrapd.conf configuration?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: CFV: fix bug 3532090 and high-index crashes in hrDeviceDescr

2012-06-19 Thread Dave Shield
On 18 June 2012 23:10, Wes Hardaker harda...@users.sourceforge.net wrote:
 Patch #1 is simple and just increases the shift variable allowing
 for 16 bits of index values instead of the previous 8

+1


 Patch #2 is a bit more complex and creates new integer based index
 API for retrieving indexes and then ensure that they're  2^SHIFT.

Hmmm that's a trickier one.

It's a bit more complex than ideally I'd like at this stage,
but in general I'm tempted to say yes.
  But there are a couple of points of concern:

 -  in the various compatibility routines, there's a statement

*Index = returnIndex;

 Is it safe to assign an 'int' value to a 'short*' without masking
the value to 16bits?

 -  in the header file, mibII/interfaces.h, the declaration of
Interface_Scan_NextInt has a first parameter of type 'Int'
Shouldn't this be 'int'  ?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: CFV: fix bug 3479740: mibgroup/host: fix hrSWRunPerfCPU and hrSWRunPerfMem for Linux

2012-06-19 Thread Dave Shield
On 18 June 2012 19:19, Niels Baggesen n...@users.sourceforge.net wrote:
 The attached patch is a modified version of the patch attached to the bug.
 In addition to finding the right data, it also uses atol to fetch the data
 instead of atoi. And then it adds the proper scaling to the cpu value ...

I'm inclined to vote for, but one question - why is the 'cpu' variable
defined as long long rather than long ?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: CFV: fix bug 3532090 and high-index crashes in hrDeviceDescr

2012-06-19 Thread Dave Shield
On 19 June 2012 23:22, Wes Hardaker harda...@users.sourceforge.net wrote:
 Any reason for adding the extra api? I would say this is a private api
 for snmpd, so we are free to change it

 I'm pretty sure the interface scanning APIs are heavily used in
 3rd-party apps that extend the ifTable.  There are zillions of MIBs that
 extend the ifTable and it's a commonly used approach.

I'd agree - it's a relatively small overhead to include the
compatibility routine,
and the dangers of breaking things without it are too great to risk.

I might question whether we need several copies of essentially the
same code in different files,  but that may well be the safest way
forward - at least in the short term.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Help with creating a dymically loaded module

2012-06-18 Thread Dave Shield
On 13 June 2012 19:18, Cyrus Virus utnubu...@gmail.com wrote:
 I can compile the code using the make file, but when I try to run it I
 get this error:

 sudo snmpd -f -L nstAgentPluginObject.so, dldmod

Where did you find that command?
The instructions for loading the dynamic module in the tutorial
you mentioned explain:

  a)  how to load it via SNMP SET commands
  b)  how to load it via the snmpd.conf file

There's nothing in those instructions about supplying the name
of the plugin object file on the command line.

Try following the instructions at
   
http://www.net-snmp.org/wiki/index.php/TUT:Writing_a_Dynamically_Loadable_Object#Loading_via_the_snmpd.conf_file

and then restart the agent.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Wrong example

2012-06-07 Thread Dave Shield
On 6 June 2012 15:36,  reyn...@free.fr wrote:
 Hi

 the example

 http://www.net-snmp.org/tutorial/tutorial-5/toolkit/mib_module/nstAgentModuleObject.c

 Work with the snmpget -v2c -c tutget localhost: 
 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 command

 but fail with

 snmpset -v2c -c tutset localhost: 
 NET-SNMP-TUTORIAL-MIB::nstAgentModuleObject.0 = 5

I presume this is on a 64-bit system?


 the reason is the int type, it could be nice for beginners to replace the 
 file with a working one,
 like the one in attachement which replace int by long.

Now fixed.
Thanks for the reminder

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Empty response when querying UCD-SNMP-MIB memAvailReal.0

2012-05-29 Thread Dave Shield
On 21 May 2012 13:50, Jehan Badshah jehan.bads...@nu.edu.pk wrote:
 I have installed Net-Snmp 5.2.1 on windows 2003 server

First thing - that's a very old version of the agent (2005!),
and the 5.2.x line is no longer being actively supported.
Can you try with something a little newer?


 and configured snmpt agent on 192.168.100.88

 When I run following command then getting empty response for UCD-SNMP-MIB
 snmpwalk -v 1 -c community 192.168.100.88 .1.3.6.1.4.1.2021.4
 End of MIB

How have you configured the agent?
In particular, what access control settings do you have?
   (See the FAQ or snmpd.conf(5) for more details)

What information *can* you see.
Can you retrieve anything from the enterprises tree at all?
  (try snmpgetnext  .1.3.6.1.4)


 when I run following command
 binsnmpget -v1 -c community 192.168.100.88 memAvailReal.0
 Error in packet Reason: (noSuchName) There is no such variable name in this
 MIB. Failed object: UCD-SNMP-MIB::memAvailReal.0

 What I am missing ?,

  should I install UCD-SNMP-MIB on host or client, but how ?

The UCD-SNMP-MIB is installed OK on the client side
Note that the name 'memAvailReal' is recognised,
and reported back using the MIB module qualified form.
   And the agent doesn't really need the MIB files at all.

The problem will either be access control settings on the agent,
or the lack of implementation code for that particular object
on your O/S.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: About Standard MIBs

2012-05-29 Thread Dave Shield
On 28 May 2012 06:55, Madhu Sudhana Rao madhu...@gmail.com wrote:
 I am using Linux Ubuntu 11.04 system.

 In my current project we are using net-snmp 5.2.1 (old) version which didn't
 have UDP-MIB.txt and some part of IP-MIB.txt implementation code.

 I took this implementation code from the latest net-snmp 5.6.1.1 for IP-MIB
  UDP-MIB for the tables ipSystemStatsTable or udpEndpointTable and added to
 the old working version.

Is there any reason not to switch completely to the newer agent?
I would have thought that would be easier than trying to merge elements
of the newer code into the older agent.  (And given that this didn't seem to
work for you, that would seem to back this up!)

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: SNMP table: How to handle empty table cells?

2012-05-29 Thread Dave Shield
On 29 May 2012 11:32, Holger Klaas holger.kl...@gmail.com wrote:
 I am trying to implement an SNMP table which can monitor several
 inputs. The table looks like this:

 Column1: inputNumber (table index: 1,2,3 ...)
 Column2: inputStatus  (disabled, signalLoss, signalPresent)
 Column3: inputFlowId  (unsigned32)
 Column4: inputFlowBitrate  (integer32)

 When the inputStatus is disabled or signalLoss, the columns for
 inputFlowBitrate and inputFlowId don't really make sense. For bitrate
 I could just return 0. But what about the Flow ID (A 32 bit unsiged
 integer where all possible values could be used as flow ID)? I can
 think of 2 solutions:
 1. return 'no such instance' for those columns
 2. Just return anything and expect the manager to check inputStatus
 first before processing the remaining columns

The two most natural approaches would be to either return
noSuchInstance or a special invalid value
(typically 0 or -1, or possibly 2^32-1)


 How is this handled best? I am not sure if solution 1 is allowed in
 SNMP. I.e. is it allowd to have table rows where some columns are
 present and others not?

Yes - that's perfectly valid.
(Although it might confuse some client applications).


 Are there any other ways how this could be handled?

I think my inclination would be to return a designated value,
and document this behaviour within the MIB description.
Preferably a value that is unlikely to occur - even if it's
potentially possible.   The client application can still check
the value of inputStatus to distinguish between the two cases.

It's the difference between

GET   status,  flowID
if ( status !OK )
   return invalid
use flowID

and

   GET flowID
   if ( flowID == 2^32-1)   // or whatever
   GET status
   if ( status !OK)
   return invalid
   use flowID

Though either approach would work fine.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Snmp message format

2012-05-28 Thread Dave Shield
On 28 May 2012 14:13, Jasti Durgashree shreemo...@gmail.com wrote:
 I want to write my own c code for snmp message format.

Why?

 So which file I
 should refer in net-snmp directory to write my own snmp header and pdu
 format code and also how to map asn.1 data types with normal data types in
 coding

snmplib/snmp_api.c(snmp_build)  and snmplib/asn1.c


But I'd strongly recommend that you don't try to re-invent the wheel.
Why not simply use the routines that are provided?
Are you intending to re-implement the whole of the C library as well?

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Snmp message format

2012-05-28 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]


On 28 May 2012 15:12, Jasti Durgashree shreemo...@gmail.com wrote:

 Thanks for reply , actually I want to use pcap so I need to do only message
 format.is there any alternate method to add snmp message with payload
 using pcap?  And also how to add source and destination mac address to snmp
 message?

I've not tried to do anything with pcap and SNMP myself
(since Wireshark already understands the SNMP format)

But I suspect that
http://thewalter.net/git/cgit.cgi/bsnmp-pcap/
might actually be easier place to start from.

Unless anyone else has a better idea

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: CFV: Include patch 3526599 in 5.{4,5}.2 releases

2012-05-24 Thread Dave Shield
On 23 May 2012 20:51, Niels Baggesen n...@users.sourceforge.net wrote:
 Btw, haven't you forgot to git push after applying patch 3525998?
 I have two fixes in the queue for 5.5 and 5.6

Apologies - now pushed.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


CFV: Include patch 3526599 in 5.{4,5}.2 releases

2012-05-22 Thread Dave Shield
I'm just getting ready to roll out the rc2 versions of these two releases,
and have been looking through the recent Bug and Patch trackers entries,
to see whether there's anything been reported that needs fixing first.

The above mentioned patch is the main one that caught my eye.
It looks a fairly simple change, that marks an outstanding SNMPv3
request as finished if it receives too many invalid Response PDUs
(rather than waiting indefinitely).
   It strikes me as possibly worth including in the upcoming releases.

What do people think?

See 
http://sourceforge.net/tracker/?func=detailaid=3526599group_id=12694atid=312694

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Issues using Active Monitoring, DisMan and Process Table together

2012-05-20 Thread Dave Shield
On 19 May 2012 12:41, Douglas Hubler doug...@hubler.us wrote:
 In short, the prErrorFlag flag in the prTable had to transition like so

 prErrorFlag values:
   0  = 1 = 0 = 1    OK - prFixIt event fired on each transition from 0 to 1
   0  = 1 = 1 = 1    Not OK - prFixIt event only fired once

That's correct.   This is the defined behaviour of the mteTrigger table
as defined in RFC 2981.   See the third paragraph of the DESCRIPTION
of mteTriggerTest


 I checked the value of mteTrigger-flags and bitmask
 MTE_TRIGGER_FLAG_DELTA was *not* set (actual value was 00110010)
 but it acted like mteTrigger.c needed a change to actually fire the
 event.

That's not what the delta flag means.
A monitor entry with this flag set is implementing a trigger with
a mteTriggerSampleType value of deltaValue (rather than absoluteValue)
This means that it will be looking at the _difference_ between successive
readings of the MIB object being monitored, rather than the actual values.

This is most commonly used when monitoring a counter-based object
(such as if{In,Out}Octets)



 What I think is happening is there's logic to not try to send the same
 event twice.

That is correct  -  this is exactly what is required by the DisMan
Event MIB specification.


 There's an additional concern though!  The process table
 is cached

I believe that actually depends on how the agent has been compiled.
The traditional implementation of the process table (i.e. not linked in
with the hrSWRunTable) will query the underlying kernel afresh every time.

  But yes - the current hrSWRunTable implementation does use a cache
to hold this data, and the process table handling will use this cached data
(to provide a consistent behaviour between the UCD-specific and IETF
standard semi-equivalent tables)

   so even if find a way to fire prFixit events on each monitor
 run, I'll be firing events based on values in the process cache, not
 the actual process list from the OS so if the process does start ok,
 I'll be attempting to start the process unnecessarily.

Remember that you can always control the cache timeout - either
reducing it to something fairly small (e.g a few seconds, rather than
the default of 30s),  or setting it to 0 to disable caching altogether.
   Naturally, there's a performance hit if you do this - but the
choice is yours.

See the NET-SNMP-AGENT-MIB::nsCacheTable for details

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: UCD proc agent sending alarms

2012-05-15 Thread Dave Shield
On 15 May 2012 17:02, Douglas Hubler doug...@hubler.us wrote:
 Oh right, I can either wrap my commands that restart processes with a trap
 command, thanks!

That should work, yes - but I don't think it's what Richard meant.

The DisMan Event MIB is designed to detect interesting events,
and:
a)  trigger an internal SET request
 (which you are currently using to fix the problem)
or
b)  send a notification
  (which you were asking about)

I've never actually tried to have one monitor line trigger both
types of event, but it might work.   At the very least, you could
have two monitor entries - one to send the trap, and one to
apply the fix.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: What's the best way of finding out what's changed and why?

2012-05-09 Thread Dave Shield
On 9 May 2012 12:12, Lewis Adam-VNQM87 adam.le...@cambiumnetworks.com wrote:
 I am trying to determine exactly what code changes have occurred between
 2 different releases (including all releases in between).

That's exactly what ChangeLog is for.
It lists all the commit log messages, together with the files affected.

CHANGES is designed to extract information about the more
important changes, including those affecting tracker entries,
but relies on the person making the fix to adopt a particular
style of log entry.   Inevitably, some of these will be missed.
   But ChangeLog is completely automatic, so is much more
comprehensive.


Ideally, I
 would like to end up with a list of patch and bug references per file.

The best way of seeing what changes have been made to
a particular code file would be to browse the on-line Git
repository.   The 'tree' view shows each individual file, including
a 'history' link, listing all of the changes that have been made
to that particular file.




 Are changes ever made that don't have a patch or bug reference?

Frequently!
If you look at ChangeLog, you'll be able to see the entries that
reference tracker entries from the Bug or Patches trackers.
And these are only a relatively small fraction of the overall
code changes.

  Sometimes we'll be fixing a problem that we've come across,
that hasn't been reported via the trackers.   Sometimes it will
have been reported, but we haven't spotted that entry at the
time we fix the problem.  Sometimes there's be a tracker entry
reported for a problem that has already been fixed.
   And sometimes we'll just forget to reference the tracker entry
that we've been working on.

CHANGES is a reasonable indication of which entries have
been addressed, and when - but it's not necessarily comprehensive.

I have
 looked at the ChangeLog and CHANGES files as well as the tracker for
 bugs and patches but I can't find an obvious way of getting a definitive
 summary which references all the changes that have occurred. Is this
 possible?

ChangeLog and the Git repository history are the best definitive summaries.
But they won't necessarily link in with Bug and Patches tracker entries.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: What's the best way of finding out what's changed and why?

2012-05-09 Thread Dave Shield
On 9 May 2012 12:48, Lewis Adam-VNQM87 adam.le...@cambiumnetworks.com wrote:
 Dissecting the ChangeLog, a typical couple of entries might be:

 2011-09-22  Dave Shield d.t.shi...@liverpool.ac.uk

   * : commit c55f608f16f160f5e79dc057f8878def462973e1 Author: Dave
  Shield d.t.shi...@liverpool.ac.uk Date:   Thu Sep 22 10:35:24 2011
  +0100

That's actually a truncated version of the full log message:


commit 07f61a02a2409096e5c962cd211126396ad09d2b
Merge: ee0d3ad bda324b
Author: Dave Shield d.t.shi...@liverpool.ac.uk
Date:   Thu Sep 22 10:39:59 2011 +0100

Merge branch 'V5-5-patches' into V5-6-patches

* V5-5-patches:
  Fix the code for populating the table_tdata cache, and clarify
areas needing MIB-specific additions.

which tracks back to:

 2011-09-22  Steve Friedl st...@unixwiz.net

   * agent/mibgroup/ucd-snmp/disk_hw.c: CHANGES: snmpd: 3409692:

or in full

commit ee0d3adb078291b743c9ecb76d20b591b7b15972
Author: Steve Friedl st...@unixwiz.net
Date:   Thu Sep 22 09:58:39 2011 +0100

CHANGES: snmpd: 3409692: Calculate disk percentage usage via
floating-point arithmetic
to avoid integer overflow errors.
(Code based on the submitted patch, rather than applied verbatim)


We switched from SVN to Git in June last year, and I have a feeling
that it took a while to get the most sensible form of log messages
(in a form that the ChangeLog generation script could do something with).

It may be that this was one of the less-informative entries!


I doubt it's safe to ignore any ChangeLog entries, without having
a clearer idea of what they affected.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: setting snmp source port number

2012-05-06 Thread Dave Shield
On 6 May 2012 06:25, Magnus Fromreide ma...@lysator.liu.se wrote:
 On Fri, 2012-05-04 at 09:05 +, Durga Sree wrote:


 Is it possible to set specified source port no. instead of available
 source port no.?

 It depends on the protocol. For UDPIPv4 the answer is no.

Are you sure, Magnus?

I haven't played with this myself, but I thought that was the purpose
of the 'clientAddr' config directive.   The documentation certainly talks
about setting the transport address, which would normally  cover
the source port as well as IP address.

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: resourceUnavailable error: when to use?

2012-05-03 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]



On 3 May 2012 08:18, Giuseppe Modugno g.modu...@elettronika.it wrote:
 Il 02/05/2012 23:50, Dave Shield ha scritto:
    (You could perhaps make a case for returning noSuchInstance,
 but genErr is probably less misleading)

 With genErr error code there is another problem: the walk (GET NEXT) stops
 on the first variable related to the fault hardware sub-module. All the next
 variables, even not related to the same fault sub-module, won't be retrieved
 with a walk.

If that's the behaviour you require, then the best approach is to return
'noSuchInstance' for such unavailable values.   A GETNEXT request will
then simply skip over this entry, and return the next valid varbind.
   The effect is to return a table containing holes.



 Another similar question.  I want to manage a GPS receiver through SNMP.
  There are many info detected by it: position (latitude and longitude),
 actual time, number of tracked satellites and so on.  I can associate an OID
 for each interesting piece of data.
 Unfortunately sometimes the GPS receiver can't locked (few satellites in
 view or just after startup) so it can't send valid informtions for time and
 position. What could be the correct behaviour of the agent in this
 situation?  What to answer to GET request when the GPS receiver isn't
 locked?

Probably the same as above - noSuchInstance.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: problem with snmpset

2012-05-03 Thread Dave Shield
On 3 May 2012 05:01, Durga Sree durga.s...@lnties.com wrote:
 Am able to solve that problem if i run with sysName am getting the correct 
 result
 but when i use other objects am getting the following error

 root@newuser-desktop:/home/newuser# snmpset -v 2c -c private localhost 
 sysName.0 s office
 SNMPv2-MIB::sysName.0 = STRING: office

Note :   this request is being sent to 'localhost'

 root@newuser-desktop:/home/newuser# snmpset -v 2c -c private XXX-MIB::XXX.0 i 
 4
 i: Bad object type: 4

while this request is being sent to the host called XXX-MIB:XXX.0


 root@newuser-desktop:/home/newuser# snmpset -v 2c -c private sysORUpTime.4 t 
 10:01:11:00
 t: Bad object type: 1

 snmpset -v 2c -c private XXX-MIB::XXX.0 s office (here am giving 's' 
 instead of 'i' just to check which error i get)
 s: Needs value

Same here.


 so can anyone pls help where i went wrong?

You need to tell the snmpset command where to send the request.
It doesn't remember this from one invocation to the next!

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: resourceUnavailable error: when to use?

2012-05-02 Thread Dave Shield
On 2 May 2012 10:20, Giuseppe Modugno g.modu...@elettronika.it wrote:
 Robert suggested to use SNMP_ERR_RESOURCEUNAVAILABLE in response to GET
 requests of variables related to malfunction hardware sub-sections.

 Recently I was reading RFC 3416 (Version 2 of the Protocol Operations
 for the Simple Network Management Protocol (SNMP)) where there is the
 explanation of resourceUnavailable error. It seems it should be used in
 answers to SET requests, and not GET. It seems the genError is a better
 error code for GET response messages.

Yes - having looked at the RFC, I would tend to agree.
resourceUnavailable is only relevant when processing a SET request.
For problems encountered when processing a GET request, genErr is
the more appropriate error.
   (You could perhaps make a case for returning noSuchInstance,
but genErr is probably less misleading)

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: doubt with generating the template code for eg:ifTable ifEntry

2012-05-02 Thread Dave Shield
On 1 May 2012 17:50, Robert Story rst...@freesnmp.com wrote:
 On Tue, 1 May 2012 09:03:55 -0400 Jasti wrote:
 JD Instead of generating template code for ifTable (eg:) if we generate code 
 
 JD adding necessary logic to the ifEntry code makes any difference?
 JD Because am comfortable with scalars rather than tables...

 I don't know that it's been tried yet, but I suppose it might work. I don't
 really recommend it, but you can try it and see. The code generated by
 the mib2c.scalar.conf config won't deal with indexes, so you'll have to manage
 that yourself.

Please remember that the code generated by mib2c.scalar.conf is
dealing with scalar *objects*, not scalar instances.   So it will be
checking for an instance subidentifier of 0,  and rejecting anything else.

If you try using this template for processing a element within
a table (which won't have this .0 instance subidentifier), then you're
likely to run into major problems.

As Robert said, this is a somewhat idiosyncratic approach,
and you'll be pretty much on your own.   But if you go down
this route, make sure you use netsnmp_register_instance
rather than netsnmp_register_scalar

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: problem with snmpset

2012-05-01 Thread Dave Shield
On 1 May 2012 13:15, Jasti Durgashree shreemo...@gmail.com wrote:
   I am facing a problem with snmpset, even though i have defined my mib
 object to be read-write am getting the following problem
  so can anyone please help?

Check the access control settings for your agent.

From the FAQ:

Why can't I set any variables in the MIB?


  There are three possible reasons for this:

  Many MIB objects are defined as read-only and inherently cannot be
  changed via SET requests.  Attempts to do so will typically be rejected
  by the 'snmpset' command without ever being sent to the agent.

  Of those objects that can in principle be changed, the agent may not
  include the code necessary to support SET requests.  (GET and GETNEXT
  are much easier to handle - particularly for objects relating to the
  internals of the underlying operating system).

  Even if SET support has been implemented, the agent may not be configured
  to allow write access to this object.

Ready-installed distributions (such as those shipped with Linux) tend
  to be configured with read-only access to part of the mib tree (typically
  just the system group) and no write access at all.

  To change this, you will need to set up the agent's access control
  configuration.  See the AGENT section for more details.

Note that neither the community string public nor private can be
  used to set variables in a typical default configuration.


Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Counter32 and Counter34: read-only/accessible-for-notify only

2012-04-24 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]


On 23 April 2012 18:11, Lawrence Widman wid...@cecst.com wrote:
 Dave,

 Many thanks for your reply. Please forgive my ignorance: I'm new at
 this. I am writing an agent that accepts the status of a network device
 and makes it available to a monitoring system. If counters cannot be set
 by any process, how are the values updated?

It's not that counters cannot be set by any process.
Rather that they cannot be set via the SNMP SET request.

  snmpd has to be getting the
 information from someplace, I would think. I searched the RFC for every
 occurrence of counter and did not find any explanation of how counters
 get updated,

That doesn't really surprise me - the RFCs are purely describing
the operation of the SNMP protocol (and syntax of the MIB files).
They are concerned with how the management information is
used - not how it is obtained in the first place.

 ...  and looked at google without result.  One possibility is
 that another variable accepts a rate and the extended agent adds the
 rate to a given counter, but if that were the case one would think the
 standard would allow pairing of the two variables.

Take a step back (TM),  and think for a moment about what problem
SNMP is trying to address.   The network manager needs to know
what's happening on their network - to find out information about the
systems they are looking after.Counters are typically used to monitor
how many times something has happened - whether that's something
unusual or unexpected (how many times the building has caught fire),
or something perfectly normal (the number of packets sent on a given
network interface).
In both cases, this information will be stored somewhere (the safety
log, or an internal field in the relevant kernel driver).All that the agent
is doing is retrieving this value from the underlying subsystem, and
passing it on to the network administrator in a standard form.

So the counters will be maintained and updated by the underlying
subsystem.   And similarly for all the other MIB variables.
   This is an important point - the agent is *not* typically responsible
for maintaining the values that it reports.  It's simply a middle-man.
It may keep a local cached copy of this data (e.g. network statistics
or the routing table),  but this would be purely for performance reasons.
The source of the data would be the underlying subsystem, and it's
_this_ that is responsible for maintaining it, updating counters, etc.

OK?



 I understand if you do not have time for dumb questions.  If so, please
 accept my thanks for the information you provided.

Don't worry about it.  As I keep telling our students, I like easy questions.
I can answer easy questions.   It's the hard ones that are more of a problem.

And the only dumb question is the one you don't ask.
(together with the question you ask twice because you didn't
   like the answer first time round.   Now that *does* annoy me!)

Dave

--
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-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Proposed patches to mib2c conf files

2012-04-23 Thread Dave Shield
On 23 April 2012 05:47, Lawrence E Widman wid...@cardiothink.com wrote:
 Also, snmpset doesn't work with Counter32 or Counter64 because
 the 'c' and 'C' types were inadvertantly omitted from the
 current source.

No - that was not an oversight.
It is not permissable to SET counter-based objects.
They are inherently read-only
   (See RFC 2578, section 7.1.6 para 3
and section 7.1.10 para 3)

Dave

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: snmpset

2012-04-18 Thread Dave Shield
On 18 April 2012 16:44, Jasti Durgashree shreemo...@gmail.com wrote:
 i understood what is snmpset bt am asking how to parse oid in code

From the code file you referenced:

oid name[MAX_OID_LEN];
size_t  name_length;

name_length = MAX_OID_LEN;
snmp_parse_oid(names[count], name, name_length);

(where 'names[count]' is the string containing the OID you need to parse)

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Parsing a mib text file

2012-04-17 Thread Dave Shield
On 17 April 2012 07:32, sadanand harkantra cab...@rediffmail.com wrote:
 I have a mib text file and want to check if there is any net-snmp command 
 that can be used to
 parse a mib text file and check for any error in the text file.

The Net-SNMP suite is probably not the right tool in this situation.
Our MIB parser is somewhat lax, and will accept MIB files that are not
strictly valid, and attempt to do something sensible.

If you are wanting to check your MIB file for problems (which is a Very
Good Idea), then you should be using something much more strict and picky.
The standard tool for this is smilint from the TU Braunschweig.
There's a web interface to this at
 https://www.ibr.cs.tu-bs.de/projects/libsmi/tools/

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Parsing a mib text file

2012-04-17 Thread Dave Shield
On 17 April 2012 13:34, Andrew Hood ajh...@fl.net.au wrote:
 Another vote for libsmi, but if you don't understand SMI syntax and
 semantics quite well you will find smilint's error messages have a
 steep learning curve.

I'd have to say that if you don't understand SMI syntax and
semantics fairly well, then you shouldn't be writing MIB files!

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: changing debugTokens at runtime

2012-04-10 Thread Dave Shield
On 3 April 2012 16:23, Yun Li yunli2...@gmail.com wrote:
 I am trying to change the debugTokens at runtime.

 From gdb, I can tell debugTokens are not reread (since debugTokens is
 registered as premib_config_handlers, but during reconfig, only normal
 config handlers are reread). .. I wonder what
 is the idea behind this design

The idea of registering the debug tokens at an early stage. is to allow
debugging of the MIB parsing code.   If debugTokens were registered
as a normal config handler, then this wouldn't be active at the point at
which the MIB files were read in, and hence it wouldn't be possible to
debug this module.


 and if it is safe for me to change tokens at
 runtime by first setting debug_num_tokens back to 0 and memset
 dbg_tokens array to 0 and apply new tokens upon receiving HUP.

At a quick glance over the code - probably, yes.
Try it, and see how you get on.

Alternatively, you could always amend the active debug tokens by
manipulating the NET-SNMP-AGENT-MIB::nsDebugTokenTable

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Connect to main agent from AgentX Sub-agent

2012-04-10 Thread Dave Shield
On 5 April 2012 17:32, Ramakrishnan Sreenivasamallan
ramakrishnan.sreeniva...@gmail.com wrote:
 I am implementing a MIB module as a Agentx sub-agent. Inside my sub-agent
 code, I need to set another OID. After searching in forum it seems to me
 that I need to use snmp_open() and netsnmp_query_set() functions to open a
 connection to main agent. It would be great if somebody can post an example
 of how to use these APIs to open a connection to main agent and set an
 object from sub-agent code.

In this situation, the subagent is essentially acting in the same way as
the command-line tools.   The fact that it's talking to the same master
agent is irrelevant here - you're opening a completely separate client
connection, that just happens to be to the same process.


So the code for opening a connection is the same as that from any other
client application.   See the main() method of (e.g.) apps/snmpset.c for
details.
   That code also constructs the SET PDU (and calls 'snmp_synch_response()')
directly, rather than via the netsnmp_query_set() API.   If you want to use
this API instead, then you'd build the varbind list using
snmp_varlist_add_variable()
rather than snmp_pdu_add_variable() - but the idea is essentially the same,
(In fact, snmp_pdu_add_variable actually invokes snmp_varlist_add_variable
anyway)

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: NET-SNMP

2012-04-10 Thread Dave Shield
On 9 April 2012 10:38, Jasti Durgashree shreemo...@gmail.com wrote:
 Hi all, am following the steps given in
 http://net-snmp.sourceforge.net/wiki/index.php/TUT:Writing_a_Subagent but
   when am giving the below command am getting the result as follows:

 newuser@newuser-desktop:/$ snmpd -f -Lo -C --rocommunity=public
 --master=agentx --agentXSocket=tcp:localhost:1705 udp:1161
 Turning on AgentX master support.
 read_config_store open failure on /var/net-snmp/snmpd.conf
 read_config_store open failure on /var/net-snmp/snmpd.conf

That simply means that because you are running this agent as
a normal user (rather than root), the agent can't save its
persistent state.



 so anyone can please suggest me what i should give after NET-SNMP version
 5.6.2.pre1 to work my agent?

The agent should actually be working OK.
Try querying it.

In order to run the final agent safely, you should probably start it as root,
so that it *can* maintain the persistent state.  But it's fine to run it as a
normal user during development.   I do this all the time.

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: NET-SNMP

2012-04-10 Thread Dave Shield
   [ First - *please* don't mail me privately, without copying
any responses to the mailing list.  I don't have the time
or inclination to offer private, unpaid, SNMP consultancy.
Keep discussions to the list, where others can both learn
and offer advice.  Thanks.   ]

On 10 April 2012 17:27, Jasti Durgashree shreemo...@gmail.com wrote:
 Thank you guru  dave..i have one more doubt, i have modified snmpget.c
 from apps in net-snmp-5.6.2.pre1 to access object from mib.

What modifications did you make?
It shouldn't be necessary to change the code of snmpget.c
It's designed to allow you to make general GET requests from an
arbitrary agent - you should be able to use it as is.


 when i run this code it is giving the response but no snmp packets are
 capturing in wireshark

Sorry - I don't understand this.
If you are seeing the response to your query, then the packets
must be being transported successfully.   I've no idea why wireshark
is not reporting them.
   (Unless you are querying 'localhost', of course - in which case
the packets never actually get as far as the network interface).


 when i give session.peername=strdup(test.net-snmp.org) means i can see snmp
 packets in wireshark but only get-request, not giving any response...

What are the exact commands you are using to query the test agent?

 but when i give peername as my ip means am not able to see any
 snmp packets in wireshark
 so how can i get the snmp packets in wireshark?

You haven't really given us sufficient information to answer.
What are the command(s) you are using to query the local agent,
and how are you running wireshark?  (i.e. what filters are you applying?)

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Question About Net-SNMP Version 5.3.2.2 (FW: SMS snmpWalk)

2012-04-06 Thread Dave Shield
On 5 April 2012 20:16, Kathleen Brown kbr...@anselm.edu wrote:
 What we have is a (hardware, not VMWare) server running the management
 for our intrusion prevention system here on campus

That would be the CampusManager system from Bradford, I presume?
(We use that too)

  From a TippingPoint engineer I got the command in the email below,
 to do an snmp walk, but the information it has given us is not useful.

Your message truncated the output during the error from the bare
snmpwalk command, so I assume there was nothing important
after that.

The information you are getting there is simply the basic 'system' group.
A common configuration of SNMP servers as shipped will be to report
this information and nothing else.   It's then up to the local network
admin to decide how much to open up to general view,  and/or what
local information to make available.
This is described in the FAQ entry
   I can see the system group, but nothing else. Why?

The other issue is that you are walking the 'mib-2' group
(i.e. the officially defined management information).
You won't be picking up any enterprise-specific information
(which is where a lot of the useful stuff lies).
More recent versions of the Net-SNMP snmpwalk command
will default to showing the whole lot, but Bradford Network
ship a relatively old setup, which doesn't.
This is described in the FAQ entry
   Why can't I see values in the ENTERPRISE tree?


 Possibly this server is not set up to tell us too much, via SNMP.  Do you
 know of a command to list out exactly what it is able to tell us?

Try adding   .1   to the end of the snmpwalk command.
That will walk the whole tree (including enterprise-specific)
and show everything that is currently accessible.

You could also try logging onto the CampusManager box,
find the 'snmpd.conf' file,   and add the line

rocommunity aardvark

You could then run
snmpwalk -v 2c -c aardvark 10.3.1.92  .1

which would show you *everything* that the agent knows.
(Replace aardvark with your preferred internal community name)

Dave

--
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-SNMP Trap/INFORM Filtering

2012-04-04 Thread Dave Shield
On 4 April 2012 11:55, Chalapathi Rao c...@velocix.com wrote:
 We seem to be having the following issue with our snmpagent
 (using Net-SNMP Version:  5.3.2.2).

First thing - that's a very old version
(and the 5.3.x line is no longer actively supported).
Would it be possible to try with something a little newer?


    Issue: Traps can be filtered (snmpTargetMIB, snmpNotificationMIB)
  but INFORMs can't be.

It's been a while since I looked at the notification filtering code,
but I don't believe the basic framework distinguishes between
Traps and Informs.
   The basic snmpNotifyTable has a field snmpNotifyType to
control whether a particular target should be send a trap or
an inform notification.   But all of the subsequent filtering is
common to both.

Perhaps you could give a little more detail about how exactly
you are setting up the trap and inform destinations, and the
filtering for each of them.  And what exact behaviour you are
seeing.

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Net-SNMP Trap/INFORM Filtering

2012-04-04 Thread Dave Shield
[ First - *please* don't mail me privately, without copying
 any responses to the mailing list.  I don't have the time
 or inclination to offer private, unpaid, SNMP consultancy.
 Keep discussions to the list, where others can both learn
 and offer advice.  Thanks.   ]


On 4 April 2012 13:22, Chalapathi Rao c...@velocix.com wrote:
 Thanks for the prompt response Dave. Much appreciated.


 On Wed, 2012-04-04 at 13:05 +0100, Dave Shield wrote:

 On 4 April 2012 11:55, Chalapathi Rao c...@velocix.com wrote:
 We seem to be having the following issue with our snmpagent
 (using Net-SNMP Version:  5.3.2.2).

 First thing - that's a very old version
 (and the 5.3.x line is no longer actively supported).
 Would it be possible to try with something a little newer?

 We wanted do that but noticed the latest FAQ says filtering ain't supported.
 Why is that?

Because at the time that FAQ entry was written, this was
indeed the case.It's quite normal for things to move on,
and the documentation to lag behind.
   My suspicion is that this particular FAQ entry probably
needs to be updated.   But I'd need to check.

Try it - see what happens.



    Issue: Traps can be filtered (snmpTargetMIB, snmpNotificationMIB)
  but INFORMs can't be.

 It's been a while since I looked at the notification filtering code,
 but I don't believe the basic framework distinguishes between
 Traps and Informs.
The basic snmpNotifyTable has a field snmpNotifyType to
 control whether a particular target should be send a trap or
 an inform notification.   But all of the subsequent filtering is
 common to both.

 Perhaps you could give a little more detail about how exactly
 you are setting up the trap and inform destinations, and the
 filtering for each of them.  And what exact behaviour you are
 seeing.

PFA the config (Ignore the  in TAddress. Its configured to a valid trap
receiver).
My tests showed that when snmpNotifyType is configuerd as trap,
filtering seems to have worked (with include/exclude that is).,
whereas, it didn't work when it was configured as INFORM (i.e., the
respective trap didn't reach receiver with include).


I strongly suspect that what you are seeing here is not a problem
with filtering of Informs per se.   Rather, it's much more likely to
be an issue with the configuration of SNMPv3 inform targets.
This is a known hairy topic!

I suggest you try setting up an equivalent configuration using
SNMPv2c targets (both trap and inform), and confirm whether
or not filtering is working there.

Then have a look at the documentation on the project website
that discusses SNMPv3 informs, and have a play with that
(*not* using filters).
   Only when you've got that working would it be sensible to try
turning on filtering.   But get the two elements working individually
first.

Dave
snmpset localhost \
   snmpTargetParamsMPModel.\'v3\' = 3 \
   snmpTargetParamsSecurityModel.\'v3\' = 3 \
   snmpTargetParamsSecurityName.\'v3\' = masteruser \
   snmpTargetParamsSecurityLevel.\'v3\' = authPriv \
   snmpTargetParamsRowStatus.\'v3\' = createAndGo
SNMP-TARGET-MIB::snmpTargetParamsMPModel.'v3' = INTEGER: 3
SNMP-TARGET-MIB::snmpTargetParamsSecurityModel.'v3' = INTEGER: 3
SNMP-TARGET-MIB::snmpTargetParamsSecurityName.'v3' = STRING: masteruser
SNMP-TARGET-MIB::snmpTargetParamsSecurityLevel.'v3' = INTEGER: authPriv(3)
SNMP-TARGET-MIB::snmpTargetParamsRowStatus.'v3' = INTEGER: createAndGo(4)

snmpset localhost snmpTargetAddrTDomain.\'localv3\' = snmpUDPDomain \
   snmpTargetAddrTAddress.\'localv3\' x X \
   snmpTargetAddrTagList.\'localv3\' = localv3 \
   snmpTargetAddrParams.\'localv3\' = v3 \
   snmpTargetAddrRowStatus.\'localv3\' = createAndGo
SNMP-TARGET-MIB::snmpTargetAddrTDomain.'localv3' = OID: SNMPv2-TM::snmpUDPDomain
SNMP-TARGET-MIB::snmpTargetAddrTAddress.'localv3' = Hex-STRING: XXX
SNMP-TARGET-MIB::snmpTargetAddrTagList.'localv3' = STRING: localv3
SNMP-TARGET-MIB::snmpTargetAddrParams.'localv3' = STRING: v3
SNMP-TARGET-MIB::snmpTargetAddrRowStatus.'localv3' = INTEGER: createAndGo(4)


snmpset localhost snmpNotifyTag.\'localv3\' = localv3 \
   snmpNotifyType.\'localv3\' = inform \
   snmpNotifyRowStatus.\'localv3\' = createAndGo
SNMP-NOTIFICATION-MIB::snmpNotifyTag.'localv3' = STRING: localv3
SNMP-NOTIFICATION-MIB::snmpNotifyType.'localv3' = INTEGER: inform(2)
SNMP-NOTIFICATION-MIB::snmpNotifyRowStatus.'localv3' = INTEGER: createAndGo(4)

snmpset localhost snmpNotifyFilterProfileRowStatus.\'v3\' = createAndGo \
   snmpNotifyFilterProfileName.\'v3\' = v3filter
SNMP-NOTIFICATION-MIB::snmpNotifyFilterProfileRowStatus.'v3' = INTEGER: 
createAndGo(4)
SNMP-NOTIFICATION-MIB::snmpNotifyFilterProfileName.'v3' = STRING: v3filter

snmpset localhost \
   snmpNotifyFilterRowStatus.\v3filter\$RRMIB = createAndGo \
   snmpNotifyFilterType

Re: Net-SNMP Trap/INFORM Filtering

2012-04-04 Thread Dave Shield
On 4 April 2012 14:24, Chalapathi Rao c...@velocix.com wrote:
 Thanks Dave. Shall try the new version.

Note that I doubt the Net-SNMP software version is relevant here.
I strongly suspect the issue is related to SNMPv3 Informs,
rather than filtering of Traps-vs-Informs.

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Errors with Test T0072com2secunix_simple

2012-04-03 Thread Dave Shield
On 3 April 2012 23:15, Magnus Fromreide ma...@lysator.liu.se wrote:
 The test that fail are, principally, tu03c and tu03d but they fail in
 interesting ways.

What seems to be happening is that the snmpd.conf file directives
that contain very long fields are getting split over two lines instead
of one.
   The test checks assume that the snmpd.conf file looks like:

:
com2secunix tu03c a2345678911234567891.
com2secunix tu03d a2345678911234567891.
:

but instead it's ending up as

:
com2secunix tu03c
a2345678911234567891.
com2secunix tu03d
a2345678911234567891.
:

so this therefore generates the wrong errors for these pairs of entries
(and throws the line numbers for subsequent tests as well)

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Errors with Test T0072com2secunix_simple

2012-04-03 Thread Dave Shield
On 3 April 2012 23:23, Dave Shield d.t.shi...@liverpool.ac.uk wrote:
 What seems to be happening is that the snmpd.conf file directives
 that contain very long fields are getting split over two lines instead
 of one.

Scrub that suggestion - it seems to be an artifact of the application
I was using to view the files.
sigh

Magnus' identification of buffer lengths is the more likely cause.

Sorry for the confusion.

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: Syntax Error during `make install`

2012-04-03 Thread Dave Shield
On 2 April 2012 21:52, Lomax, Michael P. mlo...@quadramed.com wrote:
 However when I run
 the `make install` I get a syntax error


 install:  installed net-snmp-create-v3-user.1 in /usr/local/share/man/man1
 /bin/sh: 0403-057 Syntax error at line 1 : `;' is not expected.
 make: 1254-004 The error code from the last command is 2.


This is a known problem, which has been fixed in the current
development code, and will be included in future releases.

The workaround is to delete (or comment out) the line
starting
  @for i in $(MAN3) ; 

from the maninstall target - ideally in both 'Makefile.in' and 'Makefile'

Dave

--
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second 
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


Re: l'ajout de mibs dans snmp

2012-04-01 Thread Dave Shield
On 30 March 2012 16:12, Najouh adna...@yahoo.com wrote:
 /etc/snmp/snmp.conf: line 8: Warning: Unknown token: smuxsocket.
 /etc/snmp/snmp.conf: line 9: Warning: Unknown token: rocommunity.
 /etc/snmp/snmp.conf: line 10: Warning: Unknown token: com2sec.

   [etc]

As DavidH has indicated, those directives refer to the configuration
of the agent, and belong in 'snmpd.conf'  (note the 'd')

The file 'snmp.conf'  (without the 'd') is used to control the behaviour
of client applications, and in most cases is not actually needed.
When present, it would typically specify things like the default version
of SNMP to use,  perhaps some of the authentication parameters
(username, community name, etc), and/or the location of MIB files.

See the man pages 'snmp.conf(5)' for a list of what should go in
the client-side configuration, and 'snmpd.conf(5)' for directives
relating to the agent.

Dave

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders


  1   2   3   4   5   6   7   8   9   10   >