summaryrefslogtreecommitdiffstats
path: root/src/collectors/freebsd.plugin/freebsd_sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/collectors/freebsd.plugin/freebsd_sysctl.c')
-rw-r--r--src/collectors/freebsd.plugin/freebsd_sysctl.c53
1 files changed, 8 insertions, 45 deletions
diff --git a/src/collectors/freebsd.plugin/freebsd_sysctl.c b/src/collectors/freebsd.plugin/freebsd_sysctl.c
index 93ec98dc..0fa71027 100644
--- a/src/collectors/freebsd.plugin/freebsd_sysctl.c
+++ b/src/collectors/freebsd.plugin/freebsd_sysctl.c
@@ -24,6 +24,10 @@
#include <netinet/udp.h>
#include <netinet/udp_var.h>
+#define _COMMON_PLUGIN_NAME "freebsd.plugin"
+#define _COMMON_PLUGIN_MODULE_NAME "freebsd"
+#include "../common-contexts/common-contexts.h"
+
// --------------------------------------------------------------------------------------------------------------------
// common definitions and variables
@@ -574,28 +578,7 @@ int do_hw_intcnt(int update_every, usec_t dt) {
static RRDSET *st_intr = NULL;
static RRDDIM *rd_intr = NULL;
- if (unlikely(!st_intr)) {
- st_intr = rrdset_create_localhost(
- "system",
- "intr",
- NULL,
- "interrupts",
- NULL,
- "Total Hardware Interrupts",
- "interrupts/s",
- "freebsd.plugin",
- "hw.intrcnt",
- NETDATA_CHART_PRIO_SYSTEM_INTR,
- update_every,
- RRDSET_TYPE_LINE
- );
- rrdset_flag_set(st_intr, RRDSET_FLAG_DETAIL);
-
- rd_intr = rrddim_add(st_intr, "interrupts", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL);
- }
-
- rrddim_set_by_pointer(st_intr, rd_intr, totalintr);
- rrdset_done(st_intr);
+ common_interrupts(totalintr, update_every, "hw.intrcnt");
size_t size;
static int mib_hw_intrnames[2] = {0, 0};
@@ -1159,30 +1142,10 @@ int do_kern_ipc_sem(int update_every, usec_t dt) {
}
}
- static RRDSET *st_semaphores = NULL, *st_semaphore_arrays = NULL;
- static RRDDIM *rd_semaphores = NULL, *rd_semaphore_arrays = NULL;
-
- if (unlikely(!st_semaphores)) {
- st_semaphores = rrdset_create_localhost(
- "system",
- "ipc_semaphores",
- NULL,
- "ipc semaphores",
- NULL,
- "IPC Semaphores",
- "semaphores",
- "freebsd.plugin",
- "kern.ipc.sem",
- NETDATA_CHART_PRIO_SYSTEM_IPC_SEMAPHORES,
- update_every,
- RRDSET_TYPE_AREA
- );
-
- rd_semaphores = rrddim_add(st_semaphores, "semaphores", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE);
- }
+ static RRDSET *st_semaphore_arrays = NULL;
+ static RRDDIM *rd_semaphore_arrays = NULL;
- rrddim_set_by_pointer(st_semaphores, rd_semaphores, ipc_sem.semaphores);
- rrdset_done(st_semaphores);
+ common_semaphore_ipc(ipc_sem.semaphores, 0.0, "kern.ipc.sem", update_every);
if (unlikely(!st_semaphore_arrays)) {
st_semaphore_arrays = rrdset_create_localhost(