SNMP Agent engineboot

2013-01-04 Thread Zheng, Wenjie (Barclay)
Hi Everyone,

Happy new year 2013!

I am trying to implement an SNMP agent using net-snmp APIs,I use below method 
to setup SNMP agent process, called SNMP_agt.

snmp_set_do_debugging(1);
snmp_enable_stderrlog();
init_agent("SNMP_agent");
init_snmp("SNMP_agent");
snmp_dbg_print();
init_master_agent();

This agent works fine for GET and SET operations. But when this process 
re-started, and there is another request comes in, SNMP agent will replies 
error:usmstatus not in timewindow.

I learnt that SNMP agent should increase the engineboot if agent restarted, how 
should I implement this function that SNMP Manager don't need do a handshake 
again if SNMP agent restarted?

Thanks,
Barclay
  :

-Original Message-
From: dave.shi...@gmail.com [mailto:dave.shi...@gmail.com] On Behalf Of Dave 
Shield
Sent: 2013年1月2日 17:11
To: Zheng, Wenjie (Barclay)
Cc: net-snmp-cod...@lists.sourceforge.net; net-snmp-users@lists.sourceforge.net
Subject: Re: SNMP Agent log

On 2 January 2013 08:45, Zheng, Wenjie (Barclay)
 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 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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Question regarding Tables in net-snmp

2013-01-04 Thread Reza Salehi
Hi Dave,

I just want to let you know that the method you told me for cache perfectly 
worked for me. I adjusted timeout to 1( the smallest possible).Thanks a lot for 
your help.

Regards,
Reza



 From: Dave Shield 
To: Reza Salehi  
Cc: SNMP FORUM  
Sent: Friday, January 4, 2013 1:41 PM
Subject: Re: Question regarding Tables in net-snmp
 
On 4 January 2013 18:21, Reza Salehi  wrote:
> I put a printf("test"); inside the former one (
> athStatusTable_get_first_data_point()  ).It gets called once if I run
> snmpget  but still it gets called multiple time ( up to number of column in
> the table) if I run snmpwalk   or snmptable.

Yes, that's correct.
This is the way that the iterator helper works.

You haven't shown how 'fill_table' works, but I suspect this
helper is probably not the best choice for your requirements.


> Maybe I need to run mib2c diffrently?  or I am missing something here.
>
>  The only problem is I need to put  my function which fills the
> table somewhere to gets called once in response to snmptable or snmpwalk

What I would suggest is that you run

    mib2c -S cache=1 -c mib2c.table_data,conf  athStatusTable

This will include code to load the contents of the table into a local
cache, which will then be used to process requests.  That 'load_table'
routine is essentially the same as your curent 'fill_table', and will be
called whenever the cache is regarded as "too old" to be used.
If you tweak the cache timeout to a suitable value, this will typically
be re-loaded at the start of a walk, and remain valid for the duration.

You could use the same cache approach with the iterator helper
as well, but the table_data helper is probably more efficient.

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Question regarding Tables in net-snmp

2013-01-04 Thread Reza Salehi
Thanks Dave.  

I will try the cache method you mentioned to see how it works for me.

fill_table() function simply reads and parses  /proc/net/dev  file and fills 
table with statistics for the wireless interfaces (wifi0,wifi1..). So one 
attempt to this function fills the whole table.


BR,
Reza



 From: Dave Shield 
To: Reza Salehi  
Cc: SNMP FORUM  
Sent: Friday, January 4, 2013 1:41 PM
Subject: Re: Question regarding Tables in net-snmp
 
On 4 January 2013 18:21, Reza Salehi  wrote:
> I put a printf("test"); inside the former one (
> athStatusTable_get_first_data_point()  ).It gets called once if I run
> snmpget  but still it gets called multiple time ( up to number of column in
> the table) if I run snmpwalk   or snmptable.

Yes, that's correct.
This is the way that the iterator helper works.

You haven't shown how 'fill_table' works, but I suspect this
helper is probably not the best choice for your requirements.


> Maybe I need to run mib2c diffrently?  or I am missing something here.
>
>  The only problem is I need to put  my function which fills the
> table somewhere to gets called once in response to snmptable or snmpwalk

What I would suggest is that you run

    mib2c -S cache=1 -c mib2c.table_data,conf  athStatusTable

This will include code to load the contents of the table into a local
cache, which will then be used to process requests.  That 'load_table'
routine is essentially the same as your curent 'fill_table', and will be
called whenever the cache is regarded as "too old" to be used.
If you tweak the cache timeout to a suitable value, this will typically
be re-loaded at the start of a walk, and remain valid for the duration.

You could use the same cache approach with the iterator helper
as well, but the table_data helper is probably more efficient.

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


RE: getting errorno 99 for snmptrapd

2013-01-04 Thread Vanzant-Hodge, Amy
Thank you.  It turns out that it was a firewall problem with settings in 
iptable.  (Your answer helped point me in the right direction.)
Once we reworked these to be "looser", snmptrapd was able to receive traps from 
the designated system.

Amy Vanzant-Hodge


--
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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: how do I configure net-snmp on AIX

2013-01-04 Thread Dave Shield
On 3 January 2013 22:18, Wipro-Manish Sharma
 wrote:
