{"id":3764,"date":"2019-07-25T20:55:31","date_gmt":"2019-07-25T17:55:31","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3764"},"modified":"2019-08-05T12:08:46","modified_gmt":"2019-08-05T09:08:46","slug":"install-nagios-core-on-debian-10-buster","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-nagios-core-on-debian-10-buster\/","title":{"rendered":"Install Nagios Core on Debian 10 Buster"},"content":{"rendered":"\n<p>In this guide, we are going to learn how to install Nagios Core on Debian 10 Buster from the source. <a rel=\"noreferrer noopener\" aria-label=\"Nagios (opens in a new tab)\" href=\"https:\/\/www.nagios.org\/\" target=\"_blank\">Nagios<\/a> is an opensource tool that provides an enterprise-class central monitoring engine for IT monitoring, network monitoring, server and applications monitoring. It also provides a web interface for viewing current status, historical logs, and basic reports.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Nagios Core on Debian 10 Buster<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<p>Since we are In this guide, we are going to build Nagios from the source. As such, there are some dependencies and build tools that are required. These include some components of LAMP\/LEMP Stack, Apache\/Nginx and PHP. Run the command below to install them.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install build-essential unzip openssl libssl-dev apache2 php libapache2-mod-php php-gd libgd-dev<\/code><\/pre>\n\n\n\n<p>If you need to see how to install LEMP\/LAMP stack on Debian 10 Buster, follow the links below;<\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/install-lemp-stack-on-debian-10-buster\/\" target=\"_blank\">Install LEMP Stack on Debian 10 Buster<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-lamp-stack-with-mariadb-10-on-debian-10-buster\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install LAMP Stack with MariaDB 10 on Debian 10 Buster<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Download Nagios 4 Source code<\/h3>\n\n\n\n<p>Once the installation above completes, navigate to <a rel=\"noreferrer noopener\" aria-label=\"Nagios downloads page (opens in a new tab)\" href=\"https:\/\/www.nagios.org\/downloads\/nagios-core\/thanks\/?skip=1&amp;product_download=nagioscore-source\" target=\"_blank\">Nagios downloads page<\/a> and download the latest stable release. Get the download link as download it as follows.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-4.4.3.tar.gz -P \/tmp<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Extract the Source code<\/h4>\n\n\n\n<p>Once the download is completes, navigate to download dir, <strong>\/tmp<\/strong> in this guide and extract Nagios Core as follows.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd \/tmp\ntar xzf nagios-4.4.3.tar.gz<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Compile Nagios Core<\/h3>\n\n\n\n<p>Navigate to the Nagios source code directory and run configure script to adapt Nagios to your system. You can also configure Nagios to use Apache web server by specifying Apache configuration directory.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd nagios-4.4.3\/\n.\/configure --with-httpd-conf=\/etc\/apache2\/sites-enabled<\/code><\/pre>\n\n\n\n<p>Once the configure script completes, it should give you a summary as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n*** Configuration summary for nagios 4.4.3 2019-01-15 ***:\n\n General Options:\n -------------------------\n        Nagios executable:  nagios\n        Nagios user\/group:  nagios,nagios\n       Command user\/group:  nagios,nagios\n             Event Broker:  yes\n        Install ${prefix}:  \/usr\/local\/nagios\n    Install ${includedir}:  \/usr\/local\/nagios\/include\/nagios\n                Lock file:  \/run\/nagios.lock\n   Check result directory:  \/usr\/local\/nagios\/var\/spool\/checkresults\n           Init directory:  \/lib\/systemd\/system\n  Apache conf.d directory:  \/etc\/apache2\/sites-enabled\n             Mail program:  \/bin\/mail\n                  Host OS:  linux-gnu\n          IOBroker Method:  epoll\n\n Web Interface Options:\n ------------------------\n                 HTML URL:  http:\/\/localhost\/nagios\/\n                  CGI URL:  http:\/\/localhost\/nagios\/cgi-bin\/\n Traceroute (used by WAP):  \/usr\/sbin\/traceroute\n\n\nReview the options above for accuracy.  If they look okay,\ntype 'make all' to compile the main program and CGIs.<\/code><\/pre>\n\n\n\n<p>To compile Nagios Core main program and CGIs, execute the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make all<\/code><\/pre>\n\n\n\n<p>If the compilation is successful, proceed to setup Nagios as follows;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create Nagios User and Group<\/h3>\n\n\n\n<p>TO create dedicated Nagios user and group, run the make command with <strong>install-groups-users<\/strong> option as shown below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install-groups-users<\/code><\/pre>\n\n\n\n<p>The command above above simply executes, <strong>groupadd -r nagios<\/strong> and <strong>useradd -g nagios nagios<\/strong> commands.<\/p>\n\n\n\n<p>Next, add the web server user, <strong>www-data<\/strong> to Nagios group just created.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>usermod -aG nagios www-data<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nagios<\/h3>\n\n\n\n<p>Run the <strong>make install<\/strong> command to install Nagios main program, CGIs and HTML files.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nagios Service<\/h3>\n\n\n\n<p>To install Nagios service configuration files and enable them to run on system boot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install-daemoninit<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Command Mode<\/h3>\n\n\n\n<p>Run the command below install and configure permissions on the directory for holding external command file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install-commandmode<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nagios Configuration Files<\/h3>\n\n\n\n<p>To setup Nagios configuration files, run the <strong>make<\/strong> command with <strong>install-config<\/strong> option.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install-config<\/code><\/pre>\n\n\n\n<p>This installs sample config files in \/usr\/local\/nagios\/etc<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nagios Apache Config files<\/h3>\n\n\n\n<p>To install Apache configuration files for Nagios web interface, execute;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make install-webconf<\/code><\/pre>\n\n\n\n<p>Enable Apache rewrite and CGI modules.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>a2enmod rewrite cgi<\/code><\/pre>\n\n\n\n<p>Nagios with Apache web server is now configured.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setup Nagios Apache Authentication<\/h3>\n\n\n\n<p>To setup Nagios Web authentication, you need to create an Apache user for authentication. This can be done using the <strong>htpasswd<\/strong> command. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin<\/code><\/pre>\n\n\n\n<p>The user, <strong>nagiosadmin<\/strong>, is used by default. If you need to use a different user, you need to replace all the occurences of <strong>nagiosadmin<\/strong> on the <strong>\/usr\/local\/nagios\/etc\/cgi.cfg<\/strong> file with the user you created. For example, if you use like <strong>admin<\/strong>, replace <strong>nagiosadmin<\/strong> as shown below.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sed -i 's\/nagiosadmin\/admin\/g' \/usr\/local\/nagios\/etc\/cgi.cfg<\/code><\/pre>\n\n\n\n<p>If you also want to use a different authentication user file instead of, <strong>\/usr\/local\/nagios\/etc\/htpasswd.users<\/strong>, ensure you edit the Nagios Apache configuration file, <strong>\/etc\/apache2\/sites-enabled\/nagios.conf <\/strong>and change the value of <strong>AuthUserFile<\/strong>.<\/p>\n\n\n\n<p>Set the ownership of the Nagios Apache authentication configuration file to web-server user, <strong>www-data<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chown www-data.www-data \/usr\/local\/nagios\/etc\/htpasswd.users<\/code><\/pre>\n\n\n\n<p>Adjust the file permissions appropriately such that the owner (www-data) have read write access, the group has read access.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chmod 640 \/usr\/local\/nagios\/etc\/htpasswd.users<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Start Apache Web server<\/h3>\n\n\n\n<p>Once you are done with configuration, restart Apache.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart apache2<\/code><\/pre>\n\n\n\n<p>If any firewall is running on your system, be sure to enable Apache through it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ufw allow 80<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Start Nagios Core service<\/h3>\n\n\n\n<p>Start Nagios Core service by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl start nagios.service<\/code><\/pre>\n\n\n\n<p>To check the status<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status nagios.service<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\u25cf nagios.service - Nagios Core 4.4.3\n   Loaded: loaded (\/lib\/systemd\/system\/nagios.service; enabled; vendor preset: enabled)\n   Active: active (running) since Thu 2019-07-25 03:56:52 EDT; 2s ago\n     Docs: https:\/\/www.nagios.org\/documentation\n  Process: 5238 ExecStartPre=\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg (code=exited, status=0\/SUCCESS)\n  Process: 5239 ExecStart=\/usr\/local\/nagios\/bin\/nagios -d \/usr\/local\/nagios\/etc\/nagios.cfg (code=exited, status=0\/SUCCESS)\n Main PID: 5240 (nagios)\n    Tasks: 5 (limit: 4701)\n   Memory: 1.9M\n   CGroup: \/system.slice\/nagios.service\n           \u251c\u25005240 \/usr\/local\/nagios\/bin\/nagios -d \/usr\/local\/nagios\/etc\/nagios.cfg\n           \u251c\u25005241 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n           \u251c\u25005242 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n           \u251c\u25005243 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n           \u2514\u25005244 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh<\/code><\/pre>\n\n\n\n<p>If you need to go through the Nagios logs, the log file is;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>\/usr\/local\/nagios\/var\/nagios.log<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Accessing Nagios on Debian 10 Buster<\/h2>\n\n\n\n<p>Once you are done with the configuration, navigate to the browser and access your Nagios with the address <strong>http:\/\/&lt;server-IP&gt;\/nagios<\/strong>. You will be prompted to enter username and password created above to login.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core-debian-10-buster.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1348\" height=\"648\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core-debian-10-buster.png\" alt=\"Install Nagios Core on Debian 10 Buster\" class=\"wp-image-3776\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core-debian-10-buster.png 1348w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core-debian-10-buster-768x369.png 768w\" sizes=\"(max-width: 1348px) 100vw, 1348px\" \/><\/a><\/figure>\n\n\n\n<p>By default, Nagios doesn&#8217;t monitor the status of hosts and services without Nagios plugins, which are not installed by default. If you check the current status of the hosts, localhost server shows state as DOWN.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core_debian-10-buster.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1357\" height=\"412\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core_debian-10-buster.png\" alt=\"Nagios host summary Debian 10 Buster\" class=\"wp-image-3781\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core_debian-10-buster.png 1357w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-core_debian-10-buster-768x233.png 768w\" sizes=\"(max-width: 1357px) 100vw, 1357px\" \/><\/a><\/figure>\n\n\n\n<p>If you need to monitor your endpoints or even including your nagios server itself you need to install Nagios plugins.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Nagios Plugins<\/h3>\n\n\n\n<p>To monitor your local system (Nagios server), just install the plugins as shown below;<\/p>\n\n\n\n<p>Download the Nagios Plugins<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/nagios-plugins.org\/download\/nagios-plugins-2.2.1.tar.gz -P \/tmp\/<\/code><\/pre>\n\n\n\n<p>Extract and install the plugins.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd \/tmp\ntar xzf nagios-plugins-2.2.1.tar.gz<\/code><\/pre>\n\n\n\n<p>Compile and install the plugins. Add <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>cd nagios-plugins-2.2.1\/\n.\/configure --with-nagios-user=nagios --with-nagios-group=nagios<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>make &amp;&amp; make install<\/code><\/pre>\n\n\n\n<p>If the installation is successful, the plugins are installed under <strong>\/usr\/local\/nagios\/libexec<\/strong>.<\/p>\n\n\n\n<p>Restart Nagios.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl restart nagios<\/code><\/pre>\n\n\n\n<p>If you login to your Nagios web UI, you should now be able to check the status of the host and services being monitored.<\/p>\n\n\n\n<p>Host Status<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-host-up-debian-10-buster.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1180\" height=\"408\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-host-up-debian-10-buster.png\" alt=\"Nagios host status Debian 10 Buster\" class=\"wp-image-3782\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-host-up-debian-10-buster.png 1180w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-host-up-debian-10-buster-768x266.png 768w\" sizes=\"(max-width: 1180px) 100vw, 1180px\" \/><\/a><\/figure>\n\n\n\n<p>Host Services<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-services-debian-10-buster.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1344\" height=\"401\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-services-debian-10-buster.png\" alt=\"Nagios host services Debian 10 Buster\" class=\"wp-image-3783\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-services-debian-10-buster.png 1344w, https:\/\/kifarunix.com\/wp-content\/uploads\/2019\/07\/nagios-services-debian-10-buster-768x229.png 768w\" sizes=\"(max-width: 1344px) 100vw, 1344px\" \/><\/a><\/figure>\n\n\n\n<p>There you go. You have successfully install and configured Nagios on Debian 10 Buster. If you need to monitor you Linux\/Windows Hosts or any other device, see out links below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/monitor-linux-hosts-using-nagios-check_by_ssh-plugin\/\">Monitor Linux Hosts using Nagios check_by_ssh Plugin<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-nagios-plugins-and-nrpe-agents-on-centos-7-rhel-7-fedora-29\/\" target=\"_blank\">How to Install Nagios Plugins and NRPE agents on CentOS 7\/RHEL 7\/Fedora 29<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-nagios-plugins-from-source-rhel-centos-oracle-linux\/\" target=\"_blank\">How to Install Nagios Plugins From Source RHEL\/CentOS\/Oracle Linux<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-nsclient-nagios-monitoring-agent-on-windows-system\/\" target=\"_blank\">How to Install and Configure NSClient++ Nagios Agent on Windows System<\/a><\/p>\n\n\n\n<p><a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/kifarunix.com\/how-to-install-and-configure-nagios-core-from-the-source-ubuntu-18-04\/\" target=\"_blank\">How to Install and Configure Nagios Core From the Source Ubuntu 18.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-configure-snmp-ubuntu-18-04-and-centos-7\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install and Configure SNMP on Ubuntu 18.04 and CentOS 7<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we are going to learn how to install Nagios Core on Debian 10 Buster from the source. Nagios is an opensource tool<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,72,73],"tags":[997,1039,75,76,145,149],"class_list":["post-3764","post","type-post","status-publish","format-standard","hentry","category-howtos","category-monitoring","category-nagios","tag-debian-10","tag-debian-10-buster","tag-nagios","tag-nagios-core","tag-nagios-monitoring","tag-nagios-plugins","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3764"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=3764"}],"version-history":[{"count":17,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3764\/revisions"}],"predecessor-version":[{"id":3860,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/3764\/revisions\/3860"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=3764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=3764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=3764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}