{"id":7560,"date":"2018-06-07T16:44:46","date_gmt":"2018-06-07T08:44:46","guid":{"rendered":"http:\/\/rmohan.com\/?p=7560"},"modified":"2018-06-08T17:54:13","modified_gmt":"2018-06-08T09:54:13","slug":"installing-nagios-4-1-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=7560","title":{"rendered":"installing Nagios 4.1 on Centos 7"},"content":{"rendered":"<pre>#### Problem Statement installing Nagios 4.1 on Centos 7 \r\n## Step #1: Install LAMP\r\n\tyum install httpd -y\r\n\tsystemctl start httpd\r\n\tsystemctl enable httpd\r\n\tyum -y install mariadb-server mariadb\r\n\tsystemctl start mariadb\r\n\tsystemctl enable mariadb\r\n\tsystemctl status mariadb\r\n\tmysql\r\n\tmysql_secure_installation\r\n\tyum install php php-mysql php-gd php-pear -y\r\n## Install dependencies for Nagios\r\n\tsudo yum install -y gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip wget\r\n#Create user and group \r\n\tsudo useradd nagios\r\n\tsudo groupadd nagcmd\r\n\tsudo usermod -a -G nagcmd nagios\r\n# download Core nagios source and build it from source\r\n\tcd ~\r\n\tcurl -L -O https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-4.1.1.tar.gz\r\n\ttar xvf nagios-*.tar.gz\r\n\tcd nagios-*\r\n\t.\/configure --with-command-group=nagcmd \r\n\tmake all\r\n\tsudo make install\r\n\tsudo make install-commandmode\r\n\tsudo make install-init\r\n\tsudo make install-config\r\n\tsudo make install-webconf\r\n\tsudo usermod -G nagcmd apache\r\n# Download and install plugins from Source\r\n\tcd ~\r\n\tcurl -L -O http:\/\/nagios-plugins.org\/download\/nagios-plugins-2.1.1.tar.gz\r\n\ttar xvf nagios-plugins-*.tar.gz\r\n\tcd nagios-plugins-*\r\n\t.\/configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl\r\n\tmake\r\n\tsudo make install\r\n# Install NRPE and build from source\r\n\tcd ~\r\n\tcurl -L -O http:\/\/downloads.sourceforge.net\/project\/nagios\/nrpe-2.x\/nrpe-2.15\/nrpe-2.15.tar.gz\r\n\ttar xvf nrpe-*.tar.gz\r\n\tcd nrpe-*\r\n\t.\/configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=\/usr\/bin\/openssl --with-ssl-lib=\/usr\/lib\/x86_64-linux-gnu\r\n\tmake all\r\n\tsudo make install\r\n\tsudo make install-xinetd\r\n\tsudo make install-daemon-config\r\n\tsudo vi \/etc\/xinetd.d\/nrpe\r\n# in file \/etc\/xinetd.d\/nrpe, change line to allow which hosts can connect via NRPE\r\n\t#only_from = 127.0.0.1 192.168.33.0\/24\r\n\t\tsudo service xinetd restart\r\n\tsudo vi \/usr\/local\/nagios\/etc\/nagios.cfg\r\n\t#cfg_dir=\/usr\/local\/nagios\/etc\/servers # Uncomment\r\n\tsudo mkdir -p \/usr\/local\/nagios\/etc\/servers\r\n\tsudo vi \/usr\/local\/nagios\/etc\/objects\/contacts.cfg #change admin email to send notifications\r\n\tsudo vi \/usr\/local\/nagios\/etc\/objects\/commands.cfg\r\n\t#sudo \/etc\/nagios\/commands.cfg\r\n\t# Add following line: Remove the leading # in lines \r\n\t#define command{\r\n        #command_name check_nrpe\r\n        #command_line $USER1$\/check_nrpe -H $HOSTADDRESS$ -c $ARG1$\r\n\t#}\r\n\r\nsudo htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin\r\nsudo systemctl start nagios.service\r\nsudo systemctl restart httpd.service\r\n# Enable nagios to run in multi user mode and on bootup \r\nsudo chkconfig nagios on\r\n# Grant permissions to run the web app for Nagios\r\nsudo vi \/etc\/httpd\/conf.d\/nagios.conf\r\nOrder allow,deny\r\nAllow from all\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#### Problem Statement installing Nagios 4.1 on Centos 7 ## Step #1: Install LAMP yum install httpd -y systemctl start httpd systemctl enable httpd yum -y install mariadb-server mariadb systemctl start mariadb systemctl enable mariadb systemctl status mariadb mysql mysql_secure_installation yum install php php-mysql php-gd php-pear -y ## Install dependencies for Nagios sudo yum install [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73,41],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7560"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7560"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7560\/revisions"}],"predecessor-version":[{"id":7561,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/7560\/revisions\/7561"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}