projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
src/configfile.c: Pass the `oconfig_item_t' types to the plugins if they request it.
[collectd.git]
/
src
/
swap.c
diff --git
a/src/swap.c
b/src/swap.c
index
945c758
..
3018cb9
100644
(file)
--- a/
src/swap.c
+++ b/
src/swap.c
@@
-45,16
+45,6
@@
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#undef MAX
#define MAX(x,y) ((x) > (y) ? (x) : (y))
-static data_source_t data_source[1] =
-{
- {"value", DS_TYPE_GAUGE, 0, 1099511627776.0}
-};
-
-static data_set_t data_set =
-{
- "swap", 1, data_source
-};
-
#if SWAP_HAVE_READ
#if KERNEL_LINUX
/* No global variables */
#if SWAP_HAVE_READ
#if KERNEL_LINUX
/* No global variables */
@@
-156,7
+146,9
@@
static int swap_read (void)
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
if ((fh = fopen ("/proc/meminfo", "r")) == NULL)
{
- WARNING ("memory: fopen: %s", strerror (errno));
+ char errbuf[1024];
+ WARNING ("memory: fopen: %s",
+ sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
return (-1);
}
@@
-182,7
+174,11
@@
static int swap_read (void)
}
if (fclose (fh))
}
if (fclose (fh))
- WARNING ("memory: fclose: %s", strerror (errno));
+ {
+ char errbuf[1024];
+ WARNING ("memory: fclose: %s",
+ sstrerror (errno, errbuf, sizeof (errbuf)));
+ }
if ((swap_total == 0LL) || ((swap_free + swap_cached) > swap_total))
return (-1);
if ((swap_total == 0LL) || ((swap_free + swap_cached) > swap_total))
return (-1);
@@
-203,8
+199,9
@@
static int swap_read (void)
if (swapctl (SC_AINFO, &ai) == -1)
{
if (swapctl (SC_AINFO, &ai) == -1)
{
+ char errbuf[1024];
ERROR ("swap plugin: swapctl failed: %s",
ERROR ("swap plugin: swapctl failed: %s",
- s
trerror (errno
));
+ s
strerror (errno, errbuf, sizeof (errbuf)
));
return (-1);
}
return (-1);
}
@@
-307,10
+304,8
@@
static int swap_read (void)
void module_register (void)
{
void module_register (void)
{
- plugin_register_data_set (&data_set);
-
#if SWAP_HAVE_READ
plugin_register_init ("swap", swap_init);
plugin_register_read ("swap", swap_read);
#endif /* SWAP_HAVE_READ */
#if SWAP_HAVE_READ
plugin_register_init ("swap", swap_init);
plugin_register_read ("swap", swap_read);
#endif /* SWAP_HAVE_READ */
-}
+}
/* void module_register */