NET-SNMP学习(一)subagent

本文介绍了NET-SNMP的安装与环境变量设置,详细讲解了如何配置snmpd.conf以启用子代理模式。接着,文章讨论了自定义MIB的编写,并提供了存放MIB的路径。通过snmptranslate命令验证MIB加载。此外,还阐述了使用mib2c工具生成子代理源码的过程,并指导如何编译和测试子代理程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Net-Snmp安装参照链接完成并测试是否安装完成。

想要在任何地方使用需更新环境变量,添加snmp的路径到~/.bashrc中

添加完路径后,source更新。

一、snmpd.conf

snmpd.conf是snmp的基本环境配置,在上述链接中有说明如何修改。在这里要注意的是如果要使用子代理模式,需要在conf配置中添加“master    agentx”开启snmp主代理模式。以下是conf配置文件:

###############################################################################
#
# EXAMPLE.conf:
#   An example configuration file for configuring the Net-SNMP agent ('snmpd')
#   See the 'snmpd.conf(5)' man page for details
#
#  Some entries are deliberately commented out, and will need to be explicitly activated
#
###############################################################################
#
#  AGENT BEHAVIOUR
#


#  Listen for connections from the local system only
#agentAddress  udp:127.0.0.1:161
#  Listen for connections on all interfaces (both IPv4 *and* IPv6)
#agentAddress udp:161,udp6:[::1]:161
agentAddress  udp:161




###############################################################################
#
#  SNMPv3 AUTHENTICATION
#
#  Note that these particular settings don't actually belong here.
#  They should be copied to the file /var/net-snmp/snmpd.conf
#     and the passwords changed, before being uncommented in that file *only*.
#  Then restart the agent


#  createUser authOnlyUser  MD5 "remember to change this password"
#  createUser authPrivUser  SHA "remember to change this one too"  DES
#  createUser internalUser  MD5 "this is only ever used internally, but still change the password"


#  If you also change the usernames (which might be sensible),
#  then remember to update the other occurances in this example config file to match.






###############################################################################
#
#  ACCESS CONTROL
#


                                                 #  system + hrSystem groups only
view   systemonly  included   .1.3.6.1.2.1.1
view   systemonly  included   .1.3.6.1.2.1.25.1
view   all         included   .1             # Full access from the local host
#rocommunity public  localhost
                                           #  Default access to basic system info
 rocommunity public  default 
 rwcommunity public  default


                            &n
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

just_run丶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值