unixsock plugin: Transmit the DS name so clients can chose which values they need.
[collectd.git] / src / load.c
index e8dabaa..491a985 100644 (file)
@@ -4,8 +4,7 @@
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
+ * Free Software Foundation; only version 2 of the License is applicable.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 #endif
 #endif /* defined(HAVE_GETLOADAVG) */
 
-data_source_t dsrc[3] =
+static data_source_t dsrc[3] =
 {
        {"shortterm", DS_TYPE_GAUGE, 0.0, 100.0},
        {"midterm",   DS_TYPE_GAUGE, 0.0, 100.0},
        {"longterm",  DS_TYPE_GAUGE, 0.0, 100.0}
 };
 
-data_set_t ds =
+static data_set_t ds =
 {
        "load", 3, dsrc
 };
@@ -60,7 +59,7 @@ data_set_t ds =
 static void load_submit (double snum, double mnum, double lnum)
 {
        value_t values[3];
-       value_list_t vl;
+       value_list_t vl = VALUE_LIST_INIT;
 
        values[0].gauge = snum;
        values[1].gauge = mnum;
@@ -68,7 +67,8 @@ static void load_submit (double snum, double mnum, double lnum)
 
        vl.values = values;
        vl.values_len = 3;
-       strcpy (vl.host, "localhost"); /* FIXME */
+       vl.time = time (NULL);
+       strcpy (vl.host, hostname);
        strcpy (vl.plugin, "load");
        strcpy (vl.plugin_instance, "");
        strcpy (vl.type_instance, "");