Page 1 of 1

CPU threshold service check

Posted: Tue Jun 04, 2019 3:49 pm
by rferebee
Hello,

Is it possible to create a service check to monitor if CPU utilization drops below a certain percentage?

For example, the instances in my Log Server cluster typically run anywhere between 85-95% CPU utilization (all the time). Sometimes my environment will crash, but logstash and elasticsearch will still report that they are running. The only way I can tell that the environment is FUBAR is to look at the CPU utilization in vCenter and it will be under 40% for all instances.

I'd like to create a service check that will go Critical when the CPU utilization goes below 50% on my Log Servers.

Is that possible?

Re: CPU threshold service check

Posted: Tue Jun 04, 2019 4:57 pm
by lmiltchev
It depends on the plugin that you are using. If the plugin is written in accordance with the Nagios Plugins Development Guidelines, you could use ":" after the warning and/or critical threshold.

Example:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'mytoken' -P 5693 -M cpu/percent -w 85 -c 95
OK: Percent was 12.50 %, 0.00 %, 9.40 %, 0.00 %, 3.10 %, 0.00 %, 12.50 %, 0.00 % | 'percent_0'=12.50%;85;95; 'percent_1'=0.00%;85;95; 'percent_2'=9.40%;85;95; 'percent_3'=0.00%;85;95; 'percent_4'=3.10%;85;95; 'percent_5'=0.00%;85;95; 'percent_6'=12.50%;85;95; 'percent_7'=0.00%;85;95;

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'mytoken' -P 5693 -M cpu/percent -w 95: -c 85:
CRITICAL: Percent was 9.10 %, 0.00 %, 6.30 %, 0.00 %, 0.00 %, 0.00 %, 0.00 %, 0.00 % | 'percent_0'=9.10%;95:;85:; 'percent_1'=0.00%;95:;85:; 'percent_2'=6.30%;95:;85:; 'percent_3'=0.00%;95:;85:; 'percent_4'=0.00%;95:;85:; 'percent_5'=0.00%;95:;85:; 'percent_6'=0.00%;95:;85:; 'percent_7'=0.00%;95:;85:;

Re: CPU threshold service check

Posted: Mon Jun 10, 2019 10:49 am
by rferebee
This can be locked, thank you.

Re: CPU threshold service check

Posted: Mon Jun 10, 2019 10:51 am
by lmiltchev
I am locking the topic.