summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2412d3c)
raw | patch | inline | side by side (parent: 2412d3c)
author | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Tue, 14 Feb 2017 12:15:28 +0000 (12:15 +0000) | ||
committer | Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com> | |
Wed, 22 Feb 2017 11:25:39 +0000 (11:25 +0000) |
Change-Id: Ib1853ff8caf57c6e33171e9d419af84c2ce69cae
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
ovs_events: Revert changing SendNotification default
Change-Id: I5e318e132937301aac355dcedaf3474a623f3853
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
ovs_events: Revert changing SendNotification default
Change-Id: I5e318e132937301aac355dcedaf3474a623f3853
Signed-off-by: Mytnyk, VolodymyrX <volodymyrx.mytnyk@intel.com>
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/ovs_events.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index ed2d54975601837a076451227b78719d0cc49072..e556779342b71181cfca706a281aa715d77d70bb 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# Socket "/var/run/openvswitch/db.sock"
# Interfaces "br0" "veth0"
# SendNotification false
+# DispatchValues true
#</Plugin>
#<Plugin perl>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 29b79799d3870f60dd8d67fb597bfadd640d07a4..730696a3f92e42b6e94c77a4314a60837bb6ed94 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Socket "/var/run/openvswitch/db.sock"
Interfaces "br0" "veth0"
SendNotification false
+ DispatchValues true
</Plugin>
The plugin provides the following configuration options:
If set to true, OVS link notifications (interface status and OVS DB connection
terminate) are sent to collectd. Default value is false.
+=item B<DispatchValues> I<true|false>
+
+Dispatch the OVS DB interface link status value with configured plugin interval.
+Defaults to true. Please note, if B<SendNotification> and B<DispatchValues>
+options are false, no OVS information will be provided by the plugin.
+
=back
B<Note:> By default, the global interval setting is used within which to
diff --git a/src/ovs_events.c b/src/ovs_events.c
index c77bde4a436eb3a079321f78541c33a3ce3f3bab..8c2cd12cb296f8ac3fc22ada9a6b2b8d266b0f9e 100644 (file)
--- a/src/ovs_events.c
+++ b/src/ovs_events.c
.ovs_db_serv = "6640"} /* use default OVS DB service */
};
+/* Forward declaration */
+static int ovs_events_plugin_read(user_data_t *u);
+
/* This function is used only by "OVS_EVENTS_CTX_LOCK" define (see above).
* It always returns 1 when context is locked.
*/
* in allocated memory. Returns negative value in case of error.
*/
static int ovs_events_plugin_config(oconfig_item_t *ci) {
+ _Bool dispatch_values = 1;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("SendNotification", child->key) == 0) {
ovs_events_config_free();
return (-1);
}
+ } else if (strcasecmp("DispatchValues", child->key) == 0) {
+ if (cf_util_get_boolean(child, &dispatch_values) != 0) {
+ ovs_events_config_free();
+ return (-1);
+ }
} else {
ERROR(OVS_EVENTS_PLUGIN ": option '%s' is not allowed here", child->key);
ovs_events_config_free();
return (-1);
}
}
+ /* Check and warn about invalid configuration */
+ if (!ovs_events_ctx.config.send_notification && !dispatch_values) {
+ WARNING(OVS_EVENTS_PLUGIN ": send notification and dispatch values "
+ "options are disabled. No information will be dispatched by the "
+ "plugin. Please check your configuration");
+ }
+ /* Dispatch link status values if configured */
+ if (dispatch_values)
+ return plugin_register_complex_read(NULL, OVS_EVENTS_PLUGIN,
+ ovs_events_plugin_read, 0, NULL);
+
return (0);
}
void module_register(void) {
plugin_register_complex_config(OVS_EVENTS_PLUGIN, ovs_events_plugin_config);
plugin_register_init(OVS_EVENTS_PLUGIN, ovs_events_plugin_init);
- plugin_register_complex_read(NULL, OVS_EVENTS_PLUGIN, ovs_events_plugin_read,
- 0, NULL);
plugin_register_shutdown(OVS_EVENTS_PLUGIN, ovs_events_plugin_shutdown);
}