summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8b78df2)
raw | patch | inline | side by side (parent: 8b78df2)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 23 Dec 2007 10:44:01 +0000 (11:44 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sun, 23 Dec 2007 10:44:01 +0000 (11:44 +0100) |
It is generated when a value was missing and is received again.
src/utils_cache.c | patch | blob | history |
diff --git a/src/utils_cache.c b/src/utils_cache.c
index 560365b75a1dd079b9036f5103d24e522a83fc41..77b38ebe52e0c93dd414554f4819bc242987f0fe 100644 (file)
--- a/src/utils_cache.c
+++ b/src/utils_cache.c
{
char name[6 * DATA_MAX_NAME_LEN];
cache_entry_t *ce = NULL;
+ int send_okay_notification = 0;
if (FORMAT_VL (name, sizeof (name), vl, ds) != 0)
{
if ((ce->last_time + ce->interval) < vl->time)
{
- /* TODO: Implement a `real' okay notification. Watch out for locking
- * issues, though! */
- NOTICE ("uc_insert: Okay notification for %s", name);
+ send_okay_notification = vl->time - ce->last_time;
ce->state = STATE_OKAY;
}
pthread_mutex_unlock (&cache_lock);
+ if (send_okay_notification > 0)
+ {
+ notification_t n;
+ memset (&n, '\0', sizeof (n));
+
+ n.severity = NOTIF_OKAY;
+ strncpy (n.host, vl->host, sizeof (n.host));
+ n.host[sizeof (n.host) - 1] = '\0';
+ n.time = vl->time;
+
+ snprintf (n.message, sizeof (n.message),
+ "Received a value for %s. It was missing for %i seconds.",
+ name, send_okay_notification);
+ n.message[sizeof (n.message) - 1] = '\0';
+
+ plugin_dispatch_notification (&n);
+ }
+
return (0);
} /* int uc_insert */