Hi all,

Hi Dave,
Thanks for reply.

Is there any example code that can parse snmpd.conf?
It should find "com2sec", and keep processing following ip and community.
Also it should find "trap2sink" and keep processing following ip, community 
and port.

I find an example code as following:

void do_nothing(const char *word, char *cptr)
{
        gnRun++;
        printf("run");
        return;
}

int main(void)
{
        netsnmp_session session, *ss;
        struct config_line cl;

        netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_APPTYPE,
        "snmpd");
        register_app_config_handler("trapsink", do_nothing, NULL, NULL);

        init_snmp("snmpd");

        return 1;
}

It can find "trapsink", but don't include parsing the line.

Parsing function is so complicated, and I think there should be an example 
in net-snmp.
Could someone tell me where  I can find such a parsing example in net-snmp 
for reference?


Thanks,












永鈦鑫   iTAS Corporation
新竹市水源街75號
NO. 75,Shuiyuan St., Hsinchu City, Taiwan, R.O.C.
Tel:03-5716099 Ext.1208
E-mail:[EMAIL PROTECTED]
----- Original Message ----- 
From: "Dave Shield" <[EMAIL PROTECTED]>
To: "Tewen Hsieh" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Monday, July 07, 2008 6:16 PM
Subject: Re: configure manager's ip, trap receiver's ip and community at 
runtime via external application


> 2008/7/7 Tewen Hsieh <[EMAIL PROTECTED]>:
>> Question 1:
>> All these three tables are used to store *trap* destination and
>> configuration information,
>
> Yes - that is what you asked about.
>
>
>>       which table is used to store *manager's* ip and
>> configuration information (manager means the NMS
>> which send get/set requests to agent)?
>
> Access control is handled by the VACM tables - i.e. those
> in the SNMP-VIEW-BASED-ACM-MIB
>   Note that these settings do *not* include IP address
> information.  SNMPv3 requests are source-independent,
> and cannot be filtered by IP address.   SNMPv1/2c
> requests can be filtered by IP address, but this is done
> by a private internal mechanism, and is not configurable
> remotely.
>
>
>
>> Question 2:
>> In targetAddrTable_struct, there is an entry *sess*, but I can't find 
>> code
>> to fill it in  mibgroup/target/snmpTargetAddrEntry.c. So it is filled by
>> agent automatically?
>
> Yes - I think so.
>
>
>
>> Question 3:
>> So there is not a *global* community table to store community name and
>> privilege(rw/ro) both for trap receivers and managers?
>
> See the FAQ entries discussing access control.
> These tables are used by both the Net-SNMP trap receiver (snmptrapd)
> and agent (snmpd) to decide whether to accept an incoming request.
>
> snmptrapd uses a different context ("snmptrapd") - snmpd uses the
> default context ("").
>
>
>> Question 4:
>> So I need a *thread* to keep checking (while(1) {...}) incoming messages
>> from external application(CLI) to know when to read new configure? Or
>> snmp_alarm_registaer will be a better choice? Which one will affect the
>> performance of agent *less*?
>
> I have little or no experience with multi-threaded programming,
> and no time to investigate.   Sorry - I can't help with that question.
>
>
>> Question 5:
>> Is read/write snmpd.conf better than manipulate the data structures
>> directly?
>
> It's probably safer to use the standard config directive processing
> routines, rather than trying to manipulate the data structures directly.
>
> Either update the snmpd.conf file and trigger a re-load,
> or call "netsnmp_config()" with the config directive you
> want to apply
>
>
>>    But how can I make agent reload snmpd.conf after I modify trap
>> destination and configuration information (manager's ip and configuration
>> information ) without restart agent?
>
>    $ man snmpd.conf
>        [snip]
>
>    NOTES
>       o      The Net-SNMP agent can be instructed to re-read the various 
> con-
>              figuration files, either .....
>
>
> To find out the answer, I suggest you read the documentation :-)
>
>
> Dave
>
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to