return 0;
}
#else
-static void apcups_init (void)
-{
- return;
-}
-
static int apcups_config (char *key, char *value)
{
static char lhost[126];
return(0);
}
-#define BUFSIZE 256
+static void apcups_init (void)
+{
+ return;
+}
+
+static void apc_write_voltage (char *host, char *inst, char *val)
+{
+ char file[512];
+ int status;
+
+ status = snprintf (file, 512, bvolt_file_template, inst);
+ if ((status < 1) || (status >= 512))
+ return;
+
+ rrd_update_file (host, file, val, bvolt_ds_def, bvolt_ds_num);
+}
+
+static void apc_write_charge (char *host, char *inst, char *val)
+{
+ rrd_update_file (host, charge_file_template, val, charge_ds_def, charge_ds_num);
+}
+
+static void apc_write_percent (char *host, char *inst, char *val)
+{
+ rrd_update_file (host, load_file_template, val, load_ds_def, load_ds_num);
+}
+
+static void apc_write_timeleft (char *host, char *inst, char *val)
+{
+ rrd_update_file (host, time_file_template, val, time_ds_def, time_ds_num);
+}
+
+static void apc_write_temperature (char *host, char *inst, char *val)
+{
+ rrd_update_file (host, temp_file_template, val, temp_ds_def, temp_ds_num);
+}
+
+static void apc_write_frequency (char *host, char *inst, char *val)
+{
+ char file[512];
+ int status;
+
+ status = snprintf (file, 512, freq_file_template, inst);
+ if ((status < 1) || (status >= 512))
+ return;
+
+ rrd_update_file (host, file, val, freq_ds_def, freq_ds_num);
+}
+
static void apc_submit_generic (char *type, char *inst,
double value)
{
apc_submit_generic ("apcups_temp", "-", apcups_detail->itemp);
apc_submit_generic ("apcups_frequency", "input", apcups_detail->linefreq);
}
-#undef BUFSIZE
static void apcups_read (void)
{
apc_submit (&apcups_detail);
} /* apcups_read */
-static void apc_write_voltage (char *host, char *inst, char *val)
-{
- char file[512];
- int status;
-
- status = snprintf (file, 512, bvolt_file_template, inst);
- if ((status < 1) || (status >= 512))
- return;
-
- rrd_update_file (host, file, val, bvolt_ds_def, bvolt_ds_num);
-}
-
-static void apc_write_charge (char *host, char *inst, char *val)
-{
- rrd_update_file (host, charge_file_template, val, charge_ds_def, charge_ds_num);
-}
-
-static void apc_write_percent (char *host, char *inst, char *val)
-{
- rrd_update_file (host, load_file_template, val, load_ds_def, load_ds_num);
-}
-
-static void apc_write_timeleft (char *host, char *inst, char *val)
-{
- rrd_update_file (host, time_file_template, val, time_ds_def, time_ds_num);
-}
-
-static void apc_write_temperature (char *host, char *inst, char *val)
-{
- rrd_update_file (host, temp_file_template, val, temp_ds_def, temp_ds_num);
-}
-
-static void apc_write_frequency (char *host, char *inst, char *val)
-{
- char file[512];
- int status;
-
- status = snprintf (file, 512, freq_file_template, inst);
- if ((status < 1) || (status >= 512))
- return;
-
- rrd_update_file (host, file, val, freq_ds_def, freq_ds_num);
-}
-
void module_register (void)
{
plugin_register (MODULE_NAME, apcups_init, apcups_read, NULL);