ucd-snmp quick question

This is a discussion on ucd-snmp quick question within the SNMP Users forums, part of the Networking and Network Related category; Hi all, I am using ucd-snmp-4.2.7.pre1 on TRU64 I am trying to receive an snmp ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2006
 
Posts: n/a
Default ucd-snmp quick question

Hi all,

I am using ucd-snmp-4.2.7.pre1 on TRU64

I am trying to receive an snmp trap and then log it via the
callback.

What I am seeing is substantial memory growth (1M per 500 traps). I
suspect that I need to clean something up after or in the callback,
could you advise based on the rough code below if I am doing
something wrong?

void GetTraps(void* magic, int port)
{
struct snmp_session session, *ss;

init_snmp("Test");

init_mib();

snmp_sess_init(&session);

session_p->peername = SNMP_DEFAULT_PEERNAME;
session_p->local_port = port;
session_p->version = SNMP_DEFAULT_VERSION;
session_p->community_len = SNMP_DEFAULT_COMMUNITY_LEN;
session_p->retries = SNMP_DEFAULT_RETRIES;
session_p->timeout = SNMP_DEFAULT_TIMEOUT;
session_p->callback = OnTrapRec;
session_p->callback_magic = magic;
session_p->authenticator = NULL;

ss = snmp_open(&session);

if (ss)
{
int numfds = 0;
fd_set fdset;
FD_ZERO(&fdset);
struct timeval timeout;
timerclear(&timeout);
int block = 1;

for (;;)
{
snmp_select_info(&numfds, &fdset, &timeout, &block);
int count = select(numfds, &fdset, 0, 0, 0);

if (count > 0)
{
snmp_sess_read(&fdset);
}
}
}

snmp_close(ss);
snmp_shutdown("Test");
}

int OnTrapRec(int op, struct snmp_session *session, int reqid,
struct
snmp_pdu *pdu,void *magic)
{
std::cout << "OnTrapRec" << std::endl;
}


Many thanks in advance,

Tipp



Concerned about your privacy? Instantly send FREE secure email, no account required
http://www.hushmail.com/send?l=480

Get the best prices on SSL certificates from Hushmail
https://www.hushssl.com?l=485



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=...486&dat=121642
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/...net-snmp-users
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:20 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0