load plugin: Set the hostname to something meaningfull, not `localhost'.
[collectd.git] / src / load.c
index bff629d..e715dcf 100644 (file)
@@ -68,7 +68,14 @@ 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);
+       /* FIXME: do this globally */
+       if (gethostname (vl.host, sizeof (vl.host)) != 0)
+       {
+               syslog (LOG_ERR, "load plugin: gethostname failed: %s",
+                               strerror (errno));
+               return;
+       }
        strcpy (vl.plugin, "load");
        strcpy (vl.plugin_instance, "");
        strcpy (vl.type_instance, "");