Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/admin-guide/plugins/system_stats.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Some example output is:
"plugin.system_stats.loadavg.five": 132032,
"plugin.system_stats.loadavg.ten": 88864,
"plugin.system_stats.current_processes": 503,
"plugin.system_stats.total_ram": 4127707136,
"plugin.system_stats.free_ram": 93474816,
"plugin.system_stats.shared_ram": 430710784,
"plugin.system_stats.buffer_ram": 399872000,
"plugin.system_stats.total_swap": 0,
"plugin.system_stats.free_swap": 0,
"plugin.system_stats.net.enp0s3.speed": 1000,
"plugin.system_stats.net.enp0s3.collisions": 0,
"plugin.system_stats.net.enp0s3.multicast": 0,
Expand Down
14 changes: 14 additions & 0 deletions plugins/experimental/system_stats/system_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@
// Process Strings
#define CURRENT_PROCESSES "plugin." PLUGIN_NAME ".current_processes"

// Memory/Swap Strings
#define TOTAL_RAM "plugin." PLUGIN_NAME ".total_ram"
#define FREE_RAM "plugin." PLUGIN_NAME ".free_ram"
#define SHARED_RAM "plugin." PLUGIN_NAME ".shared_ram"
#define BUFFER_RAM "plugin." PLUGIN_NAME ".buffer_ram"
#define TOTAL_SWAP "plugin." PLUGIN_NAME ".total_swap"
#define FREE_SWAP "plugin." PLUGIN_NAME ".free_swap"

// Base net stats name, full name needs to populated
// with NET_STATS.infname.RX/TX.standard_net_stats field
#define NET_STATS "plugin." PLUGIN_NAME ".net."
Expand Down Expand Up @@ -256,6 +264,12 @@ getStats(TSMutex stat_creation_mutex)
statSet(LOAD_AVG_FIVE_MIN, info.loads[1], stat_creation_mutex);
statSet(LOAD_AVG_FIFTEEN_MIN, info.loads[2], stat_creation_mutex);
statSet(CURRENT_PROCESSES, info.procs, stat_creation_mutex);
statSet(TOTAL_RAM, info.totalram, stat_creation_mutex);
statSet(FREE_RAM, info.freeram, stat_creation_mutex);
statSet(SHARED_RAM, info.sharedram, stat_creation_mutex);
statSet(BUFFER_RAM, info.bufferram, stat_creation_mutex);
statSet(TOTAL_SWAP, info.totalswap, stat_creation_mutex);
statSet(FREE_SWAP, info.freeswap, stat_creation_mutex);
#endif // #ifdef HAVE_SYS_SYSINFO_H
netStatsInfo(stat_creation_mutex);

Expand Down