安装:
配置:
复制别的机器的配置可能会出错,如果可以,还是从默认配置文件修改为好
一些错误:
参考阅读:snmp 代理端 安装参数配置
原创内容如转载请注明:来自 阿权的书房
yum install net-snmp
配置:
引用
1、基本配置
其实配制一个snmpd.conf文件不算太难,
(1)首选是定义一个共同体名(community),这里是public,及可以访问这个public的用户名(sec name),这里是notConfigUser。Public相当于用户notConfigUser的密码:)
# sec.name source community
com2sec notConfigUser default public
(2)定义一个组名(groupName)这里是notConfigGroup,及组的安全级别,把notConfigGroup这个用户加到这个组中。
groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
(3)定义一个可操作的范围(view)名, 这里是all,范围是 .1
# name incl/excl subtree mask(optional)
view all included .1
(4)定义notConfigUser这个组在all这个view范围内可做的操作,这时定义了notConfigUser组的成员可对.1这个范围做只读操作。
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none
其实配制一个snmpd.conf文件不算太难,
(1)首选是定义一个共同体名(community),这里是public,及可以访问这个public的用户名(sec name),这里是notConfigUser。Public相当于用户notConfigUser的密码:)
# sec.name source community
com2sec notConfigUser default public
(2)定义一个组名(groupName)这里是notConfigGroup,及组的安全级别,把notConfigGroup这个用户加到这个组中。
groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
(3)定义一个可操作的范围(view)名, 这里是all,范围是 .1
# name incl/excl subtree mask(optional)
view all included .1
(4)定义notConfigUser这个组在all这个view范围内可做的操作,这时定义了notConfigUser组的成员可对.1这个范围做只读操作。
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact all none none
复制别的机器的配置可能会出错,如果可以,还是从默认配置文件修改为好
一些错误:
引用
错误1:
# snmpwalk -v 1 -c public localhost system
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
...
Cannot find module (SNMPv2-TM): At line 0 in (none)
system: Unknown Object Identifier (Sub-id not found: (top) -> system)
错误2:
qu@ubuntu:~$ snmpwalk -v 2c -c public 192.168.4.12
Timeout: No Response from 192.168.4.12
dunkel:
>
> The original problem was:
> "However if I run "snmpwalk -v 1 -c public 192.168.1.36 system" on the
> stable box, with 192.168.1.36 the IP address of the testing box, i get:
> Timeout: No Response from 192.168.1.36
>
> snmpd is up and running, I can ping both ways, there are no firewalls
> in place. What could be wrong?"
>
> The solution is:
> open snmpd.conf with your favourite editor and
> add these 2 lines:
> interface eth0
> agentaddress [ip address of your host]:[listening port - 161 is the default]
错误3:
sarge:/# snmpwalk -v 2c -c public localhost
Timeout: No Response from localhost
错误排除:
步骤1:
sarge:/# snmpd -f -Le
屏幕显示(net-snmpd的log文件中是同样内容)
Warning: no access control information configured.
It is unlikely this agent can serve any useful purpose in this state.
Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.
Error opening specified endpoint "udp:161"
Server Exiting with code 1
新建目录
拷贝现有snmpd.conf 到/root/.snmp/snmpd.conf
步骤2:
snmpd -f -Le -Dread_config
读配置文件,开头显示了默认的配置文件的路径。
sarge:/# snmpd -f -Le -Dread_config
read_config: reading premib configuration tokens
read_config: config path used: /nfsroot/cq8401/bin/net-snmp/etc/snmp:/nfsroot/cq8401/bin/net-snmp/sh
are/snmp:/nfsroot/cq8401/bin/net-snmp/lib/snmp:/root/.snmp:/var/net-snmp
中间显示了配置文件的内容。
首先查看在默认配置文件的路径中是否有你的配置文件。
如果有,再在配置文件中配置权限。
小技巧:可以使用snmpd -f -Le -Dread_config 命令来查看日志文件信息,排错。
snmpd命令的有用选项:
-c FILE 指定文件为配置文件
-C 不读取默认的配置文件
-d dump接收和发送SNMP数据包
-D TOKEN 对于给定的TOKEN(标志)打开调试信息 ( -Dmib_init)
-I [-]INITLIST 对于要初始化的MIB列表显示
-M DIRLIST 指定MIB库的路径
-V 显示详细信息
-Le 把错误信息输出到日志中
-Lf FILE 把错误信息输出到指定文件中
-m MIBLIST use MIBLIST instead of the default MIB list
# snmpwalk -v 1 -c public localhost system
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
...
Cannot find module (SNMPv2-TM): At line 0 in (none)
system: Unknown Object Identifier (Sub-id not found: (top) -> system)
错误2:
qu@ubuntu:~$ snmpwalk -v 2c -c public 192.168.4.12
Timeout: No Response from 192.168.4.12
dunkel
>
> The original problem was:
> "However if I run "snmpwalk -v 1 -c public 192.168.1.36 system" on the
> stable box, with 192.168.1.36 the IP address of the testing box, i get:
> Timeout: No Response from 192.168.1.36
>
> snmpd is up and running, I can ping both ways, there are no firewalls
> in place. What could be wrong?"
>
> The solution is:
> open snmpd.conf with your favourite editor and
> add these 2 lines:
> interface eth0
> agentaddress [ip address of your host]:[listening port - 161 is the default]
错误3:
sarge:/# snmpwalk -v 2c -c public localhost
Timeout: No Response from localhost
错误排除:
步骤1:
sarge:/# snmpd -f -Le
屏幕显示(net-snmpd的log文件中是同样内容)
Warning: no access control information configured.
It is unlikely this agent can serve any useful purpose in this state.
Run "snmpconf -g basic_setup" to help you configure the snmpd.conf file for this agent.
Error opening specified endpoint "udp:161"
Server Exiting with code 1
新建目录
拷贝现有snmpd.conf 到/root/.snmp/snmpd.conf
步骤2:
snmpd -f -Le -Dread_config
读配置文件,开头显示了默认的配置文件的路径。
sarge:/# snmpd -f -Le -Dread_config
read_config: reading premib configuration tokens
read_config: config path used: /nfsroot/cq8401/bin/net-snmp/etc/snmp:/nfsroot/cq8401/bin/net-snmp/sh
are/snmp:/nfsroot/cq8401/bin/net-snmp/lib/snmp:/root/.snmp:/var/net-snmp
中间显示了配置文件的内容。
首先查看在默认配置文件的路径中是否有你的配置文件。
如果有,再在配置文件中配置权限。
小技巧:可以使用snmpd -f -Le -Dread_config 命令来查看日志文件信息,排错。
snmpd命令的有用选项:
-c FILE 指定文件为配置文件
-C 不读取默认的配置文件
-d dump接收和发送SNMP数据包
-D TOKEN 对于给定的TOKEN(标志)打开调试信息 ( -Dmib_init)
-I [-]INITLIST 对于要初始化的MIB列表显示
-M DIRLIST 指定MIB库的路径
-V 显示详细信息
-Le 把错误信息输出到日志中
-Lf FILE 把错误信息输出到指定文件中
-m MIBLIST use MIBLIST instead of the default MIB list
参考阅读:snmp 代理端 安装参数配置
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
丰禾


2011/01/24 17:48
路过,顶一个
涉县信息港


2011/01/21 17:26
学习了支持楼主
air nailer


2011/01/17 19:52
我复制别的机器的配置没出错,RP好?
hqlulu 回复于 2011/01/17 21:28
我的人品大部分都很好,也有RP不好的时候
保健品


2011/01/14 15:12
不错,支持一下 祝好!
健康品


2011/01/14 10:17
不错,我支持一下!就是看不懂!
Carriage Bolts


2011/01/12 12:47
我上次就复制我朋友的配置,结果惨不忍睹
hqlulu 回复于 2011/01/12 22:14
我基本上都是复制一个配置到所有服务器,基本都正常,但也有完全用不了的,得手工配置
宁波网站推广


2011/01/12 09:53
查看日志文件的所以信息怎么查?
hqlulu 回复于 2011/01/12 22:14
加入systemlog应该就在systemlog看吧
分页: 1/1
1
1
HTC Desire G7刷机方法
自动档汽车的P R N D档位
