Code

Second implementation of the `processes' plugin for Mac OS X - this time with process...
[collectd.git] / src / battery.c
index ab5a042465cca4c5c45d91cc48bac2755a4c90a9..201280c9e1688358a80e5363df0e0afc44851c05 100644 (file)
@@ -41,27 +41,29 @@ static char *battery_charge_file  = "battery-%s/charge.rrd";
 
 static char *ds_def_current[] =
 {
-       "DS:current:GAUGE:25:U:U",
+       "DS:current:GAUGE:"COLLECTD_HEARTBEAT":U:U",
        NULL
 };
 static int ds_num_current = 1;
 
 static char *ds_def_voltage[] =
 {
-       "DS:voltage:GAUGE:25:U:U",
+       "DS:voltage:GAUGE:"COLLECTD_HEARTBEAT":U:U",
        NULL
 };
 static int ds_num_voltage = 1;
 
 static char *ds_def_charge[] =
 {
-       "DS:charge:GAUGE:25:0:U",
+       "DS:charge:GAUGE:"COLLECTD_HEARTBEAT":0:U",
        NULL
 };
 static int ds_num_charge = 1;
 
+#if BATTERY_HAVE_READ
 static int   battery_pmu_num = 0;
 static char *battery_pmu_file = "/proc/pmu/battery_%i";
+#endif
 
 static void battery_init (void)
 {
@@ -300,7 +302,7 @@ static void battery_read (void)
                                if ((strcmp (fields[0], "charging") == 0)
                                                && (strcmp (fields[1], "state:") == 0))
                                {
-                                       if (strcmp (fields[2], "charging"))
+                                       if (strcmp (fields[2], "charging") == 0)
                                                charging = 1;
                                        else
                                                charging = 0;