Question

how do i use nagios to check for disk space on a remote machine?

Asked by: seth2740

How can I use nagios to check for disk space on a remote machine?
I'm running 3RC2 on Fedora 8.  Been looking around and not getting too far.
I have hosts setup and disk checks...but I discovered that it is actually checking the local system, not the remote.  Here is the command:

define service{
        use                             local-service         ; Name of service template to use
        host_name                       myserver
        service_description             Root Partition
        check_command                   check_local_disk!20%!10%!/
        }

define service{
        use                             local-service         ; Name of service template to use
        host_name                       myserver
        service_description             boot
        check_command                   check_local_disk!20%!10%!/boot
        }

and so on for /usr /var etc...

in the commands.cfg, i have this for the command line:

# 'check_local_disk' command definition
define command{
        command_name    check_local_disk
        command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
        }

I understand it's checking the local drive...need to check space on the remote drives.
Other remote checks like cpu, http are working fine remotely.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-02-12 at 12:18:27ID23157568
Tags

Nagios

,

3RC2

Topics

Fedora Linux

,

Linux Distributions

,

Linux

Participating Experts
1
Points
50
Comments
4

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. check_disk_smb Nagios
    Hey All, I have recently implemented nagios 2.7 on fedora core 6. I am trying the plugin check_disk_smb. I can run the command manually from the command line like this. check_disk_smb -H ipaddress -s sharename -u username -p password This works fine I get the percentage ...
  2. Nagios Setup question?
    Hi everyone, I installed Nagios follow this http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html and it works now. But by the default, it's monitoring only 8 services : Current Load Current Users HTTP PING Root Partition SSH Swap Usage Total Processes My question...
  3. nagios - error when trying to check disk_backup
    I don't know if backup is a reserved word in nagios or what the problem is. All the other disk_whatever works fine but the one disk(file system mount) name backup errors our in nagios everytime. Is there a way to make this work? Nagios in on a linux server the backup disk is...
  4. Nagios on Fedora 10 or 11
    I have been trying to set up Nagios on Fedora 10 and also 11. I have been following the Fedora Quickstart guide available at - http://nagios.sourceforge.net/docs/3_0/quickstart-fedora.html All the steps work fine, but when I try to view the page at localhost/nagios I get the...
  5. NAGIOS Check Disk
    Hello, I want to check by nagios remote partition on remote host the partition called /var and i want to warn me if it's exceeded 90% Thanks
  6. Nagios
    Hi, I just installed nagios and this is the error message I get when doing the pre-flight check Error: Cannot open config file '/usr/local/nagios/etc/objects/commands.cfg' for reading: Permission denied Error processing object config files! I tried to put 777 permissions on ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: malcolm_logan_ukPosted on 2008-02-13 at 08:20:24ID: 20885460

On the remotehost - that is the one you want to check...

/usr/local/nagios/etc/nrpe.cfg

   command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20 -c 10 -p /dev/sda1

On the nagios host in the object file...

/usr/local/nagios/etc/objects/servers/remoteserver.cfg

   define service{
        use                     generic-service
        host_name               remoteserver
        service_description     /dev/sda1 Free Space
        check_command           check_nrpe!check_sda1
        }

Hope that helps - if you need anything more just ask.

M

 

by: seth2740Posted on 2008-02-13 at 08:50:34ID: 20885800

on the remote host?  i need to install nagios there?  i found some things on google about nrpe but don't quite understand what it is or for.

 

by: malcolm_logan_ukPosted on 2008-02-14 at 00:56:36ID: 20891907

NRPE is a remote monitoring utility for Nagios...

"The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. The main reason for doing this is to allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines. Since these public resources are not usually exposed to external machines, an agent like NRPE must be installed on the remote Linux/Unix machines."

Instructions are below

Good Luck

M

In order to use the NRPE addon, you'll need to perform some tasks on both the monitoring host and the remote Linux/Unix host that the NRPE daemon is installed on. I'll cover both of these tasks separately.

1. Remote Host Setup

These instructions should be completed on the remote Linux/Unix host that the NRPE daemon will be installed on. You'll be installing the Nagios plugins and the NRPE daemon...

i. Create Account Information

Become the root user.
   # su -
