summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b35851e)
raw | patch | inline | side by side (parent: b35851e)
author | octo <octo> | |
Sat, 20 May 2006 10:27:04 +0000 (10:27 +0000) | ||
committer | octo <octo> | |
Sat, 20 May 2006 10:27:04 +0000 (10:27 +0000) |
src/apcups.c | patch | blob | history |
diff --git a/src/apcups.c b/src/apcups.c
index d7bf6be356aa27727c764ae0e17d9f73373b6ae2..4f5f760ebb12daa5e2dad73625ae5a11e7a01dfe 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
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);