summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e1f8ca7)
raw | patch | inline | side by side (parent: e1f8ca7)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 1 Dec 2009 11:07:57 +0000 (12:07 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 1 Dec 2009 11:07:57 +0000 (12:07 +0100) |
src/collectd.conf.pod | patch | blob | history | |
src/routeros.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 6609e692e04a8cf1e2822ba5a9bcba57e72d34b0..d73d9fcebf079447aef996f5faab021f16caa5fe 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Host "router0.example.com"
User "collectd"
Password "secr3t"
+ CollectInterface true
</Router>
<Router>
Host "router1.example.com"
User "collectd"
Password "5ecret"
+ CollectInterface true
+ CollectRegistrationTable true
</Router>
</Plugin>
Set the password used to authenticate.
+=item B<CollectInterface> B<true>|B<false>
+
+When set to B<true>, interface statistics will be collected for all interfaces
+present on the device. Defaults to B<false>.
+
+=item B<CollectRegistrationTable> B<true>|B<false>
+
+When set to B<true>, information about wireless LAN connections will be
+collected. Defaults to B<false>.
+
=back
=head2 Plugin C<rrdcached>
diff --git a/src/routeros.c b/src/routeros.c
index 48333b5d4ac2a690456ee5a109791b7799b1e33e..02c96d7501039a4ad88cabaaee74dd14a89da9f2 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
char *service;
char *username;
char *password;
+
+ _Bool collect_interface;
+ _Bool collect_regtable;
};
typedef struct cr_data_s cr_data_t;
}
assert (rd->connection != NULL);
- status = ros_interface (rd->connection, handle_interface,
- /* user data = */ NULL);
- if (status != 0)
+ if (rd->collect_interface)
{
- char errbuf[128];
- ERROR ("routeros plugin: ros_interface failed: %s",
- sstrerror (status, errbuf, sizeof (errbuf)));
- ros_disconnect (rd->connection);
- rd->connection = NULL;
- return (-1);
+ status = ros_interface (rd->connection, handle_interface,
+ /* user data = */ NULL);
+ if (status != 0)
+ {
+ char errbuf[128];
+ ERROR ("routeros plugin: ros_interface failed: %s",
+ sstrerror (status, errbuf, sizeof (errbuf)));
+ ros_disconnect (rd->connection);
+ rd->connection = NULL;
+ return (-1);
+ }
}
- status = ros_registration_table (rd->connection, handle_regtable,
- /* user data = */ NULL);
- if (status != 0)
+ if (rd->collect_regtable)
{
- char errbuf[128];
- ERROR ("routeros plugin: ros_registration_table failed: %s",
- sstrerror (status, errbuf, sizeof (errbuf)));
- ros_disconnect (rd->connection);
- rd->connection = NULL;
- return (-1);
+ status = ros_registration_table (rd->connection, handle_regtable,
+ /* user data = */ NULL);
+ if (status != 0)
+ {
+ char errbuf[128];
+ ERROR ("routeros plugin: ros_registration_table failed: %s",
+ sstrerror (status, errbuf, sizeof (errbuf)));
+ ros_disconnect (rd->connection);
+ rd->connection = NULL;
+ return (-1);
+ }
}
return (0);
router_data->service = NULL;
router_data->username = NULL;
router_data->password = NULL;
+ router_data->collect_interface = false;
+ router_data->collect_regtable = false;
status = 0;
for (i = 0; i < ci->children_num; i++)
else if (strcasecmp ("User", child->key) == 0)
status = cf_util_get_string (child, &router_data->username);
else if (strcasecmp ("Password", child->key) == 0)
- status = cf_util_get_string (child, &router_data->service);
+ status = cf_util_get_string (child, &router_data->password);
+ else if (strcasecmp ("CollectInterface", child->key) == 0)
+ cf_util_get_boolean (child, &router_data->collect_interface);
+ else if (strcasecmp ("CollectRegistrationTable", child->key) == 0)
+ cf_util_get_boolean (child, &router_data->collect_regtable);
else
{
WARNING ("routeros plugin: Unknown config option `%s'.", child->key);
"How should I authenticate?");
status = -1;
}
+
+ if (!router_data->collect_interface
+ && !router_data->collect_regtable)
+ {
+ ERROR ("routeros plugin: No `Collect*' option within a `Router' block. "
+ "What statistics should I collect?");
+ status = -1;
+ }
}
if ((status == 0) && (router_data->username == NULL))