Thanx a lot santhosh...
I have tried using existing snmp_parse_args().
 
I am facing 3 problems,
1.  while using send_v2trap() api - memory size increased by 40K for each trap 
sent till it reaches 47 or 48 MB and no increase after that.
     Now using sessions, there is no increase by 40K for each trap sent, but 
after sending some traps it increases by 8K.
2.  when traps are sent continuously there is a delay in forwarding the traps. 
3. CPU usage goes more than 50% when traps are sent continuously.
 
Now i have coded such that for sending each pdu , session is initialized,opened 
and closed.
Should i change the logic ? how long a session can be kept open?
 
Thanx,
Devi.U
 
   
 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tue 4/10/2007 10:19 AM
To: Devi U; [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code



Devi,

            snmp_parse_args() can be customized for your purpose, but we wrote 
our own parsing logic to handle trapsink, and trapsess directive.

Regards, 
Santhosh 

________________________________

From: Devi U [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 09, 2007 5:20 PM
To: SANTHOSH S (WT01 - Broadband Networks); [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

 

 

Santhosh,

 

I have tried using session for sending traps.There was no increase in memory 
usage for each trap sent. Thanx for ur kindly help.I have hardcoded session 
variable for testing. As per our existing design of sending traps using 
send_v2trap() api, traps were forwarded to management systems based on trapsess 
entry in snmpd.conf. Is there any way to initialise session variable based on 
configuration file?

 

Other wise i have to read trapsess entry from snmpd.conf and call 
snmp_parse_args() method in snmplib/snmp_parse_args.c to initialise session 
variable.

 

Thanx,

Devi.U 

 

 

 


 

________________________________

From: Devi U
Sent: Fri 3/30/2007 8:18 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

Santhosh,

 

Thanx for ur information and timely help.

I have uncommented and tested, even then 40K increase there for every trap sent.

 

we have not used table in notification, but have one table in the same MIB for 
which get,getnext and getbulk is allowed.

 

we have not added any OID to trap var bind which is defined as/under table.

 

I have noted that memory size is not increasing beyond 47MB.

 

Initially when started memory size is nearly 8K. I guess for nearly 1024 
traps(1024*40K=40M)  ,memory usage increases and after that it is not 
increasing.

 

I dont why netsnmp_set_row_column() is hit in gdb while sending the traps. 

 

Thanx,

Devi.U

 

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Fri 3/30/2007 4:24 PM
To: Devi U; [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

Devi,

 

            Please find my inline comments.

Regards, 
Santhosh 

________________________________

From: Devi U [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 30, 2007 3:22 PM
To: SANTHOSH S (WT01 - Broadband Networks); [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

 

 

 

Hi,

 

Very Sorry for my late reply. I was assigned to other works and back to this 
problem now.

after freeing varbind, memory usage was not reduced.

 

we are sending traps only and traps are received properly in management system 
configured.(Verified thro' Advent Net Manager - Trap viewer)

I have cross verified with other implementations and i cant find any problem in 
our implementation.

 

Using gdb  , I have identified that out of 40 K 

1. 8K is increased in method - 

 

   agent/agent_trap.c - send_trap_to_sess(netsnmp_session * sess, netsnmp_pdu 
*template_pdu)

 

   we are using net-snmp version 5.3.0.1 and line 881 /* snmp_free_pdu(pdu); */ 
is commented.

   In net-snmp version 5.4 it is uncommented.

[Santhosh] we used 5.2.1. This might be the issue, Uncomment snmp_free_pdu() in 
5.3.0.1 and verify.

 

2. 32 K ( increasing by 8 K for every call,this method is called in for loop )  
is increased in method - 

   agent/helpers/table_dataset.c - netsnmp_set_row_column(netsnmp_table_row 
*row, unsigned int column,
                                                int type, const char *value, 
size_t value_len)

 

   I doubt whether memory allocated and pointed to by row is freed or not.

   

 

Code flow to netsnmp_set_row_column 

==============================

#0  netsnmp_set_row_column (row=0x187a8b8, column=3, type=2, value=0xffbfeb74 
"", value_len=4)
    at table_dataset.c:1224
#1  0xff2c226c in log_notification (pdu=0x181dfa8, transport=0x3408)
    at notification-log-mib/notification_log.c:687
#2  0xff2bcc0c in send_notifications (major=2136456, minor=7, 
serverarg=0x2ffd08,
    clientarg=0xff304fe8) at notification/snmpNotifyTable.c:260
#3  0xff15ace0 in snmp_call_callbacks (major=1, minor=7, caller_arg=0x2ffd08) 
at callback.c:323
#4  0xff3688b0 in netsnmp_send_traps (trap=-1, specific=-1, 
enterprise=0xff392a64,
    enterprise_length=10, vars=0x2209320, context=0x0, flags=0) at 
agent_trap.c:783
#5  0xff3689d0 in send_enterprise_trap_vars (trap=-1, specific=-1, 
enterprise=0xff392a64,
    enterprise_length=10, vars=0x2209320) at agent_trap.c:797
#6  0xff29d0bc in send_eventTrap_trap () at ssg/ssg.c:1349 <------ Here we 
called send_v2trap
#7  0xff15d940 in run_alarms () at snmp_alarm.c:251     

[Santhosh] Are you adding any OID to trap var bind which is defined as/under 
table?  To isolate the issue remove table varbinds in trap PDU and see the 
memory usage. 

If with out any table OID added in the trap memory size reduced, then the issue 
is with the dataset (you might have used mib2c.create-dataset.conf template to 
implement your private table). 

 

 

Thanx,

Devi.U

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wed 3/14/2007 12:08 PM
To: Devi U; [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

 

Devi,
        After freeing varbind, usage should decrease; PDU is already freed in 
netsnmp_send_traps() itself ( invoked by send_v2trap). Sending trap or inform? 
Are you receiving the traps in trapd?  Cross check the API usage in other 
implementations (grep send_v2trap `find . -name "*.c"`)

        We used method similar to apps/snmptrap.c and there is no memory usage 
raised / leaks. Pls refer snmptrap.c file for session creation & deletion.

-
Santhosh

________________________________________
From: Devi U [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 13, 2007 7:30 PM
To: SANTHOSH S (WT01 - Broadband Networks); [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

 
Santhosh,
 
Thanx for ur immediate response.
followed the same example - /examples/notification.c
 
snmp_free_varbind is called in our code after send_v2trap().
 
In top output, i can see the size remains same even after snmp_free_varbind() 
is called.should size decrease after free is called?
 
For every 100 msec, callback will be called,snmp_varlist_add_variable() is used 
to store the variables and send_v2trap() is called for sending a single trap.
 
I dont know how to create session / send all traps in a single session.
 
Thanx,
Devi.U
________________________________________
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tue 3/13/2007 7:03 PM
To: Devi U; [EMAIL PROTECTED]
Subject: RE: how to purify net-snmp code

Hi Devi,
        The increase shown in top is memory usage by the application; all 
increased bytes might have not been leaked.

        You need to free the varbinds after sending each trap/inform.
                snmp_free_varbind(notification_vars);
        refer: http://www.net-snmp.org/dev/agent/notification_8c-example.html  

        Print the "top" output after freeing varbind and check the usage.

        Are you using single session to send all trap/inform or creating 
session before sending each inform/trap?

-
Santhosh
________________________________________
From: Devi U [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 13, 2007 6:44 PM
To: [EMAIL PROTECTED]
Cc: SANTHOSH S (WT01 - Broadband Networks)
Subject: RE: how to purify net-snmp code

Hi,
 
thanx santhosh..
I am able to purify the code..
 
I feel that memory leak is there when send_v2trap is called, but i am not 
getting any MLK/PLK  in traces
 
top display:
 
26760 root       1   0   19 9248K 5608K run     0:01  0.30% snmpd
 
top display after a trap is sent ===> for each  trap sent there is a increase 
of 40K in SIZE and goes upto 50M.
26760 root       1   0   19 9288K 5648K run     0:01  0.31% snmpd
 
we are using net-snmp version 5.3.0.1.
 
whether above increase in SIZE is memory leak?
 
Thanx,
Devi.U


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com


The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

============================================================================================================================

Tech Mahindra, formerly Mahindra-British Telecom.

Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
at http://www.techmahindra.com/Disclaimer.html externally and 
http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================
        

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
        
============================================================================================================================

Tech Mahindra, formerly Mahindra-British Telecom.

Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
at http://www.techmahindra.com/Disclaimer.html externally and 
http://tim.techmahindra.com/Disclaimer.html internally within Tech Mahindra.

============================================================================================================================
        

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com
        


============================================================================================================================

Tech Mahindra, formerly Mahindra-British Telecom.
 
Disclaimer:

This message and the information contained herein is proprietary and 
confidential and subject to the Tech Mahindra policy statement, you may review 
at <a 
href="http://www.techmahindra.com/Disclaimer.html";>http://www.techmahindra.com/Disclaimer.html</a>
 externally and <a 
href="http://tim.techmahindra.com/Disclaimer.html";>http://tim.techmahindra.com/Disclaimer.html</a>
 internally within Tech Mahindra.

============================================================================================================================
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Net-snmp-coders mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to