Hello,
I hav written a code to read the value of tcpMaxConn
from TCPMIB as shown below.
fn()
{
struct snmp_session session;
struct snmp_session *sess_handle;
struct snmp_pdu *pdu;
struct snmp_pdu *response;
struct variable_list *vars;
oid id_oid[MAX_OID_LEN];
oid serial_oid[MAX_OID_LEN];
size_t id_len = MAX_OID_LEN;
size_t serial_len = MAX_OID_LEN;
int status;
struct tree * mib_tree;
init_snmp("Check");
snmp_sess_init( &session );
session.version = SNMP_VERSION_1;
session.community = (u_char *)sessionComm;
session.community_len = strlen((const char
*)session.community);
session.peername=sessionIP;
sess_handle = snmp_open(&session);
add_mibdir(".");
mib_tree =read_mib
("/usr/share/snmp/mibs/TCP-MIB.txt");
pdu = snmp_pdu_create(SNMP_MSG_GET);
read_objid("TCP-MIB::tcpMaxConn.0", id_oid,
&id_len);
snmp_add_null_var(pdu, id_oid, id_len);
status = snmp_synch_response(sess_handle, pdu,
&response);
char *buf;
buf = new char[20];
int y=25;
int cnt=0;
for(vars = response->variables; vars; vars =
vars->next_variable)
{
snprint_value(buf,20,vars->name,
vars->name_length, vars);
cout<<buf;
}
snmp_free_pdu(response);
snmp_close(sess_handle);
}
This works fine.Now i want to read values of entries
in TCPCONNECTION table from the same MIB file.
How to do tht? plz help
Thanks in advance,
Regards,
Shivali
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders