Windows NRPE commands for CPU monitoring

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Windows NRPE commands for CPU monitoring

Post by dlukinski »

Hello XI support

How to monitor CPU via NSclient with NRPE instead of NSclient commands?

Thank you
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows NRPE commands for CPU monitoring

Post by lmiltchev »

There are usually some aliases for check_cpu, defined in the nsclient.ini file that you could use.

Example:
In the nsclient.ini:

Code: Select all

alias_cpu_all = check_cpu filter=none "warn=load > 80" "crit=load > 90" time=5m time=1m time=30s
Running a check from the CLI on the Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c alias_cpu_all
OK: CPU load is ok.|'core 0 5m'=10%;80;90 'core 1 5m'=1%;80;90 'core 2 5m'=2%;80;90 'core 3 5m'=3%;80;90 'core 4 5m'=5%;80;90 'core 5 5m'=0%;80;90 'core 6 5m'=0%;80;90 'core 7 5m'=5%;80;90 'total 5m'=3%;80;90 'core 0 1m'=4%;80;90 'core 1 1m'=0%;80;90 'core 2 1m'=2%;80;90 'core 3 1m'=0%;80;90 'core 4 1m'=3%;80;90 'core 5 1m'=0%;80;90 'core 6 1m'=0%;80;90 'core 7 1m'=2%;80;90 'total 1m'=1%;80;90 'core 0 30s'=2%;80;90 'core 1 30s'=0%;80;90 'core 2 30s'=1%;80;90 'core 3 30s'=0%;80;90 'core 4 30s'=0%;80;90 'core 5 30s'=0%;80;90 'core 6 30s'=0%;80;90 'core 7 30s'=1%;80;90 'total 30s'=0%;80;90
As an alternative, you could use the "check_cpu" command (instead of using an alias, and "hardcoding" the args) and pass whatever arguments you need to.

Example:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_cpu -a filter=none "warn=load > 80" "crit=load > 90"
OK: CPU load is ok.|'core 0 5m'=10%;80;90 'core 1 5m'=0%;80;90 'core 2 5m'=3%;80;90 'core 3 5m'=1%;80;90 'core 4 5m'=4%;80;90 'core 5 5m'=0%;80;90 'core 6 5m'=0%;80;90 'core 7 5m'=4%;80;90 'total 5m'=3%;80;90 'core 0 1m'=5%;80;90 'core 1 1m'=0%;80;90 'core 2 1m'=2%;80;90 'core 3 1m'=0%;80;90 'core 4 1m'=2%;80;90 'core 5 1m'=0%;80;90 'core 6 1m'=0%;80;90 'core 7 1m'=2%;80;90 'total 1m'=1%;80;90 'core 0 5s'=5%;80;90 'core 1 5s'=0%;80;90 'core 2 5s'=3%;80;90 'core 3 5s'=0%;80;90 'core 4 5s'=2%;80;90 'core 5 5s'=0%;80;90 'core 6 5s'=0%;80;90 'core 7 5s'=3%;80;90 'total 5s'=1%;80;90
For more info on the check_cpu usage, please review the NSClient++ documentation here:
https://docs.nsclient.org/reference/win ... #check_cpu

Hope this helps. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Windows NRPE commands for CPU monitoring

Post by dlukinski »

lmiltchev wrote:There are usually some aliases for check_cpu, defined in the nsclient.ini file that you could use.

Example:
In the nsclient.ini:

Code: Select all

