{"id":2634,"date":"2018-10-09T12:04:39","date_gmt":"2018-10-09T06:34:39","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2634"},"modified":"2018-10-12T15:46:25","modified_gmt":"2018-10-12T10:16:25","slug":"nagios-remote-host-monitoring","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/nagios-remote-host-monitoring\/","title":{"rendered":"Nagios Remote Host Monitoring"},"content":{"rendered":"<h3><strong>Nagios Remote Host Monitoring<\/strong><br \/>\nDated on :05\/10\/2018<\/h3>\n<h4><strong>On Remote Host<\/strong><\/h4>\n<p>Step 1: Install the compiler gcc,glibc<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel<br \/>\n<\/code><\/p>\n<p>Step 2: Add the user for the nagios using<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">useradd nagios<\/code><\/p>\n<p>Note: If already exist skip this.<\/p>\n<p>Step 3: Add the password for created user<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">passwd nagios<\/code><\/p>\n<p>Note: Then give the New password and then confirm the new password<\/p>\n<p>Step 4: Create Directory using<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">mkdir \/root\/nagios<\/code><\/p>\n<p>Step 5: Go to the created directory<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cd \/root\/nagios<\/code><\/p>\n<p>Step 6: Install the Nagios Plugins<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">wget https:\/\/www.nagios-plugins.org\/download\/nagios-plugins-2.2.1.tar.gz<\/code><\/p>\n<p>Note : choose the file name upto your choice . If you want the latest version find the path and give the path.<\/p>\n<p>Step 7: Extract nagios plugin using tar command<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tar -xvf nagios-plugins-2.2.1.tar.gz<\/code><\/p>\n<p>Step 8: Check whether the folder appear in the directory<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">ls \u2013l<\/code><\/p>\n<p>Step 9: Compile and install nagios using<\/p>\n<p>Step 9.1: Go to <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cd nagios-plugins-2.2.1<\/code><\/p>\n<p>Step 9.2: User editor to edit the\u00a0 <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">.\/configure<\/code><\/p>\n<p>Step 9.3: Add make and make all<\/p>\n<p>Step 10: Set the permission on the plugin directory<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">chown nagios.nagios \/usr\/local\/nagios<\/code><\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">chown -R nagios.nagios \/usr\/local\/nagios\/libexec<\/code><\/p>\n<p>Step 11: install xinetd service using<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">yum install xinetd<\/code><\/p>\n<p>Step 12: install NRPE plugin on the remote host machine<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">wget http:\/\/liquidtelecom.dl.sourceforge.net\/project\/nagios\/nrpe-3.x\/nrpe-3.1.1\/nrpe-3.1.1.tar.gz<\/code><\/p>\n<p>NOTE: choose the latest version if you wish<\/p>\n<p>Step 13: unpack NRPE source file using tar command<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tar xzf nrpe-3.1.1.tar.gz<\/code><\/p>\n<p>Compile and install the NRPE addon<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n<p>Step 14: Go to<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cd nrpe-3.1.1<\/code><\/p>\n<p>Step 15: edit the file using editor<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">.\/configure<\/code><\/p>\n<p>Step 16: Add make all<\/p>\n<p>install the NRPE plugin daemon, and sample daemon config file<\/p>\n<p>Step 17: Install plugin<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">make install-plugin<\/code><\/p>\n<p>Step 18: Install daemon<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">make install-daemon<\/code><\/p>\n<p>Step 19: make install-daemon-config<\/p>\n<p>Install the NRPE daemon under xinetd as a service<\/p>\n<p>Step 20: <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">make install-xinetd<br \/>\nOR<br \/>\nmake install-inetd<\/code><\/p>\n<p>Now open <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/etc\/xinetd.d\/nrpe\u00a0<\/code>file and add the localhost and IP address of the Nagios Monitoring Server.<\/p>\n<p>Step 21: only_from = 127.0.0.1 &lt;nagios_ip_address&gt;<\/p>\n<p>Step 22: Next, open \/etc\/services file add the following entry for the NRPE daemon at the bottom of the file.<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"> nrpe 5666\/tcp NRPE\u00a0<\/code><\/p>\n<p>Step 23:Restart the xinetd service<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">service xinetd restart<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Step 24:Verify NRPE Daemon Locally<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">netstat -at | grep nrpe<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Step 25:\u00a0Run the \u201ccheck_nrpe\u201d command<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/usr\/local\/nagios\/libexec\/check_nrpe -H &lt;localhost IP ex:127.0.0.1&gt;<\/code><\/p>\n<p>Note: you will the output as NRPE v3.2.1. Version will change it belongs the tar file which you downloaded.<br \/>\nConfigure Firewall Rules<\/p>\n<p>Step 26: &#8212;&#8212;&#8212;&#8212;&#8211; On RHEL\/CentOS 6\/5 and Fedora &#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">iptables -A INPUT -p tcp -m tcp --dport 5666 -j ACCEPT<\/code><\/p>\n<p>&#8212;&#8212;&#8212;- On RHEL\/CentOS 7 and Fedora 19 Onwards &#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">firewall-cmd --permanent --zone=public --add-port=5666\/tcp<\/code><\/p>\n<p>Run the following command to Save the new iptables rule<\/p>\n<p>Step 27: &#8212;&#8212;&#8212;&#8212;&#8211; On RHEL\/CentOS 6\/5 and Fedora &#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">service iptables save<\/code><\/p>\n<p>&nbsp;<\/p>\n<p><strong>On Nagios Monitoring Server<\/strong><\/p>\n<p>Step 1: Go to<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">cd \/root\/nagios<\/code><\/p>\n<p>Step 2: Get the software<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">wget http:\/\/liquidtelecom.dl.sourceforge.net\/project\/nagios\/nrpe-3.x\/nrpe-3.1.1\/nrpe-3.1.1.tar.gz<\/code><\/p>\n<p>Step 3: Unpack the NRPE source code tarball.<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tar xzf nrpe-3.1.1.tar.gz<\/code><\/p>\n<p>Step 4: Go to cd nrpe-3.0<\/p>\n<p>Compile and install the NRPE addon.<\/p>\n<p>Step 5: .\/configure<\/p>\n<p>Step 6: make all<\/p>\n<p>Step 7: make install-daemon<br \/>\nVerify NRPE Daemon Remotely<\/p>\n<p>Step 8: Go to the location<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">\/usr\/local\/nagios\/libexec\/check_nrpe -H &lt;remote_linux_ip_address&gt;<\/code><\/p>\n<p>Step 9: Edit using vi editor<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vi \/usr\/local\/nagios\/etc\/servers\/hostname.cfg<\/code><\/p>\n<p>Note: you have a different host name so change the hostname in the config file.<\/p>\n<p>Step 10: Define the host name and the service in the config file<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">define host {\r\nuse linux-server\r\nhost_name example_01\r\nalias example_01\r\naddress xxx.xxx.xxx.xxx\r\nmax_check_attempts 5\r\ncheck_period 24x7\r\nnotification_interval 30\r\nnotification_period 24x7\r\n}\r\ndefine service {\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description PING\r\ncheck_command check_ping!100.0,20%!500.0,60%\r\n}\r\ndefine service {\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description SSH\r\ncheck_command check_ssh\r\nnotifications_enabled 0\r\n}\r\n\r\ndefine service {\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Nginx\r\ncheck_command check_tcp!80\r\n}\r\n\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Load\r\ncheck_command check_nrpe!check_load\r\n}\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Disk\r\ncheck_command check_nrpe!check_disk\r\n}\r\n\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Processes\r\ncheck_command check_nrpe!check_procs\r\n}\r\n\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Uptime\r\ncheck_command check_nrpe!check_uptime\r\n}\r\n\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description Memory\r\ncheck_command check_nrpe!check_mem\r\n}\r\n\r\ndefine service{\r\nuse generic-service,nagiosgraph\r\nhost_name example_01\r\nservice_description uWSGI\r\ncheck_command check_nrpe!check_uwsgi\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nagios Remote Host Monitoring Dated on :05\/10\/2018 On Remote Host Step 1: Install the compiler gcc,glibc yum install -y gcc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[433,432],"class_list":["post-2634","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-nagios-monitoring","tag-server-monitoring","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Gu","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2634","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2634"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2634\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2634"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2634"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2634"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}