Monitoring Ubuntu, Agent File

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Monitoring Ubuntu, Agent File

Post by A.Cormack »

Hi All,

I'm wondering if anyone can tell me where I can find the "Agent Installation Instructions" for an Ubuntu server? I tried to get this file from the link provided in the Nagios XI monitoring wizard but the link is unavaliable. I also tried searching for it online etc but all I seem to find is how to install Nagios on an Ubuntu server.

Thanks in Advance.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Monitoring Ubuntu, Agent File

Post by abrist »

The XI linux agent wizard is specifically for redhat/centos systems. You will need to build the nrpe agent from source or obtain it from ubuntu's repos. I have a unfinished installation document you are welcome to test drive. The text of the document is below in the code wrap:

Code: Select all

Installing NRPE from source

Downloading, compiling, and installing the NRPE agent

On the remote host (client system), download the nrpe tarball (2.14 newest currently) and expand it:

$  cd /tmp
tmp$  wget http://sourceforge.net/projects/nagios/files/nrpe-2.x/nrpe-2.14/nrpe-2.14.tar.gz 
tmp$  tar vfxz nrpe-2.14.tar.gz

Next we will compile it and install nrpe.  It will install into the default directory at:  /usr/local/nagios/libexec (for the nrpe plugin)

tmp$  cd nrpe-2.14
nrpe-2.14$  ./configure
nrpe-2.14$  make
nrpe-2.14$  make install

Copy over the nrpe.cfg from the sample-config directory into /usr/local/nagios/etc.

nrpe-2.14$  mkdir /usr/local/nagios/etc 
nrpe-2.14$  cp sample-config/nrpe.cfg  /usr/local/nagios/etc
 

Downloading, compiling, and installing the Nagios Plugins

Nrpe does not do much without plugins.  So before we dive into configuration, download and build the plugins (1.4.16 newest):

$ cd /tmp
tmp$  wget http://sourceforge.net/projects/nagiosplug/files/nagiosplug/1.4.16/nagios-plugins-1.4.16.tar.gz 
tmp$  tar vfxz nagios-plugins-1.14.16.tar.gz
tmp$  cd nagios-plugins-1.14.16
nagios-plugins-1.14.16$  ./configure
nagios-plugins-1.14.16$  make
nagios-plugins-1.14.16$  make install

The nagios-plugins pack should now reside in /usr/local/nagios/libexec.  The plugins are a mix of scripts and binaries.  Take note of their location as this is where you will install additional plugins in the future.

To recap, nrpe and the nagios-plugins pack installed to /usr/local/nagios/libexec.
The nrpe.cfg config file is located at /usr/local/nagios/etc.

If you need to install either to a different location due to internal policies, this can be done with with “–prefix=$PREFIX” directive.  This is outside of the scope of this document but more information can be obtained through the Nagios documentation or directly from the Nagios forums.


Configuration Overview

Essentially, there are three parts to a working nrpe agent:
1. NRPE and its configuration
2. A plugin with a configured command in nrpe.cfg
3. A check_nrpe service in Nagios XI

Parts one and two are both configured in the nrpe.cfg file, so we will begin there.


Configuration of the Basic nrpe.cfg Options

NRPE runs as daemon on the remote host.  It accepts commands from an XI server over port 5666, executes them locally from /usr/local/nagios/libexec, and return the check information to the XI server.  These commands are specified in the nrpe.cfg and correspond to the respective plugins in libexec.  This would be highly insecure if port 5666 was open to the world.  Thus, there are a few directives in nrpe.cfg that must be edited for security reasons.  Mainly the “allowed_hosts” directive.  For the purposes of this document, we will use the cli text editor “nano”, though feel free to use your editor of choice:

$  nano /usr/local/nagios/etc/nrpe.cfg
 
On line 81, you will find the allowed_hosts directive.  This is a comma separated list of host ip address allowed to connect to the daemon on port 5666.  Localhost (127.0.0.1) should already be listed and it is best to leave it as we will run nrpe/plugins locally to check them before running them remotely from the XI server.  Add a comma and then the ip address of your nagios server.

