我正在尝试按照本教程将我自己的 MIB 模块添加到 snmp 代理中:http://www.net-snmp.org/wiki/index.php/TUT :Writing_a_MIB_Module 现在,我逐步按照教程进行操作,仔细检查了所有内容,搜索了很长时间,但没有任何帮助我解决我的问题!
我使用的是net-snmp版本5.7.3
我在 net-snmp/agent/mibgroup 目录中实现了以下代码:
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
#include "nstAgentModuleObject.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 nstAgentModuleObject = 42;
/*
* our initialization routine, automatically called by the agent
* (to get called, the function name must match init_FILENAME())
*/
void
init_nstAgentModuleObject(void)
{
static …Run Code Online (Sandbox Code Playgroud)