> I have AIX server 5300-07-10-0943  and looking for configuration net –snmp
> on the same.
>
>
>
> We have installed net-snmp-5.5-1.rpm package on the server but we are
> getting time response output. and in /var/log/snmpd.log we are getting error
> as
>
> "nlist err: neither proc nor _proc found.Warning:
> no access control information configured.
> It's unlikely this agent can serve any useful purpose in this state.
> Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for
> this agent"


I'll leave someone else to comment on the nlist error,
but the access control issue can be fixed by creating a text file
'snmpd.conf' containing the following:

 rocommunity  public

That should be enough to allow you to query the agent.

There's more information to guide you in the FAQ, man pages, etc

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: getting errorno 99 for snmptrapd

2013-01-04 Thread Dave Shield
On 4 January 2013 19:59, Vanzant-Hodge, Amy  wrote:
> errno 99 “Can assign requested address”
> What does this mean and is there a way to fix this.

It's a bit difficult to comment, given the limited information you
have provided.
Some details as to the environment you are working with, how you are
running the command and/or what triggers this error might be useful.

But a quick Google search for this error seems to indicate that it's probably
related to being unable to open the specified address/port - either because
it's being asked to use an address that isn't possible, or because there are
too many ports open already.

You should be able to check the second by running 'netstat' to look at what
connections are open (or waiting to close).
As for the first - look at the command that is used to start the trap receiver,
and the config files used to configure it - and see if there's anything that
specifies an explicit interface and/or port to listen on.

Failing that, you're going to have to give us a bit more to work with!

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: mib2c best configuration mode to access global functions

2013-01-04 Thread Dave Shield
On 4 January 2013 19:34, Nuno Magalhães  wrote:
> What's the configuration I should use, with the mib2c tool, to access
> global functions.
> For example for invoking unix shell commands with popen or system and
> retrieving a value.

There's no special configuration required for mib2c - just take the code
template that it generates, and add the necessary #includes yourself.
mib2c is designed to look after generating the SNMP-related aspects
of the required code - writing the code that relates to the underlying system
being monitored (i.e. how you retrieve the actual data) is your responsibility.

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: Question regarding Tables in net-snmp

2013-01-04 Thread Dave Shield
On 4 January 2013 18:21, Reza Salehi  wrote:
> I put a printf("test"); inside the former one (
> athStatusTable_get_first_data_point()  ).It gets called once if I run
> snmpget  but still it gets called multiple time ( up to number of column in
> the table) if I run snmpwalk   or snmptable.

Yes, that's correct.
This is the way that the iterator helper works.

You haven't shown how 'fill_table' works, but I suspect this
helper is probably not the best choice for your requirements.


> Maybe I need to run mib2c diffrently?  or I am missing something here.
>
>  The only problem is I need to put  my function which fills the
> table somewhere to gets called once in response to snmptable or snmpwalk

What I would suggest is that you run

mib2c -S cache=1 -c mib2c.table_data,conf  athStatusTable

This will include code to load the contents of the table into a local
cache, which will then be used to process requests.  That 'load_table'
routine is essentially the same as your curent 'fill_table', and will be
called whenever the cache is regarded as "too old" to be used.
If you tweak the cache timeout to a suitable value, this will typically
be re-loaded at the start of a walk, and remain valid for the duration.

You could use the same cache approach with the iterator helper
as well, but the table_data helper is probably more efficient.

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


getting errorno 99 for snmptrapd

2013-01-04 Thread Vanzant-Hodge, Amy
errno 99 "Can assign requested address"
What does this mean and is there a way to fix this.

Thank you.
Amy Vanzant-Hodge



--
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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


mib2c best configuration mode to access global functions

2013-01-04 Thread Nuno Magalhães
Hi,

What's the configuration I should use, with the mib2c tool, to access 
global functions.
For example for invoking unix shell commands with popen or system and 
retrieving a value.
Can someone point me sample code.

Thanks,
Nuno Magalhães.

--
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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: SNMP in netkit

2013-01-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 January 2013 09:57, Alberto Andrés Rodríguez  wrote:
>
> Dave, in case I type the command snmpgetnext -v 2c -c public localhost 
> .1.3.6.1.2.1.4.21 I get the following response:
> RFC1213-MIB::ipRouteTable = No more variables left in this MIB view (It is 
> past the end of the MIB tree)

Yes - that's what I thought you might get.


> Searching in other forums I realized that this problem would be caused by a 
> bad configuration of snmp.conf.



> If you think that would be other problem, please let me know

No - I think you've found the most likely cause of the problem,
The agent is typically configured to only report the system group by default,
so you wouldn't be able to see anything from the ip group.
   Tweak the snmpd.conf file to allow wider access, and you should be fine.

(See the FAQ entry
 I can see the system group, but nothing else. Why?
for more details)

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: How to i configure default port from 162 to some other port

2013-01-04 Thread Dave Shield
On 4 January 2013 03:05, Ashish Sharma  wrote:
> How do i configure snmptrap command to send trap to someother port like
> (3211) instead of default port 162.
>
> I am trying with this command but it is not taking.
>
> snmptrap -v 1 -c  -h 10.1.100.22:1622 "" "" 1 0  ""

That's basically the right idea.
Though did you really mean to specify the community string "-h" ?

And this command is sending a trap to port 1622, rather than 3211

A more typical command would be something like

   snmptrap  -v 1 -c public   10.1.100.22:3211  ''  ''  1  -  ''

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-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users