{"id":771,"date":"2011-08-09T11:26:44","date_gmt":"2011-08-09T16:26:44","guid":{"rendered":"http:\/\/it.thelibrarie.com\/weblog\/?p=771"},"modified":"2012-05-18T08:42:24","modified_gmt":"2012-05-18T13:42:24","slug":"nagios-add-nrpe","status":"publish","type":"post","link":"https:\/\/it.thelibrarie.com\/weblog\/2011\/08\/nagios-add-nrpe\/","title":{"rendered":"Nagios Add NRPE"},"content":{"rendered":"<p>NRPE Install and Configuration<br \/>\nThis assumes nagios has been installed and configured already. I needed to add nagios monitoring for some remote linux servers.  I had only dabbled with nagios before and had setup PING only for testing if a server was up or down.  But we now required service testing and HD monitoring.<\/p>\n<p>REMOTE CLIENT INSTALL<br \/>\nInstalled on Ubuntu 10.04.3 LTS<\/p>\n<p>Update the system<\/p>\n<blockquote><p><code>apt-get update<\/code><br \/>\n<code>apt-get upgrade<\/code><\/p><\/blockquote>\n<p>Install the NRPE server<\/p>\n<blockquote><p><code>apt-get install nagios-nrpe-server<\/code><br \/>\nThis will ask if you want to install a bunch of extra packages &#8211; hit <em>Y<\/em><\/p><\/blockquote>\n<p>Verify the service has started<\/p>\n<blockquote><p><code>ps aux | grep nrpe<\/code><br \/>\nYou should see a command running from <em>\/usr\/sbin\/nrpe<\/em><\/p><\/blockquote>\n<p>Test a command you want to run.  In my case, I wanted to check the \/dev\/mapper\/pve-data drive<\/p>\n<blockquote><p><code>\/usr\/lib\/nagios\/plugins\/check_disk -w 20% -c 10% -p \/dev\/mapper\/pve-data<\/code><br \/>\n<em>DISK OK<\/em><\/p><\/blockquote>\n<p>Edit the NRPE configuration file<\/p>\n<blockquote><p><code>nano \/etc\/nagios\/nrpe.cfg<\/code><br \/>\nLook for allowed_hosts=127.0.0.1<br \/>\nChange to allowed_hosts=127.0.0.1,IPADDRESSOFNAGIOSSERVER<br \/>\nI then added the following command<br \/>\n<code>command[check_disk]=\/usr\/lib\/nagios\/plugins\/check_disk -w 20% -c 10% -p \/dev\/mapper\/pve-data<\/code><br \/>\nSave the configuration, then restart the service<br \/>\n<code>\/etc\/init.d\/nagios-nrpe-server restart<\/code>\n<\/p><\/blockquote>\n<p>NAGIOS SERVER CONFIGURATION<\/p>\n<blockquote><p>Download the latest version of NRPE from http:\/\/exchange.nagios.org\/directory\/Addons\/Monitoring-Agents\/NRPE&#8211;2D-Nagios-Remote-Plugin-Executor\/details<br \/>\n<code>wget http:\/\/prdownloads.sourceforge.net\/sourceforge\/nagios\/nrpe-2.12.tar.gz<\/code><br \/>\n<code>tar zvxf nrpe-2.12.tar.gz<\/code><br \/>\n<code>cd nrpe-2.12<\/code><br \/>\n<code>.\/configure --enable-command-args<\/code><br \/>\n<code>make all<\/code><br \/>\n<code>make install-plugin<\/p><\/blockquote>\n<p><\/code><\/p>\n<p>Verify connectivity with the remote system from Nagios<\/p>\n<blockquote><p><code>\/usr\/local\/nagios\/libexec\/check_nrpe -H IP.OF.SER.VER<\/code><br \/>\nIf this spits back NRPE v2.12 then you&#8217;re in business.  If not, then it won&#8217;t connect.<\/p><\/blockquote>\n<p>We now have to make a command for Nagios to use NRPE<\/p>\n<blockquote><p><code>nano \/usr\/local\/nagios\/etc\/objects\/commands.cfg<\/code><br \/>\nAdd the following<br \/>\ndefine command{<br \/>\n        command_name    check_nrpe<br \/>\n        command_line    $USER1$\/check_nrpe -H $HOSTADDRESS$ -c $ARG1$<br \/>\n}<br \/>\nSave and close<\/p><\/blockquote>\n<p>Now we can create the remote machine configuration file<\/p>\n<blockquote><p><code>nano \/usr\/local\/nagios\/etc\/objects\/SOMENAME.cfg<\/code><br \/>\n<a href=\"http:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2011\/08\/nrpe_check.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2011\/08\/nrpe_check-150x150.png\" alt=\"\" title=\"nrpe_check\" width=\"150\" height=\"150\" class=\"alignnone size-thumbnail wp-image-772\" \/><\/a><\/p><\/blockquote>\n<p>Then restart the Nagios service and test<\/p>\n<blockquote><p><code>\/etc\/init.d\/nagios restart<\/code><br \/>\n<a href=\"http:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2011\/08\/nrpe_check_2.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/it.thelibrarie.com\/weblog\/wp-content\/uploads\/2011\/08\/nrpe_check_2-150x107.png\" alt=\"\" title=\"nrpe_check_2\" width=\"150\" height=\"107\" class=\"alignnone size-thumbnail wp-image-773\" \/><\/a>\n<\/p><\/blockquote>\n<p>For CentOS\/RHEL (RPM)<br \/>\nNavigate to http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm<br \/>\nFind the latest release for your distribution (ie RHEL6 and CentOS6 x64 is http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm)<br \/>\nCopy the link location<br \/>\nOpen a command shell terminal window on your CentOS\/RHEL machine<br \/>\n<code>rpm -Uvh http:\/\/pkgs.repoforge.org\/rpmforge-release\/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm<\/code><br \/>\n<code>yum install nagios-nrpe nagios-plugins-nrpe<\/code><\/p>\n<p><code>df -h<\/code><br \/>\nfind the name of the drive you want to monitor (or drives, ie \/dev\/mapper\/vg_centos-lv_root)<br \/>\n<code>nano \/etc\/nagios\/nrpe.cfg<\/code><br \/>\nFind allowed_hosts=127.0.0.1<br \/>\nChange to allowed_hosts=127.0.0.1,10.4.0.253<br \/>\nFind command[check_hda1]<br \/>\nAdd a line underneath to be command[check_disk]=\/usr\/lib64\/nagios\/plugins\/check_disk -w 20% -c 10% -p \/dev\/mapper\/vg_centos-lv-root (same as df -h output)<br \/>\nVerify your command will work:<br \/>\n<code>\/usr\/lib64\/nagios\/plugins\/check_disk -w 20% -c 10% -p \/dev\/mapper\/vg_centos-lv-root<\/code><br \/>\n<code>nano \/etc\/xinetd.d\/nrpe<\/code><br \/>\nFind allowed_hosts=127.0.0.1<br \/>\nChange to allowed_hosts=127.0.0.1,10.4.0.253<br \/>\n<code>nano \/etc\/services<\/code><br \/>\nAdd nrpe 5666\/tcp # nrpe (follow along with the template)<br \/>\n<code>service nrpe restart<\/code><br \/>\nAnd to have this automatically start:<br \/>\n<code>chkconfig --add nrpe<\/code><br \/>\n<code>chkconfig nrpe on<\/code><\/p>\n<p>I ran the test from nagios (\/usr\/local\/nagios\/libexec\/check_nrpe -H IP.OF.Server) and was receiving an error:<br \/>\nCHECK_NRPE: Error &#8211; Could not complete SSL handshake.<\/p>\n<p>Change the allowed_hosts to only be the IP of the nagios server, not localhost, then service nrpe restart<\/p>\n<p>Add to the nagios monitoring server<br \/>\nProfit!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>NRPE Install and Configuration This assumes nagios has been installed and configured already. I needed to add nagios monitoring for some remote linux servers. I had only dabbled with nagios before and had setup PING only for testing if a server was up or down. But we now required service testing and HD monitoring. REMOTE &hellip; <a href=\"https:\/\/it.thelibrarie.com\/weblog\/2011\/08\/nagios-add-nrpe\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Nagios Add NRPE<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-771","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/comments?post=771"}],"version-history":[{"count":6,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/771\/revisions"}],"predecessor-version":[{"id":833,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/posts\/771\/revisions\/833"}],"wp:attachment":[{"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/media?parent=771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/categories?post=771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it.thelibrarie.com\/weblog\/wp-json\/wp\/v2\/tags?post=771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}