X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fswap.c;h=4f0a0ba945459c9dab443412d955e60158ebfde8;hb=6ddbe0026dea748db40ccc494b4f5048817b346a;hp=4a414b70d21805890fa3abdc38f9cfa059224311;hpb=12c1e32ec71ffd5d90af5df4b430fba04d91aed5;p=collectd.git diff --git a/src/swap.c b/src/swap.c index 4a414b70..4f0a0ba9 100644 --- a/src/swap.c +++ b/src/swap.c @@ -36,6 +36,10 @@ # include #endif +#if HAVE_STATGRAB_H +# include +#endif + #undef MAX #define MAX(x,y) ((x) > (y) ? (x) : (y)) @@ -122,9 +126,10 @@ static void swap_submit (const char *type_instance, double value) vl.time = time (NULL); strcpy (vl.host, hostname_g); strcpy (vl.plugin, "swap"); - strncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); + strcpy (vl.type, "swap"); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - plugin_dispatch_values ("swap", &vl); + plugin_dispatch_values (&vl); } /* void swap_submit */ static int swap_read (void) @@ -232,7 +237,7 @@ static int swap_read (void) swap_submit ("used", swap_alloc); swap_submit ("free", swap_avail); - swap_submit ("reserved", swap_resv - swap_alloc); + swap_submit ("reserved", swap_resv); /* #endif HAVE_LIBKSTAT */ #elif defined(VM_SWAPUSAGE)