Bug 443758 - snmptrapd -A switch broken in red hat net-snmp release
Summary: snmptrapd -A switch broken in red hat net-snmp release
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: net-snmp
Version: 5.0
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jan Safranek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-04-23 06:14 UTC by Ben Carbery
Modified: 2018-10-20 02:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-01-20 22:07:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2009:0230 0 normal SHIPPED_LIVE net-snmp enhancement and bug fix update 2009-01-20 16:06:32 UTC

Description Ben Carbery 2008-04-23 06:14:13 UTC
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.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 Program Management 2008-06-02 20:04:37 UTC
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 12:03:40 UTC
fixed by rebase to 5.3.2.2 (bug #454977)

Comment 8 errata-xmlrpc 2009-01-20 22:07:35 UTC
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 06:16:58 UTC
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 09:40:43 UTC
(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.