diff options
author | Fotis Voutsas <fjvoutsas@gmail.com> | 2020-09-01 17:43:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 17:43:19 +0300 |
commit | 586424c4dfe8e74d33607d752adb15dc49ec20f4 (patch) | |
tree | d6ef1cba60d3e75ae36e1c1cc24dffab2a36d2f6 /collectors/proc.plugin | |
parent | 907a3b3e964e36ee34a1347172d9cd4788f76fd5 (diff) |
collect active processes limit feature v2 (#9843)
* Add VARIABLE of pid_max to active_processes chart to use on alarms
* use function for pid_max and use a single alarm
* fix in alarm
Diffstat (limited to 'collectors/proc.plugin')
-rw-r--r-- | collectors/proc.plugin/proc_loadavg.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/collectors/proc.plugin/proc_loadavg.c b/collectors/proc.plugin/proc_loadavg.c index db95b16891..8b78ecc9ef 100644 --- a/collectors/proc.plugin/proc_loadavg.c +++ b/collectors/proc.plugin/proc_loadavg.c @@ -46,6 +46,10 @@ int do_proc_loadavg(int update_every, usec_t dt) { //unsigned long long running_processes = str2ull(procfile_lineword(ff, 0, 3)); unsigned long long active_processes = str2ull(procfile_lineword(ff, 0, 4)); + + //get system pid_max + unsigned long long max_processes = get_system_pid_max(); + // //unsigned long long next_pid = str2ull(procfile_lineword(ff, 0, 5)); @@ -95,6 +99,7 @@ int do_proc_loadavg(int update_every, usec_t dt) { if(likely(do_all_processes)) { static RRDSET *processes_chart = NULL; static RRDDIM *rd_active = NULL; + static RRDSETVAR *rd_pidmax; if(unlikely(!processes_chart)) { processes_chart = rrdset_create_localhost( @@ -113,10 +118,12 @@ int do_proc_loadavg(int update_every, usec_t dt) { ); rd_active = rrddim_add(processes_chart, "active", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + rd_pidmax = rrdsetvar_custom_chart_variable_create(processes_chart, "pidmax"); } else rrdset_next(processes_chart); rrddim_set_by_pointer(processes_chart, rd_active, active_processes); + rrdsetvar_custom_chart_variable_set(rd_pidmax, max_processes); rrdset_done(processes_chart); } |