{"id":2762,"date":"2016-09-22T17:27:40","date_gmt":"2016-09-22T21:27:40","guid":{"rendered":"https:\/\/www.globo.tech\/learning-center\/?p=2762"},"modified":"2017-04-19T15:57:04","modified_gmt":"2017-04-19T19:57:04","slug":"install-configure-nagios-centos-7","status":"publish","type":"post","link":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/","title":{"rendered":"How to install and Configure Nagios on CentOS 7"},"content":{"rendered":"<p>Nagios is a very popular server monitoring software application that&#8217;s been in development since 1999 and is still regularly updated. The server administrator who uses Nagios gains access to a wide variety of features such as SSH-enabled remote monitoring, network and host traffic monitoring, and a versatile plugin ecosystem. Nagios is free and open source under the GNU General Public License, version 2.<\/p>\n<h2>Getting started<\/h2>\n<p>Before you begin, make sure you have the following prepared:<br \/>\n\u2022 1 Remote server (<a href=\"https:\/\/www.globo.tech\/cloud-server-pricing\" target=\"_blank\">Cloud Server<\/a> or <a href=\"http:\/\/www.globo.tech\/dedicated-server-hosting\" target=\"_blank\">Dedicated Server<\/a>) running CentOS 7.<br \/>\n\u2022 All commands should be run as the root user<\/p>\n<h2>Tutorial<\/h2>\n<p>The first step is to make sure that Selinux is disabled.<\/p>\n<p><code>setenforce 0<br \/>\nsed -i 's\/enforcing\/disabled\/' \/etc\/sysconfig\/selinux<br \/>\nsed -i 's\/enforcing\/disabled\/' \/etc\/selinux\/config<\/code><\/p>\n<p>Once you&#8217;ve done that, you&#8217;ll need to install some basic prerequisite packages for Nagios.<\/p>\n<p><code>yum install gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget unzip nano -y<\/code><\/p>\n<p>Let&#8217;s install the Apache webserver and PHP.<\/p>\n<p><code>yum install httpd php php-cli -y<\/code><\/p>\n<p>We&#8217;ll be adding a Nagios user to our system, along with nagcmd, so that Nagios and Apache can be integrated together.<\/p>\n<p><code>useradd nagios<br \/>\ngroupadd nagcmd<br \/>\nusermod -a -G nagcmd nagios<br \/>\nusermod -a -G nagcmd apache<\/code><\/p>\n<p>Now, we&#8217;ll proceed with the installation of Nagios proper. This requires that you download Nagios and the Nagios plugins from the official site.<\/p>\n<p><code>cd \/tmp<br \/>\nwget https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-4.2.1.tar.gz<br \/>\nwget https:\/\/nagios-plugins.org\/download\/nagios-plugins-2.1.2.tar.gz<\/code><\/p>\n<p>Unzip the Nagios archive you downloaded and use the script inside to install the program.<\/p>\n<p><code>tar -zxvf nagios-4.2.1.tar.gz<br \/>\ncd nagios-4.2.1\/<br \/>\n.\/configure --with-command-group=nagcmd<br \/>\nmake all<br \/>\nmake install<br \/>\nmake install-init<br \/>\nmake install-config<br \/>\nmake install-commandmode<br \/>\nmake install-webconf<\/code><\/p>\n<p>Open the contact file in your favorite text editor and change the enclosed email address to your own.<\/p>\n<p><code>nano \/usr\/local\/nagios\/etc\/objects\/contacts.cfg<\/code><\/p>\n<p><code class=\"gris\">[...]<br \/>\n# This contact definition inherits a lot of default values from the 'generic-contact'<br \/>\n# template which is defined elsewhere.<br \/>\ndefine contact{<br \/>\n        contact_name                    nagiosadmin             ; Short name of user<br \/>\n        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)<br \/>\n        alias                           Nagios Admin            ; Full name of user<br \/>\n        email                           nagios@localhost        ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******\n        }\n[...]<\/code><\/p>\n<p>Now, set the password that you'll use to access Nagios.<\/p>\n<p><code>htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin<\/code><\/p>\n<p>After that, you can unzip and install the Nagios plugins from the second archive you downloaded.<\/p>\n<p><code>cd \/tmp<br \/>\ntar -zxvf nagios-plugins-2.1.2.tar.gz<br \/>\ncd nagios-plugins-2.1.2\/<br \/>\n.\/configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl<br \/>\nmake<br \/>\nmake install<\/code><\/p>\n<p>Just to be safe, check that your config file has no errors.<\/p>\n<p><code>\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/code><\/p>\n<p><code class=\"gris\">Nagios Core 4.2.1<br \/>\nCopyright (c) 2009-present Nagios Core Development Team and Community Contributors<br \/>\nCopyright (c) 1999-2009 Ethan Galstad<br \/>\nLast Modified: 09-06-2016<br \/>\nLicense: GPL<br \/>\nWebsite: https:\/\/www.nagios.org<br \/>\nReading configuration data...<br \/>\n   Read main config file okay...<br \/>\n   Read object config files okay...<br \/>\nRunning pre-flight check on configuration data...<br \/>\nChecking objects...<br \/>\n        Checked 8 services.<br \/>\n        Checked 1 hosts.<br \/>\n        Checked 1 host groups.<br \/>\n        Checked 0 service groups.<br \/>\n        Checked 1 contacts.<br \/>\n        Checked 1 contact groups.<br \/>\n        Checked 24 commands.<br \/>\n        Checked 5 time periods.<br \/>\n        Checked 0 host escalations.<br \/>\n        Checked 0 service escalations.<br \/>\nChecking for circular paths...<br \/>\n        Checked 1 hosts<br \/>\n        Checked 0 service dependencies<br \/>\n        Checked 0 host dependencies<br \/>\n        Checked 5 timeperiods<br \/>\nChecking global event handlers...<br \/>\nChecking obsessive compulsive processor commands...<br \/>\nChecking misc settings...<br \/>\nTotal Warnings: 0<br \/>\nTotal Errors:   0<br \/>\nThings look okay - No serious problems were detected during the pre-flight check<\/code><\/p>\n<p>The final step is to start up the Nagios and Apache daemons.<\/p>\n<p><code>service httpd start<br \/>\nservice nagios start<\/code><\/p>\n<p>In order to access your Nagios interface, you can use the convenient web-based interface. This should be located at this URL:<\/p>\n<p><code class=\"gris\">http:\/\/your_ip\/nagios\/<\/code><\/p>\n<p>Here's the login information that you can use the first time:<\/p>\n<p>Login : nagiosadmin<br \/>\nPassword : The password you set previously<\/p>\n<p>Feel free to change the login name to something more obfuscated.<\/p>\n<h2>Conclusion<\/h2>\n<p>Now that you know how to install Nagios on your system, you can use it as a quick and simple, yet full-featured, monitoring tool for any system under your purview. If you found this article helpful, feel free to share it with your friends and let us know in the comments below! <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Nagios is a very popular server monitoring software application that&#8217;s been in development since 1999 and is still regularly updated. The server administrator who uses Nagios gains access to a wide variety of features such as SSH-enabled remote monitoring, network and host traffic monitoring, and a versatile plugin ecosystem. Nagios is free and open source<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[72],"tags":[],"class_list":["post-2762","post","type-post","status-publish","format-standard","hentry","category-monitoring","operating_system-centos-7"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to install and Configure Nagios on CentOS 7 - Globo.Tech<\/title>\n<meta name=\"description\" content=\"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now &amp; Start monitoring today!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install and Configure Nagios on CentOS 7 - Globo.Tech\" \/>\n<meta property=\"og:description\" content=\"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now &amp; Start monitoring today!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/\" \/>\n<meta property=\"og:site_name\" content=\"Globo.Tech\" \/>\n<meta property=\"article:published_time\" content=\"2016-09-22T21:27:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-19T19:57:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"963\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"GloboTech Communications\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"GloboTech Communications\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/\"},\"author\":{\"name\":\"GloboTech Communications\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"headline\":\"How to install and Configure Nagios on CentOS 7\",\"datePublished\":\"2016-09-22T21:27:40+00:00\",\"dateModified\":\"2017-04-19T19:57:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/\"},\"wordCount\":371,\"commentCount\":0,\"articleSection\":[\"Monitoring\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/\",\"name\":\"How to install and Configure Nagios on CentOS 7 - Globo.Tech\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\"},\"datePublished\":\"2016-09-22T21:27:40+00:00\",\"dateModified\":\"2017-04-19T19:57:04+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\"},\"description\":\"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now & Start monitoring today!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/install-configure-nagios-centos-7\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install and Configure Nagios on CentOS 7\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#website\",\"url\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/\",\"name\":\"Globo.Tech\",\"description\":\"Welcome to the Official Globo.Tech Learning Center\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.globo.tech\\\/learning-center\\\/#\\\/schema\\\/person\\\/e17784b37f4a4f49b7bc611847912e87\",\"name\":\"GloboTech Communications\",\"sameAs\":[\"http:\\\/\\\/www.gtcomm.net\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install and Configure Nagios on CentOS 7 - Globo.Tech","description":"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now & Start monitoring today!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/","og_locale":"en_US","og_type":"article","og_title":"How to install and Configure Nagios on CentOS 7 - Globo.Tech","og_description":"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now & Start monitoring today!","og_url":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/","og_site_name":"Globo.Tech","article_published_time":"2016-09-22T21:27:40+00:00","article_modified_time":"2017-04-19T19:57:04+00:00","og_image":[{"width":1920,"height":963,"url":"https:\/\/www.globo.tech\/learning-center\/wp-content\/uploads\/2016\/09\/GloboTech-Logo.png","type":"image\/png"}],"author":"GloboTech Communications","twitter_misc":{"Written by":"GloboTech Communications","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/#article","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/"},"author":{"name":"GloboTech Communications","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"headline":"How to install and Configure Nagios on CentOS 7","datePublished":"2016-09-22T21:27:40+00:00","dateModified":"2017-04-19T19:57:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/"},"wordCount":371,"commentCount":0,"articleSection":["Monitoring"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/","url":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/","name":"How to install and Configure Nagios on CentOS 7 - Globo.Tech","isPartOf":{"@id":"https:\/\/www.globo.tech\/learning-center\/#website"},"datePublished":"2016-09-22T21:27:40+00:00","dateModified":"2017-04-19T19:57:04+00:00","author":{"@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87"},"description":"This tutorial will show you how you can install and configure Nagios on a CentOS 7 Server. Read now & Start monitoring today!","breadcrumb":{"@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.globo.tech\/learning-center\/install-configure-nagios-centos-7\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.globo.tech\/learning-center\/"},{"@type":"ListItem","position":2,"name":"How to install and Configure Nagios on CentOS 7"}]},{"@type":"WebSite","@id":"https:\/\/www.globo.tech\/learning-center\/#website","url":"https:\/\/www.globo.tech\/learning-center\/","name":"Globo.Tech","description":"Welcome to the Official Globo.Tech Learning Center","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.globo.tech\/learning-center\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.globo.tech\/learning-center\/#\/schema\/person\/e17784b37f4a4f49b7bc611847912e87","name":"GloboTech Communications","sameAs":["http:\/\/www.gtcomm.net"]}]}},"_links":{"self":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/comments?post=2762"}],"version-history":[{"count":3,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2762\/revisions"}],"predecessor-version":[{"id":3029,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/posts\/2762\/revisions\/3029"}],"wp:attachment":[{"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/media?parent=2762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/categories?post=2762"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.globo.tech\/learning-center\/wp-json\/wp\/v2\/tags?post=2762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}