diff --git a/src/core/plugin.c b/src/core/plugin.c
index 235b8c7721ba97d08dc1b165c6ac0812ed7c6292..54f3f7f09f7f39f20c17fb0856db21df4fbd3e7d 100644 (file)
--- a/src/core/plugin.c
+++ b/src/core/plugin.c
sdb_plugin_store_service(const char *hostname, const char *name,
sdb_time_t last_update)
{
- char *cname;
-
sdb_llist_iter_t *iter;
+ sdb_data_t d;
+
+ char *cname;
int status = 0;
if ((! hostname) || (! name))
status = s;
}
sdb_llist_iter_destroy(iter);
+
+ if (! status) {
+ /* record the hostname as an attribute */
+ d.type = SDB_TYPE_STRING;
+ d.data.string = cname;
+ if (sdb_plugin_store_service_attribute(cname, name,
+ "hostname", &d, last_update))
+ status = -1;
+ }
+
free(cname);
return status;
} /* sdb_plugin_store_service */
sdb_plugin_store_metric(const char *hostname, const char *name,
sdb_metric_store_t *store, sdb_time_t last_update)
{
- char *cname;
-
sdb_llist_iter_t *iter;
+ sdb_data_t d;
+
+ char *cname;
int status = 0;
if ((! hostname) || (! name))
status = s;
}
sdb_llist_iter_destroy(iter);
+
+ if (! status) {
+ /* record the hostname as an attribute */
+ d.type = SDB_TYPE_STRING;
+ d.data.string = cname;
+ if (sdb_plugin_store_metric_attribute(cname, name,
+ "hostname", &d, last_update))
+ status = -1;
+ }
+
free(cname);
return status;
} /* sdb_plugin_store_metric */