alias_cpu_all = check_cpu filter=none "warn=load > 80" "crit=load > 90" time=5m time=1m time=30s
Running a check from the CLI on the Nagios XI server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c alias_cpu_all
OK: CPU load is ok.|'core 0 5m'=10%;80;90 'core 1 5m'=1%;80;90 'core 2 5m'=2%;80;90 'core 3 5m'=3%;80;90 'core 4 5m'=5%;80;90 'core 5 5m'=0%;80;90 'core 6 5m'=0%;80;90 'core 7 5m'=5%;80;90 'total 5m'=3%;80;90 'core 0 1m'=4%;80;90 'core 1 1m'=0%;80;90 'core 2 1m'=2%;80;90 'core 3 1m'=0%;80;90 'core 4 1m'=3%;80;90 'core 5 1m'=0%;80;90 'core 6 1m'=0%;80;90 'core 7 1m'=2%;80;90 'total 1m'=1%;80;90 'core 0 30s'=2%;80;90 'core 1 30s'=0%;80;90 'core 2 30s'=1%;80;90 'core 3 30s'=0%;80;90 'core 4 30s'=0%;80;90 'core 5 30s'=0%;80;90 'core 6 30s'=0%;80;90 'core 7 30s'=1%;80;90 'total 30s'=0%;80;90
As an alternative, you could use the "check_cpu" command (instead of using an alias, and "hardcoding" the args) and pass whatever arguments you need to.

Example:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_cpu -a filter=none "warn=load > 80" "crit=load > 90"
OK: CPU load is ok.|'core 0 5m'=10%;80;90 'core 1 5m'=0%;80;90 'core 2 5m'=3%;80;90 'core 3 5m'=1%;80;90 'core 4 5m'=4%;80;90 'core 5 5m'=0%;80;90 'core 6 5m'=0%;80;90 'core 7 5m'=4%;80;90 'total 5m'=3%;80;90 'core 0 1m'=5%;80;90 'core 1 1m'=0%;80;90 'core 2 1m'=2%;80;90 'core 3 1m'=0%;80;90 'core 4 1m'=2%;80;90 'core 5 1m'=0%;80;90 'core 6 1m'=0%;80;90 'core 7 1m'=2%;80;90 'total 1m'=1%;80;90 'core 0 5s'=5%;80;90 'core 1 5s'=0%;80;90 'core 2 5s'=3%;80;90 'core 3 5s'=0%;80;90 'core 4 5s'=2%;80;90 'core 5 5s'=0%;80;90 'core 6 5s'=0%;80;90 'core 7 5s'=3%;80;90 'total 5s'=1%;80;90
For more info on the check_cpu usage, please review the NSClient++ documentation here:
https://docs.nsclient.org/reference/win ... #check_cpu

Hope this helps. Thank you!
Would this one work?

-a show-all -a 'warn=load>80' 'crit=load>90' show-all

Thanks
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows NRPE commands for CPU monitoring

Post by lmiltchev »

Here's the output on my text box, when using the "--show-all" option:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_cpu -a 'warn=load>80' 'crit=load>90' show-all
OK: 5m: 3%, 1m: 1%, 5s: 0%|'total 5m'=3%;80;90 'total 1m'=1%;80;90 'total 5s'=0%;80;90
Note: I am using NSClient++ ver. 0.5.1.44.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Windows NRPE commands for CPU monitoring

Post by dlukinski »

lmiltchev wrote:Here's the output on my text box, when using the "--show-all" option:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H x.x.x.x -c check_cpu -a 'warn=load>80' 'crit=load>90' show-all
OK: 5m: 3%, 1m: 1%, 5s: 0%|'total 5m'=3%;80;90 'total 1m'=1%;80;90 'total 5s'=0%;80;90
Note: I am using NSClient++ ver. 0.5.1.44.
Thank you.

Would it be ok to use 0.5.2.x ?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Windows NRPE commands for CPU monitoring

Post by lmiltchev »

Would it be ok to use 0.5.2.x ?
I don't see why not.

Let us know if you have any more questions or we can lock the thread. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
dlukinski
Posts: 1130
Joined: Tue Oct 06, 2015 9:42 am

Re: Windows NRPE commands for CPU monitoring

Post by dlukinski »

lmiltchev wrote:
Would it be ok to use 0.5.2.x ?
I don't see why not.

Let us know if you have any more questions or we can lock the thread. Thanks!
Please lock
Locked