-static void
-connectivity_dispatch_notification(const char *interface, const char *type,
- gauge_t value, gauge_t old_value,
- long long unsigned int timestamp) {
-
- notification_t n = {(value == LINK_STATE_UP ? NOTIF_OKAY : NOTIF_FAILURE),
- cdtime(),
- "",
- "",
- "connectivity",
- "",
- "",
- "",
- NULL};
-
- sstrncpy(n.host, hostname_g, sizeof(n.host));
- sstrncpy(n.plugin_instance, interface, sizeof(n.plugin_instance));
- sstrncpy(n.type, "gauge", sizeof(n.type));
- sstrncpy(n.type_instance, "interface_status", sizeof(n.type_instance));
-
- char *buf = NULL;
-
- gen_message_payload(value, old_value, interface, timestamp, &buf);
-
- notification_meta_t *m = calloc(1, sizeof(*m));
-
- if (m == NULL) {
- sfree(buf);
- ERROR("connectivity plugin: unable to allocate metadata: %s", STRERRNO);
- return;
- }
-
- sstrncpy(m->name, "ves", sizeof(m->name));
- m->nm_value.nm_string = sstrdup(buf);
- m->type = NM_TYPE_STRING;
- n.meta = m;
-
- DEBUG("connectivity plugin: notification message: %s",
- n.meta->nm_value.nm_string);
-
- DEBUG("connectivity plugin: dispatching state %d for interface %s",
- (int)value, interface);
-
- plugin_dispatch_notification(&n);
- plugin_notification_meta_free(n.meta);
-
- // strdup'd in gen_message_payload
- if (buf != NULL)
- sfree(buf);
-}
-