diff --git a/src/load.c b/src/load.c
index 2c02d8be0d7890933c35b9d6ebc3d18c889d8f5b..019f952c07066e7c753dbd193cc40d58ccab11d6 100644 (file)
--- a/src/load.c
+++ b/src/load.c
/**
* collectd - src/load.c
/**
* collectd - src/load.c
- * Copyright (C) 2005 Florian octo Forster
+ * Copyright (C) 2005,2006 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
static char *ds_def[] =
{
static char *ds_def[] =
{
- "DS:shortterm:GAUGE:25:0:100",
- "DS:midterm:GAUGE:25:0:100",
- "DS:longterm:GAUGE:25:0:100",
+ "DS:shortterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
+ "DS:midterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
+ "DS:longterm:GAUGE:"COLLECTD_HEARTBEAT":0:100",
NULL
};
static int ds_num = 3;
NULL
};
static int ds_num = 3;
-void load_init (void)
+static void load_init (void)
{
return;
}
{
return;
}
-void load_write (char *host, char *inst, char *val)
+static void load_write (char *host, char *inst, char *val)
{
rrd_update_file (host, load_file, val, ds_def, ds_num);
}
{
rrd_update_file (host, load_file, val, ds_def, ds_num);
}
+#if LOAD_HAVE_READ
#define BUFSIZE 256
#define BUFSIZE 256
-void load_submit (double snum, double mnum, double lnum)
+static void load_submit (double snum, double mnum, double lnum)
{
char buf[BUFSIZE];
{
char buf[BUFSIZE];
}
#undef BUFSIZE
}
#undef BUFSIZE
-#if LOAD_HAVE_READ
-void load_read (void)
+static void load_read (void)
{
#if defined(HAVE_GETLOADAVG)
double load[3];
{
#if defined(HAVE_GETLOADAVG)
double load[3];
if (fgets (buffer, 16, loadavg) == NULL)
{
syslog (LOG_WARNING, "load: fgets: %s", strerror (errno));
if (fgets (buffer, 16, loadavg) == NULL)
{
syslog (LOG_WARNING, "load: fgets: %s", strerror (errno));
+ fclose (loadavg);
return;
}
return;
}
load_submit (snum, mnum, lnum);
#endif /* HAVE_LIBSTATGRAB */
}
load_submit (snum, mnum, lnum);
#endif /* HAVE_LIBSTATGRAB */
}
+#else
+# define load_read NULL
#endif /* LOAD_HAVE_READ */
void module_register (void)
{
#endif /* LOAD_HAVE_READ */
void module_register (void)
{
- plugin_register (MODULE_NAME, load_init,
-#if LOAD_HAVE_READ
- load_read,
-#else
- NULL,
-#endif
- load_write);
+ plugin_register (MODULE_NAME, load_init, load_read, load_write);
}
#undef MODULE_NAME
}
#undef MODULE_NAME