**/
#include "collectd.h"
+
#include "common.h"
#include "plugin.h"
vl.values = values;
vl.values_len = values_len;
- sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vmem", sizeof (vl.plugin));
if (plugin_instance != NULL)
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
static void submit_two (const char *plugin_instance, const char *type,
const char *type_instance, derive_t c0, derive_t c1)
{
- value_t values[2];
-
- values[0].derive = c0;
- values[1].derive = c1;
+ value_t values[] = {
+ { .derive = c0 },
+ { .derive = c1 },
+ };
- submit (plugin_instance, type, type_instance, values, 2);
+ submit (plugin_instance, type, type_instance,
+ values, STATIC_ARRAY_SIZE (values));
} /* void submit_one */
static void submit_one (const char *plugin_instance, const char *type,
if (fields[1] == endptr)
continue;
- /*
+ /*
* Number of pages
*
* The total number of {inst} pages, e. g dirty pages.
}
}
- /*
+ /*
* Page in and page outs. For memory and swap.
*/
else if (strcmp ("pgpgin", key) == 0)
value_t value = { .derive = counter };
submit_one (inst, "vmpage_action", "refill", value);
}
+ else if (strncmp ("pgsteal_kswapd_", key, strlen ("pgsteal_kswapd_")) == 0)
+ {
+ char *inst = key + strlen ("pgsteal_kswapd_");
+ value_t value = { .derive = counter };
+ submit_one (inst, "vmpage_action", "steal_kswapd", value);
+ }
+ else if (strncmp ("pgsteal_direct_", key, strlen ("pgsteal_direct_")) == 0)
+ {
+ char *inst = key + strlen ("pgsteal_direct_");
+ value_t value = { .derive = counter };
+ submit_one (inst, "vmpage_action", "steal_direct", value);
+ }
+ /* For backwards compatibility (somewhen before 4.2.3) */
else if (strncmp ("pgsteal_", key, strlen ("pgsteal_")) == 0)
{
char *inst = key + strlen ("pgsteal_");