diff --git a/src/backend/collectd.c b/src/backend/collectd.c
index ad5cad1b439906b31248963b33b4b99b23fd4870..d7cbf661d1d44677257f2bd0c186587cff184956 100644 (file)
--- a/src/backend/collectd.c
+++ b/src/backend/collectd.c
{
sc_host_t host = SC_HOST_INIT;
+ int status;
+
host.host_name = hostname;
host.host_last_update = last_update;
- if (sc_store_host(&host)) {
+ status = sc_store_host(&host);
+
+ if (status < 0) {
fprintf(stderr, "collectd backend: Failed to store/update "
"host '%s'.\n", hostname);
return -1;
}
+ else if (status > 0) /* value too old */
+ return 0;
fprintf(stderr, "collectd backend: Added/updated host '%s' "
"(last update timestamp = %"PRIscTIME").\n",
{
sc_service_t svc = SC_SVC_INIT;
+ int status;
+
svc.hostname = hostname;
svc.svc_name = name;
svc.svc_last_update = last_update;
- if (sc_store_service(&svc)) {
+ status = sc_store_service(&svc);
+ if (status < 0) {
fprintf(stderr, "collectd backend: Failed to store/update "
"service '%s/%s'.\n", hostname, name);
return -1;