From 54c751ffc4f79dcd916b4dffe690f59615c7146d Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Sat, 24 Oct 2009 14:10:37 +0000 Subject: Add back support for ports in snmp urls. * Note that for urls like: snmp://host1,host2:161/xxx the port applies to both hosts. --- daemon/config.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'daemon/config.c') diff --git a/daemon/config.c b/daemon/config.c index fcc4379..0196c62 100644 --- a/daemon/config.c +++ b/daemon/config.c @@ -242,11 +242,11 @@ parse_item (const char *field, char *uri, config_ctx *ctx) enum snmp_version version; const char *msg; char *copy; - char *scheme, *host, *user, *path, *query; + char *scheme, *host, *user, *path, *query, *port; /* Parse the SNMP URI */ copy = strdup (uri); - msg = cfg_parse_uri (uri, &scheme, &host, &user, &path, &query); + msg = cfg_parse_uri (uri, &scheme, &host, &port, &user, &path, &query); if (msg) errx(2, "%s: %s: %s", ctx->confname, msg, copy); free (copy); @@ -281,6 +281,7 @@ parse_item (const char *field, char *uri, config_ctx *ctx) item->poller = NULL; /* Set later in config_done */ item->vtype = VALUE_UNSET; + item->portnum = port ? port : "161"; /* Parse the hosts, query */ parse_hosts (item, host, ctx); -- cgit v1.2.3