diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/proc.plugin/proc_loadavg.c | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/proc.plugin/proc_loadavg.c (renamed from src/proc_loadavg.c) | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/proc_loadavg.c b/collectors/proc.plugin/proc_loadavg.c index 868f7d50a..db95b1689 100644 --- a/src/proc_loadavg.c +++ b/collectors/proc.plugin/proc_loadavg.c @@ -1,4 +1,9 @@ -#include "common.h" +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "plugin_proc.h" + +#define PLUGIN_PROC_MODULE_LOADAVG_NAME "/proc/loadavg" +#define CONFIG_SECTION_PLUGIN_PROC_LOADAVG "plugin:" PLUGIN_PROC_CONFIG_NAME ":" PLUGIN_PROC_MODULE_LOADAVG_NAME // linux calculates this once every 5 seconds #define MIN_LOADAVG_UPDATE_EVERY 5 @@ -12,7 +17,7 @@ int do_proc_loadavg(int update_every, usec_t dt) { char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/loadavg"); - ff = procfile_open(config_get("plugin:proc:/proc/loadavg", "filename to monitor", filename), " \t,:|/", PROCFILE_FLAG_DEFAULT); + ff = procfile_open(config_get(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "filename to monitor", filename), " \t,:|/", PROCFILE_FLAG_DEFAULT); if(unlikely(!ff)) return 1; } @@ -22,8 +27,8 @@ int do_proc_loadavg(int update_every, usec_t dt) { return 0; // we return 0, so that we will retry to open it next time if(unlikely(do_loadavg == -1)) { - do_loadavg = config_get_boolean("plugin:proc:/proc/loadavg", "enable load average", 1); - do_all_processes = config_get_boolean("plugin:proc:/proc/loadavg", "enable total processes", 1); + do_loadavg = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "enable load average", 1); + do_all_processes = config_get_boolean(CONFIG_SECTION_PLUGIN_PROC_LOADAVG, "enable total processes", 1); } if(unlikely(procfile_lines(ff) < 1)) { @@ -60,9 +65,9 @@ int do_proc_loadavg(int update_every, usec_t dt) { , NULL , "System Load Average" , "load" - , "proc" - , "loadavg" - , 100 + , PLUGIN_PROC_NAME + , PLUGIN_PROC_MODULE_LOADAVG_NAME + , NETDATA_CHART_PRIO_SYSTEM_LOAD , (update_every < MIN_LOADAVG_UPDATE_EVERY) ? MIN_LOADAVG_UPDATE_EVERY : update_every , RRDSET_TYPE_LINE ); @@ -100,9 +105,9 @@ int do_proc_loadavg(int update_every, usec_t dt) { , NULL , "System Active Processes" , "processes" - , "proc" - , "loadavg" - , 750 + , PLUGIN_PROC_NAME + , PLUGIN_PROC_MODULE_LOADAVG_NAME + , NETDATA_CHART_PRIO_SYSTEM_ACTIVE_PROCESSES , update_every , RRDSET_TYPE_LINE ); |