set COMMUNITY without using snmpd.config

Alireza <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <CADgrdg-YtNWSGtvspZo4j0OacnZwzfU8xroHXv2tBdtr+UOonA@mail.gmail.com>
 Hello,
How can I  change the COMMUNITY's string without using the config file?

With the information I get, there is a command for this:
netsnmp_ds_set_string (NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_COMMUNITY,
"public");

But that does not work! in fact, this does not make a difference

My code:
init_agent("SnmpD");
init_my_mib_code();
init_snmp("SnmpD");
init_master_agent();

netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,NETSNMP_DS_AGENT_ROLE, 0);
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,NETSNMP_DS_LIB_DUMP_PACKET,true);
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID,NETSNMP_DS_AGENT_VERBOSE,true);
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID,NETSNMP_DS_LIB_DONT_READ_CONFIGS,true);
netsnmp_ds_set_string(NETSNMP_DS_LIBRARY_ID,NETSNMP_DS_LIB_COMMUNITY,"public");

while (whatever) {
      agent_check_and_process(0);
}

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.