summaryrefslogtreecommitdiff
path: root/src/collectl2pcp/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/collectl2pcp/load.c')
-rw-r--r--src/collectl2pcp/load.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/collectl2pcp/load.c b/src/collectl2pcp/load.c
new file mode 100644
index 0000000..9343415
--- /dev/null
+++ b/src/collectl2pcp/load.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013 Red Hat Inc.
+ *
+ * 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
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * Handler for load average
+ * "load 1.07 1.18 1.30 3/658 4944"
+ *
+ */
+
+#include "metrics.h"
+
+int
+loadavg_handler(handler_t *h, fields_t *f)
+{
+ pmInDom indom = pmInDom_build(LINUX_DOMAIN, LOADAVG_INDOM);
+ if (f->nfields < 4)
+ return -1;
+ put_str_value("kernel.all.load", indom, "1 minute", f->fields[1]);
+ put_str_value("kernel.all.load", indom, "5 minute", f->fields[2]);
+ put_str_value("kernel.all.load", indom, "15 minute", f->fields[3]);
+
+ return 0;
+}