summaryrefslogtreecommitdiff
path: root/daemon/config.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2009-10-24 14:10:37 +0000
committerStef Walter <stef@memberwebs.com>2009-10-24 14:10:37 +0000
commit54c751ffc4f79dcd916b4dffe690f59615c7146d (patch)
tree33664990f79460c120a6e00ba88026664cc46abb /daemon/config.c
parentb6c94d893237f4c339a1ad9ede7b809811001f77 (diff)
Add back support for ports in snmp urls.
* Note that for urls like: snmp://host1,host2:161/xxx the port applies to both hosts.
Diffstat (limited to 'daemon/config.c')
-rw-r--r--daemon/config.c5
1 files changed, 3 insertions, 2 deletions
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);