Hi there,
for the well known check check_load
there is the parameter --percpu
which divides the load by the number of installed CPUs. This is very handy in an environment with a lot of VMs where you not always know when its owner changes the CPU cores.
Now I want to have the same for check_procs
. I would like to have some kind of multiplicator for the thresholds without changing and recompiling the check by myself or creating a pull request and waiting for years to be ignored because the idea might be stupid.
Anyway. I first looked into the Icinga2 language reference to find the possibility to execute external commands like nproc
that just output the multiplicator I am looking for and store it in a variable. Unfortunately there is no such command/function/macro that can do that.
So next I thought about a cronjob or a small script that runs on a reboot and sets a variable in /etc/icinga2/constants.conf
before the icinga2
service starts on each agent. A modified CheckCommand
could then take this variable which can be different on each host and calculate the proper thresholds automatically depended on the CPU count.
And the third idea would be to create a cronjob that uses the Icinga2 API to sets/updates a variable on the Host object that belongs to itself. And this host variable can then be used to calculate the proper thresholds using a modified CheckCommand
.
What do you think is the best way? Or is there even a better one?