日志精简
[bash]nano /etc/sysconfig/snmpd.options
#加入如下参数
OPTIONS="-LS3d -Lf /dev/null -p /var/run/snmpd.pid -a"
chmod +x /etc/sysconfig/snmpd.options
#为什么加x,自己cat /etc/init.d/snmpd看看就明白了
[/bash]
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, and
7 或 d —- LOG_DEBUG.
日志剥离:
SEE snmpd man手册
from:http://blog.chinaunix.net/u/4764/showart_2013803.html
snmpd - daemon to respond to SNMP request packets.
snmpd [OPTIONS] [LISTENING ADDRESSES]
snmpd is an SNMP agent which binds to a port and awaits requests from
SNMP management software. Upon receiving a request, it processes the
request(s), collects the requested information and/or performs the
requested operation(s) and returns the information to the sender.
-a Log the source addresses of incoming requests.
specified by the -c option.
Turn on debugging output for the given TOKEN(s). Without any
tokens specified, it defaults to printing all the tokens (which
is equivalent to the keyword "ALL"). You might want to try ALL
for extremely verbose output. Note: You can not put a space
between the -D flag and the listed TOKENs.
sockets.
Display a brief usage message and then exit.
the agent and then exit.
This option specifies which modules you do (or do not) want to
be initialized when the agent starts up. If the comma-sepa-
rated INITLIST is preceded with a '-', it is the list of mod-
ules that you do not want to be started. Otherwise, INITLIST
is the list of modules to be started.
ments -Dmib_init -H (assumes you have debugging support com-
piled in).
Log all output from the agent (including stdout and stderr) to
FILE. If no filename is given, log to a default file set at
compile time (normally /var/log/snmpd.log).
not exit if files only accessible to root (such as /dev/kmem
etc.) cannot be opened.
Specifies the syslog facility to use when logging to syslog.
'd' means LOG_DAEMON and 0 through 7 mean LOG_LOCAL0 through
LOG_LOCAL7. LOG_DAEMON is the default.
textual form) after opening listening sockets.
Print version information for the agent and then exit.
Listens for AgentX connections on the specified address rather
than the default '/var/agentx/master'. The address can either
be a Unix domain socket path, or the address of a network
interface. The format is the same as the format of listening
By default, snmpd listens for incoming SNMP requests only on UDP port
161. However, it is possible to modify this behaviour by specifying
one or more listening addresses as arguments to snmpd. A listening
address takes the form:
in which case snmpd listens on that UDP port on all IPv4 interfaces.
Otherwise, the <transport-address> part of the specification is parsed
according to the following table:
for example, "tcp" and "TCP" are equivalent. Here are some examples,
along with their interpretation:
back interface. This prevents snmpd being
queried remotely (which is a bit pointless).
The ":161" is redundant here since that is the
default SNMP port in any case.
agent.
the Unix domain is the default transport iff
the first character of the <transport-address>
is a '/'.
with VPI=0 and VCI=161 (decimal) on the first
ATM adapter in the machine.
available; for instance, hosts with no IPv6 support will not be able to
use udp6 transport addresses, and attempts to do so will result in the
error "Error opening specified endpoint". Likewise, since AAL5 PVC
support is only currently available on Linux, it will fail with the
same error on other platforms.
CONFIGURATION FILES
snmpd checks for the existence of and parses the following files:
Common configuration for the agent and applications. See
snmp.conf(5) for details.
Agent-specific configuration. See snmpd.conf(5) for details.
These files are optional and may be used to configure access con-
trol, trap generation, subagent protocols and much else besides.
will read any files with the names snmpd.conf and
snmpd.local.conf in a colon separated path specified in the SNMP-
CONFPATH environment variable.
The agent will also load all files in this directory as MIBs. It
will not, however, load any file that begins with a '.' or
descend into subdirectories.
(in recommended reading order)
@鸡鸡哥
之所以要+x是因为CentOS里面这个文件是个BASH脚本 /etc/init.d/snmpd执行这个脚本获得里面定义的变量 所以需要+x 但让不加也是可以的 因为source调用脚本的方法不需要对方一定有可执行权限。
你说的第二个问题 看起来是打开了你的NET-SNMP 的IPV6支持 如果你没有这方面的需求 就关掉它把。
@ihipop
nano /etc/sysconfig/snmpd.options #加入如下参数 OPTIONS="-LS3d -Lf /dev/null -p /var/run/snmpd.pid -a"chmod +x /etc/sysconfig/snmpd.options #为什么加x,自己cat /etc/init.d/snmpd看看就明白了
这里没看明白,还有,我配置了snmpd的日志独立出来,不放入messages,修改了snmpd.options的配置如下OPTIONS="-Lf /var/log/snmpd.log",但是貌似出错,不知何故,贴日志出来
[root@xxxx log]# head -n 50 snmpd.log
could not open /proc/net/if_inet6
mibII/mta_sendmail.c:open_sendmailst: could not guess version of statistics file "/var/log/mail/statistics"
cannot open /proc/net/snmp6 ...
error finding row index in _ifXTable_container_row_restore
NET-SNMP version 5.3.2.2
为何?谢谢指教
@鸡鸡哥
你说什么?我也没听明白?
小顾兄,为何要+x呢,没看明白