summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2006-04-05 03:38:18 +0000
committerStef Walter <stef@memberwebs.com>2006-04-05 03:38:18 +0000
commitd3e86b52b596480a07978a12462c1fe97df16c77 (patch)
treefb60cb2f166b6970b67e556202be2cfa97f5097a /tools
parent5268cec90ff428e2588103b6873b4e06e2cc5506 (diff)
Support for printing out textual MIB names.
Diffstat (limited to 'tools')
-rw-r--r--tools/rrdbot-get.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/rrdbot-get.c b/tools/rrdbot-get.c
index 3abdc77..a6cc0bc 100644
--- a/tools/rrdbot-get.c
+++ b/tools/rrdbot-get.c
@@ -68,8 +68,8 @@ static char* snmp_hostname = NULL;
static int retries = 0;
-/* Whether we're going recursive or not */
-static int recursive = 0;
+static int recursive = 0; /* Whether we're going recursive or not */
+static int numeric = 0; /* Print raw data */
/* -----------------------------------------------------------------------------
* DUMMY CONFIG FUNCTIONS
@@ -149,7 +149,8 @@ setup_req(char* uri)
/* And parse the OID */
snmp_data.bindings[0].syntax = 0;
- if(mib_parse(path, &(snmp_data.bindings[0])) == -1)
+ memset(&(snmp_data.bindings[0].v), 0, sizeof(snmp_data.bindings[0].v));
+ if(mib_parse(path, &(snmp_data.bindings[0].var)) == -1)
errx(2, "invalid MIB: %s", path);
/* Add an item to this request */
@@ -186,7 +187,10 @@ print_resp(struct snmp_pdu* pdu, uint64_t when)
{
value = &(pdu->bindings[i]);
- printf("%s: ", asn_oid2str(&(value->var)));
+ if(numeric)
+ printf("%s: ", asn_oid2str(&(value->var)));
+ else
+ mib_format(&(value->var), stdout);
switch(value->syntax)
{
@@ -334,7 +338,6 @@ int
main(int argc, char* argv[])
{
struct sockaddr_in addr;
- int numeric = 0;
char ch;
/* Parse the arguments nicely */