How to check remote disks space?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jfha73
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

How to check remote disks space?

Post 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.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: How to check remote disks space?

Post 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.
Former Nagios employee
https://www.mcapra.com/
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: How to check remote disks space?

Post by cdienger »

Thanks for the assist, @mcapra!

@jfha73, let us know if that hasn't helped to resolve the issue.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jfha73
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to check remote disks space?

Post by scottwilkerson »

Nagios XI is the only solution Nagios produces to perform these for you.
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jfha73
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Post by jfha73 »

mcapra wrote: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.
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#
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to check remote disks space?

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jfha73
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: How to check remote disks space?

Post 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
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jfha73
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Post 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.
Locked