[prev in list] [next in list] [prev in thread] [next in thread] 

List:       net-snmp-support
Subject:    [ net-snmp-Support Requests-456646 ] need clarification on snmptrapd -F param
From:       noreply () sourceforge ! net
Date:       2001-08-29 21:35:30
[Download RAW message or body]

Support Requests item #456646, was opened at 2001-08-29 13:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=212694&aid=456646&group_id=12694

Category: None
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: need clarification on snmptrapd -F param

Initial Comment:
To start, here's my environment:
net-snmp version: UCD-snmp version: 4.2.1
OS: SunOS 5.7
command: snmptrapd

I'm trying to run the snmptrapd with the -F parameter 
to format the output of my traps. I'm trying out the 
examples included in the snmptrapd man page (such as 
snmptrapd -F "%02.2h:%02.2j TRAP%w.%q from %A\n")

The traps I'm generating with snmptrap appear to not 
come out formated. 

Looking into snmptrapd.c, I noted 2 char *'s:
char       *trap1_fmt_str = NULL,
           *trap2_fmt_str = NULL; /* how to format 
logging to stdout */

I noted, that with the -F param it seems to only set 
trap1_fmt_str to the param argument, and I haven't 
seen it doing anything with trap2_fmt_str. When I 
changed my copy of it to change both strings, it was 
able to format my traps.

I was wondering what the difference in the 2 strings 
are. I noted that there are also 2 default format 
strings as well. Are these for different types of 
traps? I'm sure if I spent enough time digging, I 
might come close to (or even find) the answer but I 
thought it would be better to consult those who 
already know the code well.

Let me know if you need me to supply any more 
information on this matter. Thanks for you time on 
this.

Please Cc: G.Principato@motorola.com with any 
followups.

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-29 14:35

Message:
Logged In: NO 

I've been able to look further into this and find some of 
the answers (but not all). 
It looks like the trap2_fmt_str is to hold the format 
string when dealing with a v2 trap (whereas the first 
fmt_str is for v1 traps). 

However, it still looks like the snmptrapd.c code doesn't 
do anything with trap2_fmt_str so using -F for v2 traps 
won't have any effect. Please correct me if I missed 
something.

Below is the modification to the snmptrapd.c code to get 
around this issue. If you note any problems with doing 
this, please let me know. I'm hoping this issue can be 
fixed for the next point release if it's a bug.

starting at line 845, snmptrapd.c:
    /* Initialize the world. Create initial user */
    init_snmp("snmptrapd");
    if (trap1_fmt_str_remember) {
        free_trap1_fmt();
        free_trap2_fmt(); // Added this line
        trap1_fmt_str = strdup(trap1_fmt_str_remember);
        trap2_fmt_str = strdup(trap1_fmt_str_remember); // 
Added this line
    }


----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2001-08-29 14:32

Message:
Logged In: NO 

I've been able to look further into this and find some of 
the answers (but not all). 
It looks like the trap2_fmt_str is to hold the format 
string when dealing with a v2 trap (whereas the first 
fmt_str is for v1 traps). 

However, it still looks like the snmptrapd.c code doesn't 
do anything with trap2_fmt_str so using -F for v2 traps 
won't have any effect. Please correct me if I missed 
something.

Below is the modification to the snmptrapd.c code to get 
around this issue. If you note any problems with doing 
this, please let me know. I'm hoping this issue can be 
fixed for the next point release if it's a bug.

starting at line 845, snmptrapd.c:
    /* Initialize the world. Create initial user */
    init_snmp("snmptrapd");
    if (trap1_fmt_str_remember) {
        free_trap1_fmt();
        free_trap2_fmt(); // Added this line
        trap1_fmt_str = strdup(trap1_fmt_str_remember);
        trap2_fmt_str = strdup(trap1_fmt_str_remember); // 
Added this line
    }


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=212694&aid=456646&group_id=12694

_______________________________________________
Net-snmp-support mailing list
Net-snmp-support@lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/net-snmp-support

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic