How to check remote disks space?

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

How to check remote disks space?

Postby jfha73 » Thu Aug 09, 2018 5:21 pm

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.
jfha73
 
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Postby mcapra » Fri Aug 10, 2018 8:14 am

Can you run a Nagios configuration verification and share the output:
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/verifyconfig.html

Depending on how you installed Nagios Core, the paths mentioned in that documentation may need to be altered.
Former Nagios employee
http://www.mcapra.com/
User avatar
mcapra
 
Posts: 3423
Joined: Thu May 05, 2016 3:54 pm

Re: How to check remote disks space?

Postby cdienger » Fri Aug 10, 2018 12:01 pm

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.
User avatar
cdienger
Support Tech
 
Posts: 1885
Joined: Tue Feb 07, 2017 11:26 am

Re: How to check remote disks space?

Postby jfha73 » Mon Aug 13, 2018 2:02 pm

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.
jfha73
 
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Postby scottwilkerson » Mon Aug 13, 2018 2:48 pm

Nagios XI is the only solution Nagios produces to perform these for you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12048
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: How to check remote disks space?

Postby jfha73 » Fri Aug 17, 2018 1:36 pm

mcapra wrote:Can you run a Nagios configuration verification and share the output:
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/verifyconfig.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#
jfha73
 
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Postby scottwilkerson » Fri Aug 17, 2018 2:07 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12048
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: How to check remote disks space?

Postby jfha73 » Fri Aug 17, 2018 2:18 pm

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.
jfha73
 
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Re: How to check remote disks space?

Postby scottwilkerson » Fri Aug 17, 2018 2:47 pm

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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
scottwilkerson
DevOps Engineer
 
Posts: 12048
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises

Re: How to check remote disks space?

Postby jfha73 » Fri Aug 17, 2018 2:56 pm

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.
jfha73
 
Posts: 5
Joined: Thu Aug 09, 2018 5:06 pm

Next

Return to Nagios Core

Who is online

Users browsing this forum: hbackus and 10 guests