summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
Diffstat (limited to 'daemon')
-rw-r--r--daemon/config.c5
-rw-r--r--daemon/poll-engine.c10
-rw-r--r--daemon/rrdbotd.h1
3 files changed, 9 insertions, 7 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);
diff --git a/daemon/poll-engine.c b/daemon/poll-engine.c
index e628382..30faf94 100644
--- a/daemon/poll-engine.c
+++ b/daemon/poll-engine.c
@@ -291,7 +291,7 @@ field_request (rb_item *item)
item->vtype = VALUE_UNSET;
- req = snmp_engine_request (item->hostnames[item->hostindex], item->community,
+ req = snmp_engine_request (item->hostnames[item->hostindex], item->portnum, item->community,
item->version, item->poller->interval, item->poller->timeout,
SNMP_PDU_GET, &item->field_oid, field_response, item);
item->field_request = req;
@@ -321,7 +321,7 @@ query_value_request (rb_item *item, asn_subid_t subid)
log_debug ("query requesting value for table index: %u", subid);
- req = snmp_engine_request (item->hostnames[item->hostindex], item->community,
+ req = snmp_engine_request (item->hostnames[item->hostindex], item->portnum, item->community,
item->version, item->poller->interval, item->poller->timeout,
SNMP_PDU_GET, &oid, field_response, item);
@@ -434,7 +434,7 @@ query_search_request (rb_item *item)
log_debug ("query looking for next table index");
}
- req = snmp_engine_request (item->hostnames[item->hostindex], item->community,
+ req = snmp_engine_request (item->hostnames[item->hostindex], item->portnum, item->community,
item->version, item->poller->interval, item->poller->timeout,
SNMP_PDU_GETNEXT, oid, query_next_response, item);
@@ -526,7 +526,7 @@ query_pair_request (rb_item *item, asn_subid_t subid)
oid.subs[oid.len] = subid;
++oid.len;
- req = snmp_engine_request (item->hostnames[item->hostindex], item->community,
+ req = snmp_engine_request (item->hostnames[item->hostindex], item->portnum, item->community,
item->version, item->poller->interval, item->poller->timeout,
SNMP_PDU_GET, &oid, query_match_response, item);
@@ -539,7 +539,7 @@ query_pair_request (rb_item *item, asn_subid_t subid)
oid.subs[oid.len] = subid;
++oid.len;
- req = snmp_engine_request (item->hostnames[item->hostindex], item->community,
+ req = snmp_engine_request (item->hostnames[item->hostindex], item->portnum, item->community,
item->version, item->poller->interval, item->poller->timeout,
SNMP_PDU_GET, &oid, field_response, item);
diff --git a/daemon/rrdbotd.h b/daemon/rrdbotd.h
index aa19b23..49ec1bb 100644
--- a/daemon/rrdbotd.h
+++ b/daemon/rrdbotd.h
@@ -76,6 +76,7 @@ typedef struct _rb_item
/* Host names, with alternate hosts */
#define MAX_HOSTNAMES 16
const char* hostnames[MAX_HOSTNAMES];
+ const char* portnum;
int hostindex;
int n_hostnames;