Create a new nagios user account and give it a password.
   # /usr/sbin/useradd nagios
   # passwd nagios

ii. Install the Nagios Plugins

Create a directory for storing the downloads.
   # mkdir ~/downloads
   # cd ~/downloads
Download the source code tarball of the Nagios plugins (visit http://www.nagios.org/download/ for links to the latestversions). At the time of writing, the latest stable version of the Nagios plugins was 1.4.6.
   # wget http://osdn.dl.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.6.tar.gz
Extract the Nagios plugins source code tarball.
   # tar xzf nagios-plugins-1.4.6.tar.gz
   # cd nagios-plugins-1.4.6
Compile and install the plugins.
   # ./configure
   # make
   # make install
The permissions on the plugin directory and the plugins will need to be fixed at this point, so run the following commands.
   # chown nagios.nagios /usr/local/nagios
   # chown -R nagios.nagios /usr/local/nagios/libexec

iii. Install the NRPE daemon

Download the source code tarball of the NRPE addon (visit http://www.nagios.org/download/ for links to the latest versions). At the time of writing, the latest version of NRPE was 2.8.
   # cd ~/downloads
   # wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nrpe-2.8.tar.gz
Extract the NRPE source code tarball.
   # tar xzf nrpe-2.8.tar.gz
   # cd nrpe-2.8
Compile the NRPE addon.
   # ./configure
   # make all
Install the NRPE plugin (for testing), daemon, and sample daemon config file.
   # make install-plugin
   # make install-daemon
   # make install-daemon-config
Install the NRPE daemon as a service under xinetd.
   # make install-xinetd
Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.
   only_from            = 127.0.0.1 <nagios_ip_address>
Add the following entry for the NRPE daemon to the /etc/services file.
   nrpe                 5666/tcp             # NRPE
Restart the xinetd service.
   # service xinetd restart

iv. Test the NRPE daemon locally

Its time to see if things are working properly...
Make sure the nrpe daemon is running under xinetd.
   # netstat -at | grep nrpe
The output out this command should show something like this:
   tcp             0            0 *:nrpe     *:*           LISTEN
If it does, great! If it doesn't, make sure of the following:
You added the nrpe entry to your /etc/services file
The only_from directive in the /etc/xinetd.d/nrpe file contains an entry for "127.0.0.1"
xinetd is installed and started
Check the system log files for references about xinetd or nrpe and fix any problems that are reported
Next, check to make sure the NRPE daemon is functioning properly. To do this, run the check_nrpe plugin that was installed for testing purposes.
   # /usr/local/nagios/libexec/check_nrpe -H localhost
You should get a string back that tells you what version of NRPE is installed, like this:
   NRPE v2.8

v. Open firewall rules

Make sure that the local firewall on the machine will allow the NRPE daemon to be accessed from remote servers.
To do this, run the following iptables command. Note that the RH-Firewall-1-INPUT chain name is Fedora-specific, so it will be different on other Linux distributions.
   # iptables -I RH-Firewall-1-INPUT -p tcp -m tcp dport 5666 -j ACCEPT
Save the new iptables rule so it will survive machine reboots.
   # service iptables save

2. Monitoring Host Setup

On the monitoring host (the machine that runs Nagios), you'll need to do just a few things:
Install the check_nrpe plugin
Create a Nagios command definition for using the check_nrpe plugin
Create Nagios host and service definitions for monitoring the remote host

These instructions assume that you have already installed Nagios on this machine according to the quickstart installation guide. The configuration examples that are given reference templates that are defined in the sample localhost.cfg and commands.cfg files that get installed if you follow the quickstart.

i. Install the check_nrpe plugin

Become the root user. You may have to use sudo -s on Ubuntu and other distros.
   # su -
Create a directory for storing the downloads.
   # mkdir ~/downloads
   # cd ~/downloads
Download the source code tarball of the NRPE addon (visit http://www.nagios.org/download/ for links to the latestversions). At the time of writing, the latest version of NRPE was 2.8.
   # wget http://osdn.dl.sourceforge.net/sourceforge/nagios/nrpe-2.8.tar.gz
Extract the NRPE source code tarball.
   # tar xzf nrpe-2.8.tar.gz
   # cd nrpe-2.8
Compile the NRPE addon.
   # ./configure
   # make all
Install the NRPE plugin.
   # make install-plugin

ii. Test communication with the NRPE daemon

Make sure the check_nrpe plugin can talk to the NRPE daemon on the remote host. Replace "192.168.0.1" in the command below with the IP address of the remote host that has NRPE installed.
   # /usr/local/nagios/libexec/check_nrpe -H 192.168.0.1
You should get a string back that tells you what version of NRPE is installed on the remote host, like this:
   NRPE v2.8
If the plugin returns a timeout error, check the following:
Make sure there isn't a firewall between the remote host and the monitoring server that is blocking communication
Make sure that the NRPE daemon is installed properly under xinetd
Make sure the remote host doesn't have local (iptables) firewall rules that prevent the monitoring server from talking to the NRPE daemon

iii. Create a command definition

You'll need to create a command definition in one of your Nagios object configuration files in order to use the check_nrpe plugin. Open the sample commands.cfg file for editing...
   # vi /usr/local/nagios/etc/commands.cfg
and add the following definition to the file:
   define command{
            command_name         check_nrpe
            command_line         $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
            }
You are now ready to start adding services that should be monitored on the remote machine to the Nagios configuration...

iv. Create host and service definitions

You'll need to create some object definitions in order to monitor the remote Linux/Unix machine. These definitions can be placed in their own file or added to an already exiting object configuration file.
First, its best practice to create a new template for each different type of host you'll be monitoring. Let's create a new template for linux boxes.
   define host{
               name                                    linux-box                  ; Name of this template
               use                                     generic-host               ; Inherit default values
               check_period                            24x7
               check_interval                          5
               retry_interval                          1
               max_check_attempts                      10
               check_command                           check-host-alive
               notification_period                     24x7
               notification_interval                   30
               notification_options                    d,r
               contact_groups                          admins
               register                                0             ; DONT REGISTER THIS - ITS A TEMPLATE
               }
Notice that the linux-box template definition is inheriting default values from the generic-host template, which is defined in the sample localhost.cfg file that gets installed when you follow the Nagios quickstart installation guide.
Next, define a new host for the remote Linux/Unix box that references the newly created linux-box host template.
   define host{
               use                        linux-box                  ;  Inherit default values from a template
               host_name                  remotehost                 ;  The name we're giving to this server
               alias                      Fedora Core 6              ;  A longer name for the server
               address                    192.168.0.1                ;  IP address of the server
               }
Next, define some services for monitoring the remote Linux/Unix box. These example service definitions will use the sample commands that have been defined in the nrpe.cfg file on the remote host.
The following service will monitor the CPU load on the remote host. The "check_load" argument that is passed to the check_nrpe command definition tells the NRPE daemon to run the "check_load" command as defined in the nrpe.cfg file.
   define service{
               use                        generic-service
               host_name                  remotehost
               service_description        CPU Load
               check_command              check_nrpe!check_load
               }
The following service will monitor the the number of currently logged in users on the remote host.
   define service{
               use                        generic-service
               host_name                  remotehost
               service_description        Current Users
               check_command              check_nrpe!check_users
               }
The following service will monitor the free drive space on /dev/hda1 on the remote host.
   define service{
               use   generic-service
               host_name   remotehost
               service_description   /dev/hda1 Free Space
               check_command   check_nrpe!check_hda1
               }

The following service will monitor the total number of processes on the remote host.
   define service{
             use                        generic-service
             host_name                  remotehost
             service_description        Total Processes
             check_command              check_nrpe!check_total_procs
             }
The following service will monitor the number of zombie processes on the remote host.
   define service{
             use                        generic-service
             host_name                  remotehost
             service_description        Zombie Processes
             check_command              check_nrpe!check_zombie_procs
             }
Those are the basic service definitions for monitoring the remote host.

v. Restart Nagios

At this point you've installed the check_nrpe plugin and addon host and service definitions for monitoring the remote Linux/Unix machine. Now its time to make those changes live...
Verify your Nagios configuration files.
   # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
If there are errors, fix them. If everything is fine, restart Nagios.
   # service nagios restart
That's it! You should see the host and service definitions you created in the Nagios web interface. In a few minutes Nagios should have the current status information for the remote Linux/Unix machine.



20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...