Skip to content

Commit

Permalink
in_node_exporter_metrics: Support diskstats metrics on macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <[email protected]>
  • Loading branch information
cosmo0920 committed Sep 20, 2023
1 parent 7eeff24 commit 4cde143
Show file tree
Hide file tree
Showing 5 changed files with 493 additions and 3 deletions.
6 changes: 5 additions & 1 deletion plugins/in_node_exporter_metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ set(src
)
endif()

FLB_PLUGIN(in_node_exporter_metrics "${src}" "")
if (APPLE)
FLB_PLUGIN(in_node_exporter_metrics "${src}" "-framework Foundation -framework IOKit")
else()
FLB_PLUGIN(in_node_exporter_metrics "${src}" "")
endif()
2 changes: 1 addition & 1 deletion plugins/in_node_exporter_metrics/ne.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#ifdef __linux__
#define NE_DEFAULT_ENABLED_METRICS "cpu,cpufreq,meminfo,diskstats,filesystem,uname,stat,time,loadavg,vmstat,netdev,filefd,systemd"
#elif __APPLE__
#define NE_DEFAULT_ENABLED_METRICS "cpu,loadavg,meminfo,uname,netdev"
#define NE_DEFAULT_ENABLED_METRICS "cpu,loadavg,meminfo,diskstats,uname,netdev"
#endif

/* filesystem: regex for ignoring mount points and filesystem types */
Expand Down
2 changes: 2 additions & 0 deletions plugins/in_node_exporter_metrics/ne_diskstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@

#ifdef __linux__
#include "ne_diskstats_linux.c"
#elif __APPLE__
#include "ne_diskstats_darwin.c"
#endif
2 changes: 1 addition & 1 deletion plugins/in_node_exporter_metrics/ne_diskstats.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "ne.h"

#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
int ne_diskstats_init(struct flb_ne *ctx);
int ne_diskstats_update(struct flb_ne *ctx);
int ne_diskstats_exit(struct flb_ne *ctx);
Expand Down
Loading

0 comments on commit 4cde143

Please sign in to comment.