Bug 443758 - snmptrapd -A switch broken in red hat net-snmp release
snmptrapd -A switch broken in red hat net-snmp release
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: net-snmp (Show other bugs)
5.0
x86_64 Linux
low Severity medium
: rc
: ---
Assigned To: Jan Safranek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-23 02:14 EDT by Ben Carbery
Modified: 2010-10-22 20:24 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-01-20 17:07:35 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ben Carbery 2008-04-23 02:14:13 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
>> /var/run/snmptrapd.pid"
>>
>> 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".
>
>See
>http://net-snmp.svn.sourceforge.net/viewvc/net-snmp/branches/V5-3-patches/net-snmp/apps/snmptrapd.c?view=diff&r1=15588&r2=15589
>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
        Web:      http://www.net-snmp.org/
        Email:    net-snmp-coders@lists.sourceforge.net

  -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)

                        (variants)
                        [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'
and above
                        [FS] p1-p2 token:  log to file/syslog for levels 'p1' to
'p2'

  Deprecated options:
  -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
                                                           [FAILED]

Here are the full options I am trying to use:

OPTIONS="-c /etc/snmp/snmptrapd.conf -A -On -Lf /var/snmp/snmptrapd.log -p
/var/run/snmptrapd.pid"

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):

Installed Packages
net-snmp.x86_64                          1:5.3.1-19.el5_1.4     installed

How reproducible:

Every time, simply add -A option to snmptrapd

Steps to Reproduce:
1.
2.
3.
  
Actual results:

The service refuses to start due to unknown option

Expected results:

The service should start and append to log file, not truncate it.

Additional info:

Please incorporate the fix the developers mentioned into yum release.
Comment 1 RHEL Product and Program Management 2008-06-02 16:04:37 EDT
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
release.
Comment 3 Jan Safranek 2008-08-06 08:03:40 EDT
fixed by rebase to 5.3.2.2 (bug #454977)
Comment 8 errata-xmlrpc 2009-01-20 17:07:35 EST
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.

http://rhn.redhat.com/errata/RHBA-2009-0230.html
Comment 9 Ben Carbery 2009-03-13 02:16:58 EDT
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.
Comment 10 Jan Safranek 2009-03-13 05:40:43 EDT
(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.

Note You need to log in before you can comment on or make changes to this bug.