{"id":882,"date":"2018-10-15T02:30:08","date_gmt":"2018-10-15T02:30:08","guid":{"rendered":"http:\/\/orissawebhosting.in\/blog\/?p=882"},"modified":"2019-06-27T14:02:52","modified_gmt":"2019-06-27T14:02:52","slug":"how-to-install-nagios-monitoring-tool-in-centos","status":"publish","type":"post","link":"https:\/\/orissawebhosting.in\/blog\/how-to-install-nagios-monitoring-tool-in-centos\/","title":{"rendered":"How to Install Nagios monitoring tool in centos"},"content":{"rendered":"<p><strong>Nagios<\/strong>\u00a0is an awesome\u00a0<strong>Open Source<\/strong>\u00a0monitoring tool, its provides you more comprehensive monitoring environment to always keep an eye on your all\u00a0<strong>machines<\/strong>\u00a0\/\u00a0<strong>networks<\/strong>\u00a0whether you are in a your data center or just your small labs.<\/p>\n<h5>Installing Nagios 4.3.4 and Nagios Plugin 2.2.1<\/h5>\n<p>If you follow these instructions correctly, you will end up with following information.<\/p>\n<ol>\n<li>Nagios and its plugins will be installed under\u00a0<strong>\/usr\/local\/nagios<\/strong>\u00a0directory.<\/li>\n<li>Nagios will be configured to monitor few services of your local machine (<strong>Disk Usage<\/strong>,\u00a0<strong>CPU Load<\/strong>,\u00a0<strong>Current Users<\/strong>,\u00a0<strong>Total Processes<\/strong>, etc.)<\/li>\n<li>Nagios web interface will be available at\u00a0<strong>http:\/\/orissawebhosting.in\/nagios<\/strong><\/li>\n<\/ol>\n<pre> <strong>yum install -y httpd httpd-tools php gcc glibc glibc-common gd gd-devel make net-snmp<\/strong>\n<\/pre>\n<h5>Step 2: Create Nagios User and Group<\/h5>\n<p>Create a new\u00a0<strong>nagios<\/strong>\u00a0user and\u00a0<strong>nagcmd<\/strong>\u00a0group account and set a\u00a0<strong>password<\/strong>.<\/p>\n<pre>useradd nagios\ngroupadd nagcmd<\/pre>\n<p>Next, add both the\u00a0<strong>nagios<\/strong>\u00a0user and the\u00a0<strong>apache<\/strong>\u00a0user to the\u00a0<strong>nagcmd<\/strong>\u00a0group.<\/p>\n<pre>usermod -G nagcmd nagios\nusermod -G nagcmd apache<\/pre>\n<h5>Step 3: Download Nagios Core 4.3.4 and Nagios Plugin 2.2.1<\/h5>\n<p>Create a directory for your\u00a0<strong>Nagios<\/strong>\u00a0installation and all its future downloads.<\/p>\n<pre>mkdir \/root\/nagios\ncd \/root\/nagios<\/pre>\n<p>Now download latest Nagios Core 4.3.4 and Nagios plugins 2.2.1 packages with wget command.<\/p>\n<pre> wget https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-4.3.4.tar.gz\n wget https:\/\/nagios-plugins.org\/download\/nagios-plugins-2.2.1.tar.gz\n<\/pre>\n<h5>Step 4: Extract Nagios Core and its Plugins<\/h5>\n<p>We need to extract downloaded package with\u00a0tar command\u00a0as follows.<\/p>\n<pre>tar -xvf nagios-4.3.4.tar.gz\ntar -xvf nagios-plugins-2.2.1.tar.gz<\/pre>\n<h5>Configure Nagios Core<\/h5>\n<p>Now, first we will configure\u00a0<strong>Nagios Core<\/strong>\u00a0and to do so we need to go to\u00a0<strong>Nagios<\/strong>\u00a0directory and run configure file and if everything goes fine, it will show the output in the end as sample output. Please see below.<\/p>\n<pre>cd nagios-4.3.4\/\n.\/configure --with-command-group=nagcmd<\/pre>\n<p>After configuring, we need to\u00a0<strong>compile<\/strong>\u00a0and\u00a0<strong>install<\/strong>\u00a0all the binaries with\u00a0<strong>make all<\/strong>\u00a0and\u00a0<strong>make install<\/strong>\u00a0command, it will install all the needed libraries in your machine and we can proceed further.<\/p>\n<pre>make all\nmake install<\/pre>\n<p>Following command will install the\u00a0<strong>init scripts<\/strong>\u00a0for Nagios.<\/p>\n<pre>make install-init<\/pre>\n<p>To make nagios work from command line we need to install\u00a0<strong>command-mode<\/strong>.<\/p>\n<pre>make install-commandmode<\/pre>\n<p>Next, install sample nagios files, please run following command.<\/p>\n<pre>make install-config<\/pre>\n<h5>Step 5: Customizing Nagios Configuration<\/h5>\n<p>Open the \u201c<strong>contacts.cfg<\/strong>\u201d file with your choice of editor and set the\u00a0<strong>email address<\/strong>\u00a0associated with the nagiosadmin contact definition to receiving email alerts.<\/p>\n<pre>vi \/usr\/local\/nagios\/etc\/objects\/contacts.cfg<\/pre>\n<h5>Step 6: Install and Configure Web Interface for Nagios<\/h5>\n<p>We are done with all configuration in the backend, now we will configure Web Interface For Nagios with following command. The below command will Configure Web interface for Nagios and a web admin user will be created \u201c<strong>nagiosadmin<\/strong>\u201d.<\/p>\n<pre>make install-webconf<\/pre>\n<p>In this step, we will be creating a password for \u201c<strong>nagiosadmin<\/strong>\u201d. After executing this command, please provide a\u00a0<strong>password twice<\/strong>\u00a0and keep it remember because this password will be used when you login in the Nagios Web interface.<\/p>\n<pre>htpasswd -s -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin\nNew password:\nRe-type new password:\nAdding password for user nagiosadmin<\/pre>\n<h5>Step 7: Compile and Install Nagios Plugin<\/h5>\n<p>We have downloaded nagios plugins in\u00a0<strong>\/root\/nagios<\/strong>, Go there and configure and install it as directed below.<\/p>\n<pre>cd \/root\/nagios\ncd nagios-plugins-2.2.1\/\n.\/configure --with-nagios-user=nagios --with-nagios-group=nagios\nmake all \nmake install<\/pre>\n<h5>Step 8: Verify Nagios Configuration Files<\/h5>\n<p>Now we are all done with\u00a0<strong>Nagios configuration<\/strong>\u00a0and its time to\u00a0<strong>verify<\/strong>\u00a0it and to do so please insert following command. If everything goes smooth it will show up similar to below output.<\/p>\n<pre>\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/pre>\n<p>Restart\u00a0<strong>Apache<\/strong>\u00a0to make the new settings take effect.<\/p>\n<pre>systemctl start httpd.service<\/pre>\n<h4>Step 10: Login to the Nagios Web Interface<\/h4>\n<p>Your nagios is ready to work, please open it in your browser with \u201c<strong>http:\/\/YourIP-address\/nagios<\/strong>\u201d or <strong>http:\/\/orissawebhosting.in\/nagios<\/strong>\u00a0and Provide the username \u201c<strong>nagiosadmin<\/strong>\u201d and\u00a0<strong>password<\/strong>.<\/p>\n<h5><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-887 size-full\" src=\"http:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Capture.png\" alt=\"\" width=\"560\" height=\"168\" srcset=\"https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Capture.png 560w, https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Capture-300x90.png 300w\" sizes=\"(max-width: 560px) 100vw, 560px\" \/><\/h5>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-888 size-full\" src=\"http:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Nagios.png\" alt=\"\" width=\"1049\" height=\"567\" srcset=\"https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Nagios.png 1049w, https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Nagios-300x162.png 300w, https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Nagios-768x415.png 768w, https:\/\/orissawebhosting.in\/blog\/wp-content\/uploads\/2018\/10\/Nagios-1024x553.png 1024w\" sizes=\"(max-width: 1049px) 100vw, 1049px\" \/><\/p>\n<p>You\u2019ve successfully installed and configured\u00a0<strong>Nagios<\/strong>\u00a0and its\u00a0<strong>Plugins<\/strong>. You\u2019ve just begin your journey into monitoring.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nagios\u00a0is an awesome\u00a0Open Source\u00a0monitoring tool, its provides you more comprehensive monitoring environment to always keep an eye on your all\u00a0machines\u00a0\/\u00a0networks\u00a0whether you are in a your data center or just your small labs. Installing Nagios 4.3.4 and Nagios Plugin 2.2.1 If you follow these instructions correctly, you will end up with following information. Nagios and its plugins will be installed under\u00a0\/usr\/local\/nagios\u00a0directory. Nagios will be configured to monitor few services of your local machine (Disk Usage,\u00a0CPU Load,\u00a0Current Users,\u00a0Total Processes, etc.) Nagios web interface will be available at\u00a0http:\/\/orissawebhosting.in\/nagios yum install -y httpd httpd-tools&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/882"}],"collection":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/comments?post=882"}],"version-history":[{"count":5,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions"}],"predecessor-version":[{"id":1059,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/posts\/882\/revisions\/1059"}],"wp:attachment":[{"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/media?parent=882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/categories?post=882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orissawebhosting.in\/blog\/wp-json\/wp\/v2\/tags?post=882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}