Page 1 of 2

Check_CPU 0.4.3.88

Posted: Wed Jan 21, 2015 5:09 am
by WillemDH
Hello,

I'm putting this on the Nagios forum too, as Nsclient forum is not very active sometimes and I would need an answer to this: (http://www.nsclient.org/forums/topic/check_cpu/

Is there a way to use check_CPU on NSClient 0.4.3.88 to get information about all cores, but only alert when warning or critical threshold for total cpu is exceeded?

So I have now:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windows_server -t 30 -c Check_CPU -a filter=none time=1 time=5 time=15 “warn=load > 65″ “crit=load > 75″ ‘top-syntax=%(status): CPU Stats {%(list)}’ ‘detail-syntax={%(core), avg %(time)m: %(load)%}’

WARNING: CPU Stats {{core 0, avg 1m: 66%}, {core 1, avg 1m: 35%}, {total, avg 1m: 50%}, {core 0, avg 5m: 64%}, {core 1, avg 5m: 36%}, {total, avg 5m: 50%}, {core 0, avg 15m: 67%}, {core 1, avg 15m: 34%}, {total, avg 15m: 50%}}|’core 0 1’=66%;65;75 ‘core 1 1’=35%;65;75 ‘total 1’=50%;65;75 ‘core 0 5’=64%;65;75 ‘core 1 5’=36%;65;75 ‘total 5’=50%;65;75 ‘core 0 15’=67%;65;75 ‘core 1 15’=34%;65;75 ‘total 15’=50%;65;75
I’m usin CPUStress.exe to stress one core. As you can see core 0 has a load that exceeds the load warning threshold. The total CPU Load never exceeds the warning or critical thresholds, but the status of the check is WARNING. Is it possible to retrieve all CPU cores, but only alert when total load exceeds the thresholds?

I’ve tried several combinations, but none seem to work. For example:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windws_server -t 30 -c Check_CPU -a filter=none time=1 time=5 time=15 “warn=core = total and load > 40″ “crit=core=total and load > 75″ ‘top-syntax=%(status): CPU Stats {%(list)}’ ‘detail-syntax={%(core), avg %(time)m: %(load)%}’

OK: CPU Stats {{core 0, avg 1m: 66%}, {core 1, avg 1m: 40%}, {total, avg 1m: 53%}, {core 0, avg 5m: 68%}, {core 1, avg 5m: 37%}, {total, avg 5m: 53%}, {core 0, avg 15m: 66%}, {core 1, avg 15m: 42%}, {total, avg 15m: 54%}}|’core 0 1’=66%;40;75 ‘core 1 1’=40%;40;75 ‘total 1’=53%;40;75 ‘core 0 5’=68%;40;75 ‘core 1 5’=37%;40;75 ‘total 5’=53%;40;75 ‘core 0 15’=66%;40;75 ‘core 1 15’=42%;40;75 ‘total 15’=54%;40;75
Where I tried “warn=core = total and load > 40″ but as you can see total core is {total, avg 1m: 53%} which should have exceeded the threshold, but did not result in a WARNING status.

Thanks for any help.

Willem

Re: Check_CPU 0.4.3.88

Posted: Wed Jan 21, 2015 3:32 pm
by tmcdonald
According to this page:

http://docs.nsclient.org/tutorial/check/index.html

you might need a filter:

Code: Select all

check_cpu "filter=core = 'total'" "top-syntax=${list}"
L     client OK: total>8%, total>8%, total>8%
L     client  Performance data: 'total 5m'=8%;80;90 'total 1m'=8%;80;90 'total 5s'=8%;80;90

Re: Check_CPU 0.4.3.88

Posted: Wed Jan 21, 2015 3:42 pm
by WillemDH
Trevor,

I saw that, but as said, I would like to monitor all cpu cores, but only alert when total cpu utilisation is above the warn / crit threshold. it might just not be possible what I'm asking, I'm not sure.

Grtz

Willem

Re: Check_CPU 0.4.3.88

Posted: Wed Jan 21, 2015 5:28 pm
by abrist
I am curious if Trevor's suggestion would still work as his code only assumes "core" without the optional? integer.

Re: Check_CPU 0.4.3.88

Posted: Thu Jan 22, 2015 3:09 am
by WillemDH
Hello,

I'm not sure hat you mean Andy, but I tried Trevor's code:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windows_server -t 30 -c Check_CPU -a "filter=core = 'total'" time=1 time=5 time=15 "warn=load > 65" "crit=load > 75" 'top-syntax=%(status): CPU Stats {%(list)}' 'detail-syntax={%(core), avg %(time)m: %(load)%}'
OK: CPU Stats {{total, avg 1m: 0%}, {total, avg 5m: 0%}, {total, avg 15m: 0%}}|'total 1'=0%;65;75 'total 5'=0%;65;75 'total 15'=0%;65;75
"filter=core = 'total'" => Only results in total cpu returned, as expected.

Grtz

Willem

Re: Check_CPU 0.4.3.88

Posted: Thu Jan 22, 2015 11:52 am
by lmiltchev
"filter=core = 'total'" => Only results in total cpu returned, as expected.
Willem, let us know if it is safe to lock the topic.

Re: Check_CPU 0.4.3.88

Posted: Thu Jan 22, 2015 12:41 pm
by WillemDH
Ludmill, I meant with "as expected" that it is not an answer to my question.

Grtz

Willem

Re: Check_CPU 0.4.3.88

Posted: Thu Jan 22, 2015 3:32 pm
by abrist
Ahhh, I think I understand now. You are looking for performance data for each individual core, but you only want to set thresholds for the total, is that correct?

Re: Check_CPU 0.4.3.88

Posted: Fri Jan 23, 2015 3:23 am
by WillemDH
Correct Andy. I'm not really sure if it is possible. Still no answer on the NSClient forums either.

Re: Check_CPU 0.4.3.88

Posted: Fri Jan 23, 2015 1:48 pm
by lmiltchev
I am curious to see if this can work "natively". If it doesn't, you could probably come up with a custom script that would do the job for you. Place it in the "scripts" directory and call it with NSClient++.