Problème String into OID
2012-08-02 13:44:18 GMT
Hello,
I got the following code found on your wiki to store long and int value into an oid (file .c).
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "adspFAFtp.h"
/*
* the variable we want to tie an OID to. The agent will handle all
* * GET and SET requests to this variable changing it's value as needed.
*/
static long adspFAFtp = 1;
/*
* our initialization routine, automatically called by the agent
* (to get called, the function name must match init_FILENAME())
*/
void
init_adspFAFtp(void)
{
static oid adspFAFtp_oid[] =
{ 1, 3, 6, 1, 4, 1, 39387, 1, 1 };
/*
* a debugging statement. Run the agent with -DnstAgentModuleObject to see
* the output of this debugging statement.
*/
DEBUGMSGTL(("adspFAFtp",
"Initializing the adspFAFtp module\n"));
/*
* the line below registers our variables defined above as
* accessible and makes it writable. A read only version of any
* of these registration would merely call
* register_read_only_int_instance() instead. The functions
* called below should be consistent with your MIB, however.
*
* If we wanted a callback when the value was retrieved or set
* (even though the details of doing this are handled for you),
* you could change the NULL pointer below to a valid handler
* function.
*/
DEBUGMSGTL(("adspFAFtp",
"Initalizing adspFAFtp scalar integer. Default value = %d\n",
adspFAFtp));
netsnmp_register_long_instance("adspFAFtp",
adspFAFtp_oid,
OID_LENGTH(adspFAFtp_oid),
&adspFAFtp, NULL);
DEBUGMSGTL(("adspFAFtp",
"Done initalizing adspFAFtp module\n"));
}
My question is now, how can I store a string into an OID (like 500/1000 char or so).
If you can give me an exemple of it.
Thank you J
Cordialy
------------------------------------------------------------------------------ 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-users mailing list Net-snmp-users <at> lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Create a file 'agent/mibgroup/adsp.h' containing the following:
config_require( adspFAFtp )
config_require( adspFASql )
:
config_require( adspBAYPresenceFacture )
config_add_mib( ADSP-MIB )
and then run
./configure --with-default-snmp-version="2" --with-defaults
--with-mib-modules=adsp
and that should pull in the other modules codes automatically ('config_require')
as well as adding the relevant MIB file(s) to the default list.
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.
RSS Feed