Dynmically retrieving only objects with real values?

"Wilson, Dave" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi All, 
 
I have implemented a number of objects using net-snmp-5.2.1 which seem
to work fine.  I have a table of objects, some strings, some counters.
What I want to do is when I perform an snmpwalk only return objects with
real values.  So, for example, if the first couple of objects are:
 
statsname.1 : "first app name"
statsname.2 : "second app name"
statsname.3 : "third app name"
statsname.4 : "" [no app running]
 
statsval.1 : 0
statsval.2 : 300
statsval.3 : 0
statsval.4 : 0
 
I could in theory have up to 16 entries in each category.  However, I do
not want to return entries if they have no value, so in this example, I
won't return statsname.4, but the walk will go onto the next category.
I do this by using code like this in the var_CommonStatsTable function:
 
    case STATSNAME:
        strcpy (string, tempPTR->Name);
        *var_len = strlen(string);
        if ( strlen(string) == 0 ) return NULL; 
        return (unsigned char *) string;
 
This works fine for strings, but not counters because I sometimes want
to return objects with values of 0, eg. statsval.1, but I don't want to
return statsval.4.
 
How do I do this so that both snmpwalk and a specific snmpget (eg. on
statsval.3) will work?
 
Thanks for any advice and assistance.
 
Dave

-------------------------------------------------------------------------
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-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.