标签归档:snmpd

设置snmp输出到message的日志级别

修改snmp服务的启动脚本
vim /etc/rc.d/init.d/snmpd

OPTIONS=”-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid ”
改成
OPTIONS=”-Ls3d -Lf /dev/null -p /var/run/snmpd.pid”
services snmpd restart

snmpd日志等级的定义:
0 或 ! —- LOG_EMERG
1 或 a —- LOG_ALERT
2 或 c —- LOG_CRIT
3 或 e —- LOG_ERR
4 或 w —- LOG_WARNING
5 或 n —- LOG_NOTICE
6 或 i —- LOG_INFO
7 或 d —- LOG_DEBUG

snmpd服务无法更改默认端口

问题描述:

修改/etc/rc.d/init.d/snmpd的启动脚本

修改行:

OPTIONS="-Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"

修改为

OPTIONS="udp:9999 -Lsd -Lf /dev/null -p /var/run/snmpd.pid -a"

service snmpd start 时无法启动该服务,终端没有报错提示

问题解决:

tail  -10 /var/log/messages

Aug 24 09:36:24 localhost snmpd[12063]: Error opening specified endpoint "udp:9999"
Aug 24 09:36:24 localhost snmpd[12063]: Server Exiting with code 1
Aug 24 09:36:24 localhost setroubleshoot: SELinux is preventing the snmpd (snmpd_t) from binding to port 9999. For complete SELinux messages. run sealert -l ec7e5602-a40f-4831-97d0-ca9e84618549

 

so,暂且不考虑selinux,命令关掉selinux

setenforce  0

sestatus

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          disabled
Policy version:                 21
Policy from config file:        targeted

 

稍后会继续详细介绍selinux,安全却很少人探索的东东!