From fafb8142821a34311f55971674630b674b063495 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 28 Nov 2006 01:53:57 +0000 Subject: Added SNMP v2 support. --- tools/rrdbot-get.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/rrdbot-get.c b/tools/rrdbot-get.c index e140eb1..0df7b84 100644 --- a/tools/rrdbot-get.c +++ b/tools/rrdbot-get.c @@ -121,6 +121,7 @@ send_req() static void setup_req(char* uri) { + enum snmp_version version; const char* msg; char* scheme; char* copy; @@ -137,15 +138,16 @@ setup_req(char* uri) ASSERT(ctx.hostname && path); /* Currently we only support SNMP pollers */ - if(strcmp(scheme, "snmp") != 0) - errx(2, "invalid scheme: %s", scheme); + msg = cfg_parse_scheme(scheme, &version); + if(msg) + errx(2, "%s: %s", msg, scheme); if(sock_any_pton(ctx.hostname, &ctx.hostaddr, SANY_OPT_DEFPORT(161) | SANY_OPT_DEFLOCAL) == -1) err(1, "couldn't resolve host address (ignoring): %s", ctx.hostname); memset(&ctx.pdu, 0, sizeof(ctx.pdu)); - ctx.pdu.version = 1; + ctx.pdu.version = version; ctx.pdu.request_id = 0; ctx.pdu.type = ctx.recursive ? SNMP_PDU_GETNEXT : SNMP_PDU_GET; ctx.pdu.error_status = 0; -- cgit v1.2.3