Red Hat Bugzilla – Bug 443758
snmptrapd -A switch broken in red hat net-snmp release
Last modified: 2010-10-22 20:24:30 EDT
Description of problem:
-A (append) option to snmptrapd is not support in the RH release.
This is a known bug that has been fixed for several months in official net-snmp
release. See except from my conversation with net-snmp developer back in November:
>On 28/11/2007, Ben Carbery wrote:
>> OPTIONS="-c /etc/snmp/snmptrapd.conf -A -Lf /var/snmp/snmptrapd.log -p
>> This still does not work. Note the -A is missing from the output:
>It's a bug in 5.3.1, which has subsequently been fixed.
>The code for processing the -A option is present, but this
>case is not listed in the string passed to "getopt".
>for the fix..
>This should work correctly in the 5.4.x line, and the upcoming 5.3.2 release.
Here is the error produced:
[root@jagungal snmp]# service snmptrapd start
Starting snmptrapd: /usr/sbin/snmptrapd: invalid option -- A
invalid option: -?
Usage: snmptrapd [OPTIONS] [LISTENING ADDRESSES]
NET-SNMP Version: 5.3.1
-a ignore authentication failure traps
-c FILE read FILE as a configuration file
-C do not read the default configuration files
-d dump sent and received SNMP packets
-D turn on debugging output
-e print event # (rising/falling alarm, etc.)
-f do not fork from the shell
-F FORMAT use specified format for logging to standard error
-h, --help display this usage message
-H display configuration file directives understood
-m MIBLIST use MIBLIST instead of the default MIB list
-M DIRLIST use DIRLIST as the list of locations
to look for MIBs
-n use numeric addresses instead of attempting
hostname lookups (no DNS)
-p FILE store process id in FILE
-t Prevent traps from being logged to syslog
-v, --version display version information
-x ADDRESS use ADDRESS as AgentX address
-O <OUTOPTS> toggle options controlling output display
0: print leading 0 for single-digit hex characters
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-L <LOGOPTS> toggle options controlling where to log to
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)
[EON] pri: log to standard error, output or /dev/null
for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null
for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri'
[FS] p1-p2 token: log to file/syslog for levels 'p1' to
-o FILE use -Lf <FILE> instead
-P use -f -Le instead
-s use -Lsd instead
-S d|i|0-7 use -Ls <facility> instead
-u FILE use -p <FILE> instead
Here are the full options I am trying to use:
OPTIONS="-c /etc/snmp/snmptrapd.conf -A -On -Lf /var/snmp/snmptrapd.log -p
These work ok without -A but then whenever the service is restarted manually (as
occurs whenever testing/building in a new feature, logrotating etc) then the log
file gets truncated and data is lost.
Version-Release number of selected component (if applicable):
net-snmp.x86_64 1:5.3.1-19.el5_1.4 installed
Every time, simply add -A option to snmptrapd
Steps to Reproduce:
The service refuses to start due to unknown option
The service should start and append to log file, not truncate it.
Please incorporate the fix the developers mentioned into yum release.
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
fixed by rebase to 18.104.22.168 (bug #454977)
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.
Bug still present although it has changed slightly.
The -A option no longer prevents the service from starting, however the log file specified by -Lf is still truncated when restarting the service.
(In reply to comment #9)
> The -A option no longer prevents the service from starting, however the log
> file specified by -Lf is still truncated when restarting the service.
This is expected behavior. Snmpd in RHEL-4 has two types of logging. The old is configured by -A, -l, and -s options, the new one uses -L[efos]. These two are not compatible together, i.e. -A does not influence -Lf.
There is no option to keep content of -Lf target and not to truncate it. You can use -Lo >>logfile.