Check_disk and swap usage via NRPE
Check_disk and swap usage via NRPE
Hi people, I'm having the next issue:
When I try to Check the Disk of the remote host Nagios tell me that is not possible to find the path to the disk.
When I try to monitor Swap Usage via NRPE or normal way (You know the default one) I get a Critical message saying: that the Swap does not exist or is not defined(normal way) or swap command is not defined (via NRPE) this last one, I know I have to define the command on nrpe.cfg, the pŕoblem is: I don't know how to define it!.
When I try to Check the Disk of the remote host Nagios tell me that is not possible to find the path to the disk.
When I try to monitor Swap Usage via NRPE or normal way (You know the default one) I get a Critical message saying: that the Swap does not exist or is not defined(normal way) or swap command is not defined (via NRPE) this last one, I know I have to define the command on nrpe.cfg, the pŕoblem is: I don't know how to define it!.
Re: Check_disk and swap usage via NRPE
Can you show us the related command definitions so we can see what's going on behind the error messages?
Former Nagios Employee
Re: Check_disk and swap usage via NRPE
Thanks for the repply,Off course!, not quite sure wich commands definitions you want so I will put all of them:rkennedy wrote:Can you show us the related command definitions so we can see what's going on behind the error messages?
Monitoring host:
from: /usr/local/nagios/etc/objects/commands.cfg
Code: Select all
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -t 20
}
Code: Select all
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/hda1
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
Let me know if this is what I have to show you or you need anything alse.
Re: Check_disk and swap usage via NRPE
Thank you, this is what we need on the command side.
Could you also show us the service definitions or commands you're running to produce this error? Just trying to gain perspective here.When I try to monitor Swap Usage via NRPE or normal way (You know the default one) I get a Critical message saying: that the Swap does not exist or is not defined(normal way) or swap command is not defined (via NRPE) this last one, I know I have to define the command on nrpe.cfg, the pŕoblem is: I don't know how to define it!.
Former Nagios Employee
Re: Check_disk and swap usage via NRPE
Yeah, no problem:rkennedy wrote:Thank you, this is what we need on the command side.
Could you also show us the service definitions or commands you're running to produce this error? Just trying to gain perspective here.
All of thisFrom: /usr/local/nagios/etc/objects/localhost.cfg
Code: Select all
define service{
use local-service
host_name Ubuntu
service_description /dev/hda1 Free Space
check_command check_nrpe!check_hda1
}
Note: When I try the command (lsblk -fm) to see my HDD on the remote host the name is sda1, try to change it but doesn't work so I keep it this way.
Swap check with nrpe:
Code: Select all
define service{
use local-service ; Name of service template to use
host_name Ubuntu
service_description Swap Usage
check_command check_nrpe!check_swap
}
Swap check with the default way:
Code: Select all
define service{
use local-service ; Name of service template to use
host_name Ubuntu
service_description Swap Usage
check_command check_local_swap!20!10
}
Note: When I do "free -m" on the remote host I get this:
Total/used/free/shared/ buff/cache/ available
Memory:2000 /61 /1442 /1 /495 /1784
Swap: 2045 0 2045
Re: Check_disk and swap usage via NRPE
The command
That you defined it for checking the swap on the nagios server and not the remote server.
To check the swap on the remote server, you would add a command to the remote server's nrpe.cfg file like the example below.
Then restart the NRPE Agent on the remote system and then edit the check_command on the Nagios server like below
Try that and post back if this is what you are looking for.
Code: Select all
check_command check_local_swap!20!10
To check the swap on the remote server, you would add a command to the remote server's nrpe.cfg file like the example below.
Code: Select all
command[check_swap]=/usr/local/nagios/libexec/check_swap -w 40% -c 20%
Code: Select all
check_command check_nrpe!check_swap!20!10
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check_disk and swap usage via NRPE
That worked!!!tgriep wrote:Try that and post back if this is what you are looking for.
Now the only thing that is not working is the check_nrpe!check_hda1
And I got a question that with the thing you said in your reply and I think I never understand it, services like:
Code: Select all
define service{
use local-service ; Name of service template to use
host_name Ubuntu
service_description Current Load
check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0
}
Other questions's I have now that I'm thinking on it:
Why SSH service sometimes says to me: Socket Timeout but then the service is fixed by itself.
And the other one is: the nrpe client on the remote host could crash or something? I'm asking this because few days ago, something happened to the nrpe client on the remote host and all of the nrpe services were in warning, I restart the nrpe client on the remote host and that fixed it.
Re: Check_disk and swap usage via NRPE
Create a command in the nrpe.cfg file like the example below
And create your service check like this example
That will check the root partition's space for you using just the / for the name and not the full device name and that should fix that for you.
If the check has the work local in it, it usually means to check the local system the command is run on and in your case that is the nagios server.
The SSH timeout could that that the remote server is taking longer than the default timeout but you can add the following to the command to increase it to 59 seconds.
Code: Select all
command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /
Code: Select all
define service{
use local-service
host_name Ubuntu
service_description Root / Free Space
check_command check_nrpe!check_disk
}
If the check has the work local in it, it usually means to check the local system the command is run on and in your case that is the nagios server.
The SSH timeout could that that the remote server is taking longer than the default timeout but you can add the following to the command to increase it to 59 seconds.
Code: Select all
-t 59
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Check_disk and swap usage via NRPE
It's all working now! I really appreciate your help tgriep and rkennedy.
The last thing I'm going to ask you two, where can I learn about the nrpe monitoring services ,more nagios plugins for monitoring and the arguments of the commands.
Thanks again !
The last thing I'm going to ask you two, where can I learn about the nrpe monitoring services ,more nagios plugins for monitoring and the arguments of the commands.
Thanks again !
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Check_disk and swap usage via NRPE
There's more than one answer to those, but these should set you on your way:tomas95go wrote: The last thing I'm going to ask you two, where can I learn about the nrpe monitoring services ,more nagios plugins for monitoring and the arguments of the commands.
NRPE: https://assets.nagios.com/downloads/nag ... e/NRPE.pdf
Plugins: http://nagios-plugins.org/
Arguments: https://assets.nagios.com/downloads/nag ... acros.html
That should keep you busy for a while, but if you need more, let us know! Off the top of my head, I know there's another 13-page NRPE document out there!