Page 1 of 2
How to check remote disks space?
Posted: Thu Aug 09, 2018 5:21 pm
by jfha73
Hey guys,
I have a Nagios server and a client, they both have NRPE installed, I saw in a document in nagios website that all I had to do was create a service containing this command:
check_nrpe!check_hda1
Which I changed in the client nrpe.cfg to check_sda2 because that's the one I want to check, restarted nrpe on the client to load the changes, no problems there, but when I added the service in the Nagios server for that host, Nagios will not restart, this is what I added:
Code: Select all
define service {
use generic-service
host_name my-host
service_description Check Free Space on /dev/sda2
check_command check_nrpe!check_sda2
}
My nrpe.cfg has this in it:
Code: Select all
command[check_sda2]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda2
Any idea why this is not working?
Thanks.
Re: How to check remote disks space?
Posted: Fri Aug 10, 2018 8:14 am
by mcapra
Can you run a Nagios configuration verification and share the output:
https://assets.nagios.com/downloads/nag ... onfig.html
Depending on how you installed Nagios Core, the paths mentioned in that documentation may need to be altered.
Re: How to check remote disks space?
Posted: Fri Aug 10, 2018 12:01 pm
by cdienger
Thanks for the assist,
@mcapra!
@jfha73, let us know if that hasn't helped to resolve the issue.
Re: How to check remote disks space?
Posted: Mon Aug 13, 2018 2:02 pm
by jfha73
I have not tried it yet because I'm looking for a tool to help me add hosts using the Nagios GUI and set up the services using the GUI too, as I don't like to mess around with the configuration files manually to avoid typos or misspelled words, I know XI comes with all of these, but we don't have the money to spend, so do you guys know of a tool that I can use to add hosts, services, etc.
Thanks.
Re: How to check remote disks space?
Posted: Mon Aug 13, 2018 2:48 pm
by scottwilkerson
Nagios XI is the only solution Nagios produces to perform these for you.
Re: How to check remote disks space?
Posted: Fri Aug 17, 2018 1:36 pm
by jfha73
Sorry for the delay, it's been pretty busy lately, this is what the command showed:
Code: Select all
Nagios Core 4.4.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2018-08-16
License: GPL
Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...
Running pre-flight check on configuration data...
Checking objects...
Checked 10 services.
Checked 2 hosts.
Checked 1 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 25 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 2 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Total Warnings: 0
Total Errors: 0
Things look okay - No serious problems were detected during the pre-flight check
Also, my nagios.cfg has this in it:
Code: Select all
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
But nagios will not restart when I have a service calling command check_nrpe!check_#ANYTHING#
Re: How to check remote disks space?
Posted: Fri Aug 17, 2018 2:07 pm
by scottwilkerson
jfha73 wrote:But nagios will not restart when I have a service calling command check_nrpe!check_#ANYTHING#
What is the error you receive? Either at the command line or via the nagios.log
Re: How to check remote disks space?
Posted: Fri Aug 17, 2018 2:18 pm
by jfha73
This is what I get from systemctl status:
Code: Select all
● nagios.service - Nagios Core 4.4.2
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2018-08-17 15:15:29 EDT; 7s ago
Docs: https://www.nagios.org/documentation
Process: 23203 ExecStopPost=/usr/bin/rm -f /usr/local/nagios/var/rw/nagios.cmd (code=exited, status=0/SUCCESS)
Process: 23199 ExecStop=/usr/bin/kill -s TERM ${MAINPID} (code=exited, status=0/SUCCESS)
Process: 21986 ExecStart=/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 23207 ExecStartPre=/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg (code=exited, status=1/FAILURE)
Main PID: 21988 (code=exited, status=0/SUCCESS)
Aug 17 15:15:29 nagios.example.com nagios[23207]: Check your configuration file(s) to ensure that they contain valid
Aug 17 15:15:29 nagios.example.com nagios[23207]: directives and data definitions. If you are upgrading from a previous
Aug 17 15:15:29 nagios.example.com nagios[23207]: version of Nagios, you should be aware that some variables/definitions
Aug 17 15:15:29 nagios.example.com nagios[23207]: may have been removed or modified in this version. Make sure to read
Aug 17 15:15:29 nagios.example.com nagios[23207]: the HTML documentation regarding the config files, as well as the
Aug 17 15:15:29 nagios.example.com nagios[23207]: 'Whats New' section to find out what has changed.
Aug 17 15:15:29 nagios.example.com systemd[1]: nagios.service: control process exited, code=exited status=1
Aug 17 15:15:29 nagios.example.com systemd[1]: Failed to start Nagios Core 4.4.2.
Aug 17 15:15:29 nagios.example.com systemd[1]: Unit nagios.service entered failed state.
Aug 17 15:15:29 nagios.example.com systemd[1]: nagios.service failed.
Re: How to check remote disks space?
Posted: Fri Aug 17, 2018 2:47 pm
by scottwilkerson
So can you run this after making that change and post the output
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
and then post the configuration file it references in the error
Re: How to check remote disks space?
Posted: Fri Aug 17, 2018 2:56 pm
by jfha73
Got it !!!
I had a couple of typos in the configuration file, corrected them and it's working now, thanks for the command to check the configuration file.