<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dee Double Dub &#187; Nagios</title>
	<atom:link href="http://www.deedoubledub.com/tag/nagios/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deedoubledub.com</link>
	<description>random points of interest</description>
	<lastBuildDate>Fri, 17 Jul 2009 00:30:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Nagios NRPE setup on Ubuntu 8.04</title>
		<link>http://www.deedoubledub.com/2009/03/nagios-nrpe-setup-on-ubuntu-804/</link>
		<comments>http://www.deedoubledub.com/2009/03/nagios-nrpe-setup-on-ubuntu-804/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 23:37:12 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Nagios]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://deedoubledub.phpnet.us/?p=31</guid>
		<description><![CDATA[Here is a step by step walkthrough that I developed recently for setting up the Nagios NRPE plugin to monitor remote hosts. This setup was performed on a host running Ubuntu Server 8.04.1. This walkthrough is based on the official nagios documentation and will result in a NRPE plugin installed from source since the latest version of nagios and its plugins are not available in the Ubuntu 8.04 repositories.]]></description>
			<content:encoded><![CDATA[<p>Here is a step by step walkthrough that I developed recently for setting up the <a href="http://www.nagios.org">Nagios</a> NRPE plugin to monitor remote hosts.  This setup was performed on a host running Ubuntu Server 8.04.1.  This walkthrough is based on the official nagios documentation and will result in a NRPE plugin installed from source since the latest version of nagios and its plugins are not available in the Ubuntu 8.04 repositories.</p>
<p><span id="more-31"></span></p>
<h3>On the remote host (machine to be monitored)</h3>
<p>1. Become root.  This just makes it easier so you don&#8217;t have to keep typing sudo.<br />
<code># sudo -s</code></p>
<p>2. Create nagios user and set password<br />
<code>$ /usr/sbin/useradd nagios<br />
$ passwd nagios</code></p>
<p>3. Install the OpenSSL development libraries required to compile the NRPE plugin<br />
<code>$ apt-get install libssl-dev openssl</code></p>
<p>4. Download source tarball of Nagios plugins (<a href="http://www.nagios.org/download">http://www.nagios.org/download</a>)<br />
<code>$ wget &lt;nagios-plugins, latest stable version&gt;</code></p>
<p>5. Extract the tarball<br />
<code>$ tar xzf &lt;nagios-plugins...&gt;.tar.gz<br />
$ cd &lt;nagios-plugins...&gt;</code></p>
<p>5a. (optional) Install additional libraries required for any plugins that you will need.  See the REQUIREMENTS document included with nagios plugins source code for any dependencies necessary for specific plugins.</p>
<p>6. Compile and install the plugins<br />
<code>$ ./configure<br />
$ make<br />
$ make install</code></p>
<p>7. Fix the permissions on the plugin directory and the plugins<br />
<code>$ chown nagios:nagios /usr/local/nagios<br />
$ chown -R nagios:nagios /usr/local/nagios/libexec</code></p>
<p>8. Install xinetd<br />
<code>$ apt-get install xinetd</code></p>
<p>9. Install the NRPE daemon, download the source tarball for NRPE from <a href="http://www.nagios.org/download">http://www.nagios.org/download</a><br />
<code>$ wget &lt;nrpe, latest stable version&gt;<br />
$ tar xzf &lt;nrpe...&gt;.tar.gz<br />
$ cd &lt;nrpe...&gt;<br />
$ ./configure<br />
$ make all<br />
<br />
$ make install-plugin<br />
$ make install-daemon<br />
$ make install-daemon-config<br />
$ make install-xinetd</code></p>
<p>10. Edit /etc/xinetd.d/nrpe and add the IP address of the monitoring server to the only_from directive.  This directive can contain multiple IP addresses provided in a space separated list.  This example will allow access from the Nagios monitoring server as well as the localhost.<br />
<code>$ vi /etc/xinetd.d/nrpe<br />
<br />
. . .<br />
<br />
only_from    =xxx.xxx.xxx.xxx 127.0.0.1</code></p>
<p>11. Edit /etc/services to add the NRPE port definition<br />
<code>$ vi /etc/services<br />
<br />. . .<br />
<br />
nrpe    5666/tcp    # NRPE</code></p>
<p>12. Restart xinetd<br />
<code>$ /etc/init.d/xinetd restart</code></p>
<p>13. Test the NRPE daemon locally</p>
<p>First, use netstat to make sure that it is running under xinetd<br />
<code>$ netstat -at | grep nrpe</code><br />
should produce this output:<br />
<code>tcp 0 0 *:nrpe *:* LISTEN</code></p>
<p>Now give it a test using the Nagios check_nrpe plugin:<br />
<code>$ /usr/local/nagios/libexec/check_nrpe -H localhost</code><br />
You should see this output (with the appropriate version number of course)<br />
<code>NRPE v2.12</code></p>
<p>14. At this point you should be able to access the Nagios NRPE daemon on this host from the monitoring server to execute plugins locally.  Make sure to modify your firewall rules to allow access on port 5666 to the NRPE daemon.  The commands that are to be executed by the NRPE plugin can be customized in /usr/local/nagios/etc/nrpe.cfg.</p>
<h3>On the monitoring host (machine running nagios)</h3>
<p>1. Become root<br />
<code>$ sudo -s</code></p>
<p>2. Download and install the check_nrpe plugin (<a href="http://www.nagios.org/download">http://www.nagios.org/download</a>)<br />
<code>$ wget &lt;nrpe, latest stable version&gt;<br />
$ tar xzf &lt;nrpe...&gt;.tar.gz<br />
$ cd &lt;nrpe...&gt;<br />
$ ./configure<br />
$ make all<br />
$ make install-plugin</code></p>
<p>3. Test communication with remote NRPE daemon<br />
<code>$ /usr/local/nagios/libexec/check_nrpe -H &lt;hostname&gt;</code><br />
Your output should look like this if everything is successful (with the proper version number again).<br />
<code>NRPE v2.12</code></p>
<p>4. Create the NRPE command definition wherever in your configuration files you have commands defined.<br />
<code>$ vi /usr/local/nagios/etc/objects/commands.cfg<br />
<br />
. . .<br />
<br />
define command{<br />
&nbsp;&nbsp;&nbsp;&nbsp;command_name check_nrpe<br />
&nbsp;&nbsp;&nbsp;&nbsp;command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$<br />
}</code></p>
<p>5. Now you can create host and service definitions for the remote host and begin monitoring local services through the NRPE plugin and daemon.<br />
SAMPLE:<br />
<code>define service{<br />
&nbsp;&nbsp;&nbsp;&nbsp;use generic-service<br />
&nbsp;&nbsp;&nbsp;&nbsp;host_name remotehost<br />
&nbsp;&nbsp;&nbsp;&nbsp;service_description Current Users<br />
&nbsp;&nbsp;&nbsp;&nbsp;check_command check_nrpe!check_users<br />
}<br />
; check_nrpe tells the remote nrpe daemon to execute<br />
; the check_users command as defined in nrpe.cfg</code></p>
<p>6. Verify your configuration and restart the Nagios daemon to begin monitoring the remote host.<br />
Verify your nagios configuration:<br />
<code>$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg</code><br />
If everything checks out, restart the Nagios daemon:<br />
<code>$ /etc/init.d/nagios restart</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deedoubledub.com/2009/03/nagios-nrpe-setup-on-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
