summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6485358)
raw | patch | inline | side by side (parent: 6485358)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 10 Jul 2006 10:10:23 +0000 (12:10 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 10 Jul 2006 10:10:23 +0000 (12:10 +0200) |
src/apcups.c | patch | blob | history |
diff --git a/src/apcups.c b/src/apcups.c
index 9117bdaea02f641e12a28d3d0be76c3d1393b4f6..a9227ab29458d287d5d11018ee26dc600ea00fe3 100644 (file)
--- a/src/apcups.c
+++ b/src/apcups.c
double value;
static int sockfd = -1;
- static unsigned int complain = 0;
+ static complain_t compl;
#if APCMAIN
# define PRINT_VALUE(name, val) printf(" Found property: name = %s; value = %f;\n", name, val)
{
if ((sockfd = net_open (host, NULL, port)) < 0)
{
- /* Complain once every six hours. */
- int complain_step = 21600 / atoi (COLLECTD_STEP);
-
- if ((complain % complain_step) == 0)
- syslog (LOG_ERR, "apcups plugin: Connecting to the apcupsd failed.");
- complain++;
-
+ plugin_complain (LOG_ERR, &compl, "apcups plugin: "
+ "Connecting to the apcupsd failed.");
return (-1);
}
- else if (complain > 1)
+ else
{
- syslog (LOG_NOTICE, "apcups plugin: Connection re-established to the apcupsd.");
- complain = 0;
+ plugin_relief (LOG_NOTICE, &compl, "apcups plugin: "
+ "Connection re-established to the apcupsd.");
}
}