资源简介
扩展Net-SNMP的Agent而写的一个开发流程文档,压缩包中也包含程序的源代码,和配置文件。根据Net-SNMP官方的实例程序,详细介绍了SNMP代理开发的各个步骤,各位读者按照步骤可以轻松的完成一个简单代理端的开发。

代码片段和文件信息
#include
#include
#include
#include
#include ject.h>
static int keep_running;
RETSIGTYPE
stop_server(int a) {
keep_running = 0;
}
int
main (int argc char **argv) {
int agentx_subagent=1; /* change this if you want to be a SNMP master agent */
int background = 0; /* change this if you want to run in the background */
int syslog = 0; /* change this if you want to use syslog */
/* print log errors to syslog or stderr */
if (syslog)
snmp_enable_calllog();
else
snmp_enable_stderrlog();
/* we‘re an agentx subagent? */
if (agentx_subagent) {
/* make us a agentx client. */
netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID NETSNMP_DS_AGENT_ROLE 1);
}
/* run in background if requested */
if (background && netsnmp_daemonize(1 !syslog))
exit(1);
/* initialize tcpip if necessary */
SOCK_STARTUP;
/* initialize the agent library */
init_agent(“example-demon“);
/* initialize mib code here */
/* mib code: init_nstAgentSubagentobject from nstAgentSubagentobject.C */
init_nstAgentSubagentobject();
/* initialize vacm/usm access control */
if (!agentx_subagent) {
init_vacm_vars();
init_usmUser();
}
/* example-demon will be used to read example-demon.conf files. */
init_snmp(“example-demon“);
/* If we‘re going to be a snmp master agent initial the ports */
if (!agentx_subagent)
init_master_agent(); /* open the port to listen on (defaults to udp:161) */
/* In case we recevie a request to stop (kill -TERM or kill -INT) */
keep_running = 1;
signal(SIGTERM stop_server);
signal(SIGINT stop_server);
snmp_log(LOG_INFO“example-demon is up and running.\n“);
/* your main loop here... */
while(keep_running) {
/* if you use select() see snmp_select_info() in snmp_api(3) */
/* --- OR --- */
agent_check_and_process(1); /* 0 == don‘t block */
}
/* at shutdown time */
snmp_shutdown(“example-demon“);
SOCK_CLEANUP;
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-13 11:09 SNMP代理开发实例\
文件 1121 2011-11-30 13:22 SNMP代理开发实例\example-demon.conf
文件 525317 2011-11-30 14:33 SNMP代理开发实例\libnetsnmpagent.so.10.0.6
文件 4130 2011-12-06 11:31 SNMP代理开发实例\NET-SNMP-TUTORIAL-MIB.txt
文件 782 2011-11-30 11:30 SNMP代理开发实例\snmp.conf
文件 15592 2011-12-06 15:52 SNMP代理开发实例\snmpd.conf
目录 0 2011-12-13 11:09 SNMP代理开发实例\tutorial\
文件 12262 2011-11-30 13:40 SNMP代理开发实例\tutorial\example-demon
文件 2119 2011-11-30 10:57 SNMP代理开发实例\tutorial\example-demon.c
文件 1121 2011-11-30 13:22 SNMP代理开发实例\tutorial\example-demon.conf
文件 5472 2011-11-30 13:40 SNMP代理开发实例\tutorial\example-demon.o
文件 1147 2011-11-30 13:35 SNMP代理开发实例\tutorial\Makefile
文件 2154 2011-11-30 10:57 SNMP代理开发实例\tutorial\nstAgentSubagentob
文件 356 2011-11-30 10:57 SNMP代理开发实例\tutorial\nstAgentSubagentob
文件 6316 2011-11-30 13:40 SNMP代理开发实例\tutorial\nstAgentSubagentob
文件 198215 2011-12-09 09:30 SNMP代理开发实例\睿捷V5代理扩展方案.docx
- 上一篇:R语言微博爬虫RWEIBO
- 下一篇:xx公司网络设计
相关资源
- Mechanism Analysis for Catalytic Synthesis of
- 谷歌浏览器插件 User-Agent Switcher
- JADE开发多Agent系统.zip
- net-snmp-5.6.1.1-1.x86.exe
- 《多智能体原理与技术》
- AGENT和多AGENT系统的设计与应用
- Agent技术课件
- Magento学习资料
- nginx服务器插件之net-snmp-5.6.1.1.tar.gz
- Artificial Intelligence: Foundations of Comp
- net-snmp-5.5.0-2.x64.EXE
- JMeterPlugins-Standard-1.4.0.zip,ServerAgent
- Cooperative Control of Multi-Agent Systems A C
- 环境支持软件.rar
- 研究多智能体建模的参考论文
- Developing_Multi-Agent_Systems_with_JADE
- 多Agent系统引论3
- Jmeter-CPU内存监控-ServerAgent-2.2.1
- magento模板设计指南
- snmp4j中agent程序demo
- 中国科学技术大学 信息学院 倪林主讲
- Magento2 官方开发手册
- Distributed-Coordination-of-Multi-agent-Networ
- jmeter serverAgent-2.2.1
- ServerAgent-2.2.1
- The Space and Motion of Communicating Agents
- 用agent++写的snmp代理程序
- ambari-agent-2.7.5.0-0.x86_64.rpm
- 多Agent系统引论
- magento2-develop.zip
评论
共有 条评论