Hi all,
I am using net-snmp in my C++ project to get the profile details of a node in
windows.
I am able to get the basic details like sysDescr.0. and is working fine.
Now i am looking to get details like list of running processes and list of hard
disk storage drives etc.. but not able to achieve this.
I know the OID text corresposning to them like
H/W disk storage drives :
"host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageDescr.*"
running processes :
"host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageDescr.*"
i am using the following code to read these values
////////////////
get_node("host.hrStorage.hrStorageTable.hrStorageEntry.hrStorageDescr.*",
anOID, &anOID_len);//using a wild char here
snmp_add_null_var(pdu, anOID, anOID_len);
/*
* Send the Request out.
*/
status = snmp_synch_response(ss, pdu, &response);
/*
* Process the response.
*/
if (status == STAT_SUCCESS && response->errstat == SNMP_ERR_NOERROR) {
/*
* SUCCESS: Print the result variables
*/
for(vars = response->variables; vars; vars = vars->next_variable)
print_variable(vars->name, vars->name_length, vars);
/* manipuate the information ourselves */
for(vars = response->variables; vars; vars = vars->next_variable)
{
if (vars->type == ASN_OCTET_STR)
{
char *sp = (char *)malloc(1 + vars->val_len);
memcpy(sp, vars->val.string, vars->val_len);
sp[vars->val_len] = '\0';
printf("value #%d is a string: %s\n", count++, sp);
free(sp);
}
else
printf("value #%d is NOT a string! Ack!\n", count++);
}
/////////////////////////
Can anybody post the code to get the running process list and hard disk storage
entries.
Thanks
harish
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders