summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de3d8a4)
raw | patch | inline | side by side (parent: de3d8a4)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 10 Jul 2006 11:43:28 +0000 (13:43 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Mon, 10 Jul 2006 11:43:28 +0000 (13:43 +0200) |
src/cpu.c | patch | blob | history |
diff --git a/src/cpu.c b/src/cpu.c
index ca78294161b35e0add065654c261d14c07f16904..b087d6654d2edfa84480fd5e6d5dffec80aa5392 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
char *fields[9];
int numfields;
+ static complain_t complain_obj;
+
if ((fh = fopen ("/proc/stat", "r")) == NULL)
{
- syslog (LOG_WARNING, "cpu: fopen: %s", strerror (errno));
+ plugin_complain (LOG_ERR, &complain_obj, "cpu plugin: "
+ "fopen (/proc/stat) failed: %s",
+ strerror (errno));
return;
}
+ plugin_relief (LOG_NOTICE, &complain_obj, "cpu plugin: "
+ "fopen (/proc/stat) succeeded.");
+
while (fgets (buf, BUFSIZE, fh) != NULL)
{
if (strncmp (buf, "cpu", 3))
long cpuinfo[CPUSTATES];
size_t cpuinfo_size;
+ static complain_t complain_obj;
+
cpuinfo_size = sizeof (cpuinfo);
if (sysctlbyname("kern.cp_time", &cpuinfo, &cpuinfo_size, NULL, 0) < 0)
{
- syslog (LOG_WARNING, "cpu: sysctlbyname: %s", strerror (errno));
+ plugin_complain (LOG_ERR, &complain_obj, "cpu plugin: "
+ "sysctlbyname failed: %s.",
+ strerror (errno));
return;
}
+ plugin_relief (LOG_NOTICE, &complain_obj, "cpu plugin: "
+ "sysctlbyname succeeded.");
+
cpuinfo[CP_SYS] += cpuinfo[CP_INTR];
/* FIXME: Instance is always `0' */