Re: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
Hi - For the -1, I was referring to the value in the .h file. For example, #define LLDPLOCMANADDRTABLE_TIMEOUT 60 Change the 60 to -1. The mib2c with the cache option generates a default value (in this case, 60) and you can adjust it. I haven't tried the "on the fly" option yet. There is another mib2c for scalars - mib2c.scalar.conf. Kathy McLeod "Alexander King" To Kathy McLeod/Rochester/i...@ibmus, 08/06/2010 04:52 "net-snmp-users" AM cc Subject Re: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem Thank you all kind man! I will do my best get a prototype the way Dave teaching me ASAP. Also, I thought -1 was the value for "load every time". >>I saw the letter later Dave's wrote back,is it the meaning use "mib2c -S cache=-1 -c mib2c.iterate.conf uit" can get the really data on the fly???and how about the saclars data? I got a little inspiration,I think. -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 6 August 2010 10:52, Alexander King wrote: > is it the meaning use "mib2c -S cache=-1 -c mib2c.iterate.conf uit" No. You are confusing different things. The command to generate the code template would be mib2c -S cache=1 mib2c.iterate.conf uit Here the value '1' means "include the code for a local cache" (as opposed to '0' which means "don't include any cache code") What Kathy was referring to is the value used for the cache timeout (which is specified as part of registering the cache handler). This is normally a timeout in seconds, and the agent will use values from the cache until the cache is that many seconds old. At which point the next request will trigger a reload of the cache with a new set of values, which will then be used for the next N seconds. However if this cache timeout has the special value -1, then this indicates that the cache should *always* be regarded as "out-of-date", and hence every single request will trigger a reload. This will obviously be somewhat timeconsuming and inefficient, hence it's not something that we would recommend. But if you do insist on re-loading the data every time (and can accept the increased load), that's how you could do it. But I *strongly* suggest you experiment with small (non-negative) timeout values first. Dave -- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
Thank you all kind man! I will do my best get a prototype the way Dave teaching me ASAP. Also, I thought -1 was the value for "load every time". >>I saw the letter later Dave's wrote back,is it the meaning use "mib2c -S >>cache=-1 -c mib2c.iterate.conf uit" can get the really data on the fly???and >>how about the saclars data? I got a little inspiration,I think.-- This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 4 August 2010 15:29, Kathy McLeod wrote: > How do you alter the timeout value on the fly? Via the NET-SNMP-AGENT-MIB::nsCacheTable > Also, I thought -1 was the value for "load every time". My apologies - you are quite correct. [See agent/helpers/cache_handler.c:netsnmp_cache_check_expired()] Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
Hi - How do you alter the timeout value on the fly? Also, I thought -1 was the value for "load every time". Thanks. Kathy McLeod Dept S82 CCB - SNMP IBM Rochester, MN (507) 253-4803 Dave Shield To Alexander King 08/04/2010 02:54 cc AMnet-snmp-users Subject Re: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem On 4 August 2010 03:47, Alexander King wrote: > Now,I want to know how to get the newest data use net-snmp snmpd daemon > routine.That is to say,Is there a way when I use "snmpwalk" command browse > the uit data tree I get the updated or newest or latest data each time? I will repeat my suggestion from yesterday. Use one of the mib2c templates generated with '-S cache=1' That will produce code that uses a local cache, with a 'load' routine, which will be called when the cache is "too old". If you set the timeout for the cache to be 0, then the data will be reloaded for every single new SNMP request. But note that this is every *request* - not every command. A single 'snmpwalk' command will trigger a whole sequence of GETNEXT requests, each of which will re-load the cache. That's why I think you might be better off with a cache timeout of a few seconds. But experiment - altering the timeout is a trivial change (and can even be done on the fly). No code changes are needed. Get something working using the cache first, and then worry about tuning the cache frequency. Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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 -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 4 August 2010 03:47, Alexander King wrote: > Now,I want to know how to get the newest data use net-snmp snmpd daemon > routine.That is to say,Is there a way when I use "snmpwalk" command browse > the uit data tree I get the updated or newest or latest data each time? I will repeat my suggestion from yesterday. Use one of the mib2c templates generated with '-S cache=1' That will produce code that uses a local cache, with a 'load' routine, which will be called when the cache is "too old". If you set the timeout for the cache to be 0, then the data will be reloaded for every single new SNMP request. But note that this is every *request* - not every command. A single 'snmpwalk' command will trigger a whole sequence of GETNEXT requests, each of which will re-load the cache. That's why I think you might be better off with a cache timeout of a few seconds. But experiment - altering the timeout is a trivial change (and can even be done on the fly). No code changes are needed. Get something working using the cache first, and then worry about tuning the cache frequency. Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 3 August 2010 10:34, Yongting Lin wrote: >As in this situation, can register a peridoical alarm to monitor the > condition, and send traps if condition changed? or project-specified code(A > daemon in pratical program) act as a subagent to snmpd, and invokde > send_v2trap function to send traps when itself detects some condition > changed? > > Is my thought feasible? Yes,I know what your really meaning is,there is another routine call send_uit_traps() send the traps if some values chanaged. Now,I want to know how to get the newest data use net-snmp snmpd daemon routine.That is to say,Is there a way when I use "snmpwalk" command browse the uit data tree I get the updated or newest or latest data each time? Yes - that should work. Is the condition that you are monitoring covered by an existing MIB object? Yes,all the monitor objects and the code get from the MIB files. If so, then you should be able to use the DisMan Event MIB support to handle this already, without needing to write any new code at all. See the relevant section in the snmpd.conf man page. Dave-- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
Hi Dave: As in this situation, can register a peridoical alarm to monitor the condition, and send traps if condition changed? or project-specified code(A daemon in pratical program) act as a subagent to snmpd, and invokde send_v2trap function to send traps when itself detects some condition changed? Is my thought feasible? Best Regards! Ivan Lin. previous email- On 3 August 2010 09:04, Alexander King wrote: > I want to the init_uit routine can get data periodically The "init_xxx" routine is called *once* to set up the module, when the agent first starts That's what the word initialise means. It will not be called repeatedly, and is not the right place to handle (re-)loading data. > Would you give me some hits? Look at using the cache helper. If you run 'mib2c -Scache=1 mib2c.iterate.conf myTable' then this should generate a suitable template. I don't think the scalar mib2c template has a similar option, but you can always apply the same techniques there. As regards generating notifications, it would probably be more sensible to either pass the relevant data into the routine that generates the trap. Or else have this routine refresh the cached data itself. There's no point in re-loading the data just in case the agent might possibly need to send a trap Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ 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: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 3 August 2010 10:34, Yongting Lin wrote: > As in this situation, can register a peridoical alarm to monitor the > condition, and send traps if condition changed? or project-specified code(A > daemon in pratical program) act as a subagent to snmpd, and invokde > send_v2trap function to send traps when itself detects some condition > changed? > > Is my thought feasible? Yes - that should work. Is the condition that you are monitoring covered by an existing MIB object? If so, then you should be able to use the DisMan Event MIB support to handle this already, without needing to write any new code at all. See the relevant section in the snmpd.conf man page. Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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: Fw:Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 3 August 2010 09:51, Alexander King wrote: >> Look at using the cache helper. >> If you run 'mib2c -Scache=1 mib2c.iterate.conf myTable' >sys-man mibs # mib2c -Scache=1 mib2c.iterat.conf uit > no variable specified for -S flag. at /usr/local/bin/mib2c line 96. OK - Try putting a space after the '-S' I.e. mib2c -S cache=1 [I always get that wrong!] Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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
Fw:Re: net-snmp init_XXX() get data periodically( or cyclic ) problem
-- Original -- From: "Dave Shield"; Date: Tue, Aug 3, 2010 04:42 PM To: "Alexander King"; Cc: "net-snmp-users"; "林永听"; Subject: Re: net-snmp init_XXX() get data periodically( or cyclic ) problem On 3 August 2010 09:04, Alexander King wrote: > I want to the init_uit routine can get data periodically The "init_xxx" routine is called *once* to set up the module, when the agent first starts That's what the word initialise means. It will not be called repeatedly, and is not the right place to handle (re-)loading data. >>if so,How can I deal with this situation???I need more information ^_^ > Would you give me some hits? Look at using the cache helper. If you run 'mib2c -Scache=1 mib2c.iterate.conf myTable' >>sys-man mibs # mib2c -Scache=1 mib2c.iterat.conf uit no variable specified for -S flag. at /usr/local/bin/mib2c line 96. sys-man mibs # I use net-snmp 5.4.2.1 then this should generate a suitable template. I don't think the scalar mib2c template has a similar option, but you can always apply the same techniques there. As regards generating notifications, it would probably be more sensible to either pass the relevant data into the routine that generates the trap. Or else have this routine refresh the cached data itself. >> Yes,I have another routine to do this,and this routine get data is the >> newest,can call the function sent trap immediately when the data changed. There's no point in re-loading the data just in case the agent might possibly need to send a trap Dave-- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ 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: net-snmp init_XXX() get data periodically( or cyclic ) problem
On 3 August 2010 09:04, Alexander King wrote: > I want to the init_uit routine can get data periodically The "init_xxx" routine is called *once* to set up the module, when the agent first starts That's what the word initialise means. It will not be called repeatedly, and is not the right place to handle (re-)loading data. > Would you give me some hits? Look at using the cache helper. If you run 'mib2c -Scache=1 mib2c.iterate.conf myTable' then this should generate a suitable template. I don't think the scalar mib2c template has a similar option, but you can always apply the same techniques there. As regards generating notifications, it would probably be more sensible to either pass the relevant data into the routine that generates the trap. Or else have this routine refresh the cached data itself. There's no point in re-loading the data just in case the agent might possibly need to send a trap Dave -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ 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
net-snmp init_XXX() get data periodically( or cyclic ) problem
Hi Dave and All: Send trap problem was fixed,use a new routine.Thank you! snmp_alarm_register(5, /* seconds */ 0, /* repeat (every 10 seconds).here,the value is 0,can send the trap immediately! */ send_uitJBODPowerATraps_trap, /* our callback */ NULL/* no callback data needed */); Another question,I use tools mib2c.iterate.conf mib2c.scalar.conf and mib2c.notify.conf get all my generate code,now the init_uit() got all the data rightly,but all the data was the time when they was got,not the newest,if I modified some of the device parameters,I couldnot got the update data,That's not the way I required it ,I want to the init_uit routine can get data periodically,so I can get the newest data.Would you give me some hits? Thank you,Dave!as usual. Alex-- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ 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