The next directive of interest is “dont_blame_nrpe=0”.  Funny name, but for a good reason.  This directive allows command arguments to be passed to the nrpe daemon from the nagios server.  Whereas, by default, commands passed to nrpe have all their arguments/options set statically in nrpe.cfg.  By changing the 0 to a 1, nrpe will accept commands with arguments from the XI server.  This setting is not without it's risks though, as it would open up the client to dynamic commands.  Depending on the level of security required in your environment, this directive may not be optional or viable.  An argument for switching this directive on is the amount of flexibility it gives the XI Admin to configure and reconfigure nrpe clients on the fly, all from within the XI interface.  Additionally it allows for easier management of client nrpe configs across large monitoring environments, as the specific check can be almost entirely configured within XI, while clients share very similar, if not identical nrpe configs.  If you do not have a specific security requirements or concerns, the “dont_blame_nrpe” directive is best set to “1”. 

The only other option of note (before we start on the command configuration) is the “debug=0” directive.  If you experience problems with an nrpe setup, change the 0 to a 1 to enable debugging.  It will be logged through the syslog facility by default and will provide verbose output from the nrpe daemon.


Configuration of Static Command Directives in nrpe.cfg

The command directives at the bottom of the nrpe.cfg file are aliases to plugins.  These are the plugins that are executed on the remote system when it receives a check command through nrpe from the nagiosxi sever.  You have to configure the command to match the plugin's location and arguments you wish to pass to the plugin. In a static configuration, these directives include the entirety of the command: alias, path, plugin and arguments.  The commands are in the format:
 
command[alias]=/path/plugin arguments

An actual command directive would look like:

command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200

For this example, we give the command the name/alias [check_total_procs].  Everything after the "=" is the actual command run on the client.  We give the command a full path: /usr/local/nagios/libexec/check_procs where "check_procs" is the binary/script plugin in the /opt/nagios/libexec folder and "-w 150 -c 200" are the command arguments for the plugin.  -w 150 specifies the warning level, which is the point at which nagiosxi will report a "WARNING" once the client reaches 150 processes.  The -c 200 is the critical setting, specifying that the service will report "CRITICAL" in nagiosxi once the client reaches 200 processes.  These thresholds are user configurable, and tend to be unique in syntax and in scope of any given plugin.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Monitoring Ubuntu, Agent File

Post by A.Cormack »

Will give it a try. Thanks for your help
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Monitoring Ubuntu, Agent File

Post by scottwilkerson »

Report back if you have further problems.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Monitoring Ubuntu, Agent File

Post by A.Cormack »

Seem to encourntered a problem when typing in the "./configure" command. I get...

"checking for SSL headers... configure: error: Cannt find ssl headers

then when I try to proceed by typing "make" and "make install". I get a "No rule to make target 'install'. Stop" error.

Sorry for the inexperience, first time using Nagios and Ubuntu. Bad.. i know..

EDIT:

I correct the above SSL header error by using "After installing libssl-dev" as suggested on the official ubuntu forums. However, I now get stuck at "configure: error: Cannot find ssl libraries"
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitoring Ubuntu, Agent File

Post by slansing »

What version of Ubuntu are you running on?

Have you giving this fix a try?:

http://ubuntuforums.org/showthread.php?t=1975917

I know that solved this issue for me at one point in time.
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Monitoring Ubuntu, Agent File

Post by A.Cormack »

Ubuntu Server 12.10

Just trying the link now, will update you shortly.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Monitoring Ubuntu, Agent File

Post by slansing »

Sounds good, let us know.
tonyyarusso
Posts: 1128
Joined: Wed Mar 03, 2010 12:38 pm
Location: St. Paul, MN, USA
Contact:

Re: Monitoring Ubuntu, Agent File

Post by tonyyarusso »

Has everybody there forgotten that I built a PPA for this, and wrote this document for how to use it? It looks like nobody's updated it to support 12.10 yet (which doesn't actually require any substantial changes - just tell Launchpad to do it). I also committed changes to the Linux server wizard at one point to properly use different service names and such based on what distribution was chosen, but those appear to have been reverted.
Tony Yarusso
Technical Services
___
TIES
Web: http://ties.k12.mn.us/
A.Cormack
Posts: 103
Joined: Fri Nov 23, 2012 6:32 pm

Re: Monitoring Ubuntu, Agent File

Post by A.Cormack »

Slansing - Thanks for that thread, it got me past the SSL, but now im receiving error's after the "Make install" command. It's a never ending cycle lol.

Tony - The guide that you've just mentioned would it be useful in my situations? I did just try to the first command "add-apt...." but it didn't like it.
Locked