Checking mounts on a linux server
-
jon.bilderback
- Posts: 52
- Joined: Tue Aug 10, 2010 9:16 am
Checking mounts on a linux server
http://exchange.nagios.org/directory/Pl ... nt/details
I'm trying to run that check on several different mountpoints, but it appears that it needs to be run on the client server. I'm not certain how to execute that script remotely, and return the results to the nagios server.
Could someone please help me with this, or direct me to the guide that explains how?
Thanks
I'm trying to run that check on several different mountpoints, but it appears that it needs to be run on the client server. I'm not certain how to execute that script remotely, and return the results to the nagios server.
Could someone please help me with this, or direct me to the guide that explains how?
Thanks
Re: Checking mounts on a linux server
You need to install the NRPE agent on the remote server http://exchange.nagios.org/directory/Ad ... or/details
This document will guide you through the set up and how to add your own plugins http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
It's very easy once you get your head around it!
This document will guide you through the set up and how to add your own plugins http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf
It's very easy once you get your head around it!
-
jon.bilderback
- Posts: 52
- Joined: Tue Aug 10, 2010 9:16 am
Re: Checking mounts on a linux server
Thanks for the link, however, I already have nrpe up and running on the client, and I am already doing the default checks for a Linux server.
I guess the main problem I'm having is that the check_mount script doesn't have the (typical?) -H for hostname option, and I'm not sure how to set up the command in NagiosXI, and on the client.
When I do create the command in the core config manager, the check returns an error if -H is included.
I guess the main problem I'm having is that the check_mount script doesn't have the (typical?) -H for hostname option, and I'm not sure how to set up the command in NagiosXI, and on the client.
When I do create the command in the core config manager, the check returns an error if -H is included.
Re: Checking mounts on a linux server
What you'll need to do is first create the client machine's command definition, this is usually either located in /etc/nrpe.cfg or /etc/nrpe/common.cfg. It will look something like this:
(This is the command that is run locally on the client machine)
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
Then, from the XI server, you can test this from the command-line by running
If that works ok, you can probably just clone an existing service for that host and then edit the arguments after the -c flag and enter your new command name.
(This is the command that is run locally on the client machine)
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
Then, from the XI server, you can test this from the command-line by running
Code: Select all
cd /usr/local/nagios/libexec
./check_nrpe -H <remotehost> -c check_usersRe: Checking mounts on a linux server
Set your custom command on the client:
Add a command definition at the end of the file (for example):
Note:
1. Make sure you have "check_mount.sh" coppied to "/usr/local/nagios/libexec" directory, and that the owner is root. Make it executable:
2. You may have to change another line in "nrpe.cfg" like this:
3. Restart the daemon:
4. Test your plugin locally first - for example:
Test your check from the Nagios server (from the command line):
# cd /usr/local/nagios/libexec
You should see something like this as an output:
Once you got it working from the command line, you can add the new service check in Nagios XI:
Go to: Core Config Manager->Monitoring->Services
Filter the results by config name and find your target machine.
Clone a service by clicking on the "Copy" Action button next to it. For example, you can "clone" the "/ Disk Usage" service.
Change the "Service description" to something that makes sense to you, for example, "check_boot".
Your "check command" should be check_nrpe, $ARG1$ should be check_mount and for $ARG2$ you can enter -a '-p /boot -t ext3'
Click on "Save" and "Apply Configuration".
Schedule an immediate check - you should get:
Code: Select all
# vi /usr/local/nagios/etc/nrpe.cfgCode: Select all
command[check_mount]=/usr/local/nagios/libexec/check_mount.sh $ARG1$1. Make sure you have "check_mount.sh" coppied to "/usr/local/nagios/libexec" directory, and that the owner is root. Make it executable:
Code: Select all
# chmod +x /usr/local/nagios/libexec/check_mount.shCode: Select all
dont_blame-nrpe=1Code: Select all
# service xinetd restartCode: Select all
# cd /usr/local/nagios/libexec
# ./check_mount.sh -p /boot -t ext3# cd /usr/local/nagios/libexec
Code: Select all
# ./check_nrpe -H <target_machine_IP_address> -c check_mount -a '-p /boot -t ext3'Code: Select all
Ponto de montagem /boot está OKGo to: Core Config Manager->Monitoring->Services
Filter the results by config name and find your target machine.
Clone a service by clicking on the "Copy" Action button next to it. For example, you can "clone" the "/ Disk Usage" service.
Change the "Service description" to something that makes sense to you, for example, "check_boot".
Your "check command" should be check_nrpe, $ARG1$ should be check_mount and for $ARG2$ you can enter -a '-p /boot -t ext3'
Click on "Save" and "Apply Configuration".
Schedule an immediate check - you should get:
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
jon.bilderback
- Posts: 52
- Joined: Tue Aug 10, 2010 9:16 am
Re: Checking mounts on a linux server
lmiltchev,
Thanks, that appears to be going to the client for the check now.
On the client, I run the following:
./check_mount.sh -p /boot -t ext3
with the response:
Mountpoint /boot is OK
However, using the following command from the XI terminal:
./check_nrpe -H 192.168.xxx.xxx -c check_mount -a '-p /boot -t ext3'
I get the following response:
Uso: check_mount.sh -p [ponto_de_montagem OU dispositivo] -t [tipo de filesystem]
which looks like it isn't receiving the arguments correctly. Any tips on this?
Thanks, that appears to be going to the client for the check now.
On the client, I run the following:
./check_mount.sh -p /boot -t ext3
with the response:
Mountpoint /boot is OK
However, using the following command from the XI terminal:
./check_nrpe -H 192.168.xxx.xxx -c check_mount -a '-p /boot -t ext3'
I get the following response:
Uso: check_mount.sh -p [ponto_de_montagem OU dispositivo] -t [tipo de filesystem]
which looks like it isn't receiving the arguments correctly. Any tips on this?
Re: Checking mounts on a linux server
What happens, when on the Nagios server you run only?
Did you define your command properly in the "nrpe.cfg" on the client? Did you restart the xinetd?
Code: Select all
# ./check_nrpe -H 192.168.xxx.xxxBe sure to check out our Knowledgebase for helpful articles and solutions!
-
jon.bilderback
- Posts: 52
- Joined: Tue Aug 10, 2010 9:16 am
Re: Checking mounts on a linux server
The check NRPE from the server returns:
NRPE v2.12
I did find out how to make it work though. I had a few typoes, and a few changes, but here is the final product:
On the client, in the file /usr/local/nagios/etc/nrpe/common.cfg:
### MOUNT POINTS ###
command[check_mount]=/usr/local/nagios/libexec/check_mount.sh $ARG1$ $ARG2$
In the command inside Core Config on the XI server:
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mount -a '-p $ARG1$ -t $ARG2$'
And now it is working! Thank you very much.
Now all I have to do is translate the ouput into english so my boss doesn't freak out.
NRPE v2.12
I did find out how to make it work though. I had a few typoes, and a few changes, but here is the final product:
On the client, in the file /usr/local/nagios/etc/nrpe/common.cfg:
### MOUNT POINTS ###
command[check_mount]=/usr/local/nagios/libexec/check_mount.sh $ARG1$ $ARG2$
In the command inside Core Config on the XI server:
$USER1$/check_nrpe -H $HOSTADDRESS$ -c check_mount -a '-p $ARG1$ -t $ARG2$'
And now it is working! Thank you very much.
Now all I have to do is translate the ouput into english so my boss doesn't freak out.