{"id":22477,"date":"2024-05-08T23:19:09","date_gmt":"2024-05-08T20:19:09","guid":{"rendered":"https:\/\/kifarunix.com\/?p=22477"},"modified":"2024-05-08T23:19:13","modified_gmt":"2024-05-08T20:19:13","slug":"how-to-install-nagios-server-on-ubuntu-24-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/how-to-install-nagios-server-on-ubuntu-24-04\/","title":{"rendered":"How to Install Nagios Server on Ubuntu 24.04"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"993\" height=\"556\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios.png\" alt=\"Install and Setup Nagios\" class=\"wp-image-12562\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios.png 993w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios-768x430.png 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios-150x84.png 150w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios-300x168.png 300w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios-696x390.png 696w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/05\/install-nagios-750x420.png 750w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/figure>\n\n\n\n<p>In this guide, we will provide a step-by-step tutorial on how to install Nagios Server on Ubuntu 24.04. <a href=\"https:\/\/www.nagios.org\/about\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nagios<\/a>, now known as, Nagios Core, is an enterprise-class Open Source IT monitoring, network monitoring, server and applications monitoring solution.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#install-nagios-server-on-ubuntu-24-04\">Install Nagios Server on Ubuntu 24.04<\/a><ul><li><a href=\"#install-nagios-server-from-default-ubuntu-repos\">Install Nagios Server from Default Ubuntu Repos<\/a><\/li><li><a href=\"#install-nagios-server-from-source-code-on-ubuntu-24-04\">Install Nagios Server from Source Code on Ubuntu 24.04<\/a><ul><li><a href=\"#run-system-update\">Run System Update<\/a><\/li><li><a href=\"#install-required-nagios-build-tools-and-development-libraries\">Install Required Nagios build tools and Development Libraries<\/a><\/li><li><a href=\"#download-nagios-source-code\">Download Nagios Source Code<\/a><\/li><li><a href=\"#extract-nagios-source-code\">Extract Nagios Source Code<\/a><\/li><li><a href=\"#compile-and-install-nagios-server-on-ubuntu-24-04\">Compile and Install Nagios Server on Ubuntu 24.04<\/a><\/li><\/ul><\/li><li><a href=\"#running-nagios-service\">Running Nagios Service<\/a><\/li><li><a href=\"#accessing-nagios-web-interface\">Accessing Nagios Web Interface<\/a><\/li><li><a href=\"#install-nagios-server-plugins-on-ubuntu-24-04\">Install Nagios Server Plugins on Ubuntu 24.04<\/a><\/li><li><a href=\"#add-hosts-to-nagios-server-for-monitoring\">Add Hosts to Nagios Server for Monitoring<\/a><\/li><li><a href=\"#install-nrpe-agents-on-linux-hosts\">Install NRPE Agents on Linux Hosts<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-nagios-server-on-ubuntu-24-04\">Install Nagios Server on Ubuntu 24.04<\/h2>\n\n\n\n<p>There are two ways in which you can install Nagios Server on Ubuntu 24.04.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#install-nagios-from-apt\">Install Nagios Server from default Ubuntu 24.04 repositories<\/a><\/li>\n\n\n\n<li><a href=\"#build-nagios-from-source\">Build Nagios from Source Code on Ubuntu 24.04 (for latest and stable release versions)<\/a><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nagios-server-from-default-ubuntu-repos\">Install Nagios Server from Default Ubuntu Repos<\/h3>\n\n\n\n<p>While it is easier to install Nagios Server from Ubuntu repos, sometimes the repos do not provide the latest stable release versions of Nagios. Take for example, Nagios 4.x is the current versions of Nagios with Nagios 4.5.2 release being the latest stable version as per the <a href=\"https:\/\/www.nagios.org\/projects\/nagios-core\/history\/4x\/\" target=\"_blank\" rel=\"noreferrer noopener\">releases page<\/a>.<\/p>\n\n\n\n<p>If you check the available versions on Ubuntu 24.04 repos, Nagios 4.4.6 is the latest stable release.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-cache policy nagios4<\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>nagios4:\n  Installed: (none)\n  Candidate: 4.4.6-4\n  Version table:\n     4.4.6-4 500\n        500 http:\/\/de.archive.ubuntu.com\/ubuntu noble\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\n<p>You can check similar installation here;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-nagios-on-debian-11\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Nagios Server on Debian 11<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nagios-server-from-source-code-on-ubuntu-24-04\">Install Nagios Server from Source Code on Ubuntu 24.04<\/h3>\n\n\n\n<p>This is the only way to ensure that you install the current and latest stable release version of Nagios.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"run-system-update\">Run System Update<\/h4>\n\n\n\n<p>Ensure that your system packages are up-to-date.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt update<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"install-required-nagios-build-tools-and-development-libraries\">Install Required Nagios build tools and Development Libraries<\/h4>\n\n\n\n<p>Run the command below to install the required built tools and development libraries.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>sudo apt install autoconf \\\n    gcc \\\n    libc6 \\\n    make \\\n    wget \\\n    unzip \\\n    apache2 \\\n    apache2-utils \\\n    php \\\n    libapache2-mod-php \\\n    libgd-dev \\\n    libssl-dev -y\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"download-nagios-source-code\">Download Nagios Source Code<\/h4>\n\n\n\n<p>Navigate to <a href=\"https:\/\/www.nagios.org\/downloads\/nagios-core\/thanks\/?skip=1&amp;product_download=nagioscore-source\" target=\"_blank\" rel=\"noreferrer noopener\">Nagios download&#8217;s page<\/a> and grab the latest and stable release Nagios source tarball. Simply grab the link and optionally pull it using wget command;<\/p>\n\n\n\n<p>Replace the value of the VER variable below with the current release version of Nagios.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>VER=4.5.2<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">wget https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-${VER}.tar.gz<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"extract-nagios-source-code\">Extract Nagios Source Code<\/h4>\n\n\n\n<p>Once the download completes, extract the source archive;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tar xzf nagios-${VER}.tar.gz<\/pre>\n\n\n\n<p>You should now have Nagios source directory in the current working directory;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ls<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>nagios-4.5.2<\/strong> nagios-4.5.2.tar.gz<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"compile-and-install-nagios-server-on-ubuntu-24-04\">Compile and Install Nagios Server on Ubuntu 24.04<\/h4>\n\n\n\n<p>Navigate to Nagios source directory and run the configure script to adapt Nagios to your system while checking for any missing required dependency before the installation;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd nagios-${VER}<\/pre>\n\n\n\n<p>Configure Nagios to use Apache as the web server. Use the <code>--with-httpd-conf<\/code> to specify where to install Nagios Server Apache site configs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">.\/configure --with-httpd-conf=\/etc\/apache2\/sites-enabled<\/pre>\n\n\n\n<p>Be sure to use <code>.\/configure --help<\/code> for more options.<\/p>\n\n\n\n<p>Pay attention to the output of this command just in case there is any error that needs to be fixed before you can proceed.<\/p>\n\n\n\n<p>If all is well, you should an output similar to;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>...\nCreating sample config files in sample-config\/ ...\n\n\n*** Configuration summary for nagios 4.5.2 2024-04-30 ***:\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):  \n\n\nReview the options above for accuracy.  If they look okay,\ntype 'make all' to compile the main program and CGIs.\n<\/code><\/pre>\n\n\n\n<p>Next, compile the main Nagios program and CGIs.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">make all<\/pre>\n\n\n\n<p>Create Nagios user and group. Add the user to the Apache web server group.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install-groups-users<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo usermod -aG nagios www-data<\/code><\/pre>\n\n\n\n<p>Install Nagios Server main program, CGIs, and HTML files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install<\/code><\/pre>\n\n\n\n<p>Install Nagios Server startup scripts;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install-init<\/code><\/pre>\n\n\n\n<p>Installs and configures permissions on the directory for holding the external command file;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install-commandmode<\/code><\/pre>\n\n\n\n<p>Initialize the init scripts;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install-daemoninit<\/code><\/pre>\n\n\n\n<p>Install Nagios Server sample configuration files in&nbsp;<code>\/usr\/local\/nagios\/etc<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo make install-config<\/code><\/pre>\n\n\n\n<p>Sample output;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\/usr\/bin\/install -c -m 775 -o nagios -g nagios -d \/usr\/local\/nagios\/etc\n\/usr\/bin\/install -c -m 775 -o nagios -g nagios -d \/usr\/local\/nagios\/etc\/objects\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/nagios.cfg \/usr\/local\/nagios\/etc\/nagios.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/cgi.cfg \/usr\/local\/nagios\/etc\/cgi.cfg\n\/usr\/bin\/install -c -b -m 660 -o nagios -g nagios sample-config\/resource.cfg \/usr\/local\/nagios\/etc\/resource.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/templates.cfg \/usr\/local\/nagios\/etc\/objects\/templates.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/commands.cfg \/usr\/local\/nagios\/etc\/objects\/commands.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/contacts.cfg \/usr\/local\/nagios\/etc\/objects\/contacts.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/timeperiods.cfg \/usr\/local\/nagios\/etc\/objects\/timeperiods.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/localhost.cfg \/usr\/local\/nagios\/etc\/objects\/localhost.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/windows.cfg \/usr\/local\/nagios\/etc\/objects\/windows.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/printer.cfg \/usr\/local\/nagios\/etc\/objects\/printer.cfg\n\/usr\/bin\/install -c -b -m 664 -o nagios -g nagios sample-config\/template-object\/switch.cfg \/usr\/local\/nagios\/etc\/objects\/switch.cfg\n\n*** Config files installed ***\n\nRemember, these are *SAMPLE* config files.  You'll need to read\nthe documentation for more information on how to actually define\nservices, hosts, etc. to fit your particular needs.\n\n<\/code><\/pre>\n\n\n\n<p>Install Apache configuration file for the Nagios web interface<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo make install-webconf<\/pre>\n\n\n\n<p>Enable Apache rewrite and CGI modules;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo a2enmod rewrite cgi<\/pre>\n\n\n\n<p>Similarly, disable the default Apache site;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo a2dissite 000-default.conf<\/code><\/pre>\n\n\n\n<p>Configure Nagios Web Interface basic authentication.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo htpasswd -c \/usr\/local\/nagios\/etc\/htpasswd.users nagiosadmin<\/code><\/pre>\n\n\n\n<p>Where <strong><code>nagiosadmin<\/code><\/strong> is the default admin user for accessing Nagios web interface (as specified in the cgi.cfg). You can create or use any other user name and be sure to specify it in the <code>\/usr\/local\/nagios\/etc\/cgi.cfg<\/code> configuration file.<\/p>\n\n\n\n<p>If you need to add more users, <strong>omit <\/strong>option<strong> -c <\/strong>in the command above.<\/p>\n\n\n\n<p>We are almost done setting up Nagios on Ubuntu 24.04.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"running-nagios-service\">Running Nagios Service<\/h3>\n\n\n\n<p>The <code><strong>make install-init<\/strong><\/code> command, install systemd service units for Nagios Core. You can start and enable Nagios to run on system boot by running the command;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl enable --now nagios<\/pre>\n\n\n\n<p>If it was already running, then restart it;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart nagios<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl status nagios<\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\u25cf nagios.service - Nagios Core 4.5.2\n     Loaded: loaded (\/usr\/lib\/systemd\/system\/nagios.service; enabled; preset: enabled)\n     Active: active (running) since Wed 2024-05-08 19:49:13 UTC; 21s ago\n       Docs: https:\/\/www.nagios.org\/documentation\n    Process: 21969 ExecStartPre=\/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg (code=exited, status=0\/SUCCESS)\n    Process: 21970 ExecStart=\/usr\/local\/nagios\/bin\/nagios -d \/usr\/local\/nagios\/etc\/nagios.cfg (code=exited, status=0\/SUCCESS)\n   Main PID: 21972 (nagios)\n      Tasks: 6 (limit: 4614)\n     Memory: 5.7M (peak: 6.2M)\n        CPU: 196ms\n     CGroup: \/system.slice\/nagios.service\n             \u251c\u250021972 \/usr\/local\/nagios\/bin\/nagios -d \/usr\/local\/nagios\/etc\/nagios.cfg\n             \u251c\u250021973 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n             \u251c\u250021974 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n             \u251c\u250021976 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n             \u251c\u250021977 \/usr\/local\/nagios\/bin\/nagios --worker \/usr\/local\/nagios\/var\/rw\/nagios.qh\n             \u2514\u250021978 \/usr\/local\/nagios\/bin\/nagios -d \/usr\/local\/nagios\/etc\/nagios.cfg\n\nMay 08 19:49:13 monitor01 nagios[21972]: qh: core query handler registered\nMay 08 19:49:13 monitor01 nagios[21972]: qh: echo service query handler registered\nMay 08 19:49:13 monitor01 nagios[21972]: qh: help for the query handler registered\nMay 08 19:49:13 monitor01 nagios[21972]: wproc: Successfully registered manager as @wproc with query handler\nMay 08 19:49:13 monitor01 nagios[21972]: wproc: Registry request: name=Core Worker 21974;pid=21974\nMay 08 19:49:13 monitor01 nagios[21972]: wproc: Registry request: name=Core Worker 21973;pid=21973\nMay 08 19:49:13 monitor01 nagios[21972]: wproc: Registry request: name=Core Worker 21977;pid=21977\nMay 08 19:49:13 monitor01 nagios[21972]: wproc: Registry request: name=Core Worker 21976;pid=21976\nMay 08 19:49:14 monitor01 nagios[21972]: Successfully launched command file worker with pid 21978\nMay 08 19:49:14 monitor01 nagios[21972]: HOST ALERT: localhost;DOWN;SOFT;1;(No output on stdout) stderr: execvp(\/usr\/local\/nagios\/libexec\/check_ping, ...) failed. errno is 2: No such file or directory\n<\/code><\/pre>\n\n\n\n<p>The error you see on status;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>May 08 19:49:14 monitor01 nagios&#91;21972]: HOST ALERT: localhost;DOWN;SOFT;1;(No output on stdout) stderr: execvp(\/usr\/local\/nagios\/libexec\/check_ping, ...) failed. errno is 2: No such file or directory<\/code><\/pre>\n\n\n\n<p>Is because we havent installed Nagios monitoring plugins yet. So it is okay to ignore it for now.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"accessing-nagios-web-interface\">Accessing Nagios Web Interface<\/h3>\n\n\n\n<p>Restart and enable Apache to run on system reboot;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl restart apache2<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl enable apache2<\/pre>\n\n\n\n<p>If firewall is running, allow Apache through.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ufw allow Apache<\/pre>\n\n\n\n<p>Or Iptables;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT<\/code><\/pre>\n\n\n\n<p>You can access Nagios from web interface via, <strong><code>http:\/\/Nagios-Server-IP-OR-Hostname\/nagios<\/code><\/strong>.<\/p>\n\n\n\n<p>Enter your basic authentication credentials;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1418\" height=\"452\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/nagios-basic-auth.png\" alt=\"Install Nagios Server on Ubuntu 24.04\" class=\"wp-image-12563\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/nagios-basic-auth.png?v=1651686023 1418w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/05\/nagios-basic-auth-768x245.png?v=1651686023 768w\" sizes=\"(max-width: 1418px) 100vw, 1418px\" \/><\/figure>\n\n\n\n<p>Nagios default web interface<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1620\" height=\"848\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-core-server-ubuntu-24.04.png?v=1715198387\" alt=\"nagios server on ubuntu 24.04\" class=\"wp-image-22479\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-core-server-ubuntu-24.04.png?v=1715198387 1620w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-core-server-ubuntu-24.04-768x402.png?v=1715198387 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-core-server-ubuntu-24.04-1536x804.png?v=1715198387 1536w\" sizes=\"(max-width: 1620px) 100vw, 1620px\" \/><\/figure>\n\n\n\n<p>Nagios Core server is now running on Ubuntu 24.04<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nagios-server-plugins-on-ubuntu-24-04\">Install Nagios Server Plugins on Ubuntu 24.04<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/wp-admin\/post.php?post=22477&amp;action=edit#installnrpeagent\" target=\"_blank\" rel=\"noreferrer noopener\">In order for Nagios to start monitoring hosts, you need to install Nagios Server plugins and NRPE agents.<\/a>\u00a0You can simply install plugins as follows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install monitoring-plugins<\/code><\/pre>\n\n\n\n<p>This will install a number of plugins under the directory, <code>\/usr\/lib\/nagios\/plugins\/<\/code>.<\/p>\n\n\n\n<p>By default, Nagios installed from the source expects the plugins to reside under, <code>\/usr\/local\/nagios\/libexec<\/code> directory.<\/p>\n\n\n\n<p>So for Nagios use the current plugins directory, simply edit the Nagios resource config file and update as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo vim \/usr\/local\/nagios\/etc\/resource.cfg<\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>...\n# Sets $USER1$ to be the path to the plugins\n<strong># $USER1$=\/usr\/local\/nagios\/libexec<\/strong>\n$USER1$=\/usr\/lib\/nagios\/plugins\n...<\/code><\/pre>\n\n\n\n<p>Similarly, you will have to change the path of the monitoring command plugins in the Nagios templates<\/p>\n\n\n\n<p>Ensure you reload Nagios after;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload nagios.service<\/code><\/pre>\n\n\n\n<p>You can as well create a symbolic link instead of making the above changes as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ln -s \/usr\/lib\/nagios\/plugins\/* \/usr\/local\/nagios\/libexec\/<\/pre>\n\n\n\n<p>By this, you should have the plugins under the <code>\/usr\/local\/nagios\/libexec <\/code>directory.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ls -alh \/usr\/local\/nagios\/libexec\/<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>total 8.0K\ndrwxrwxr-x 2 nagios nagios 4.0K May  8 20:05 .\ndrwxr-xr-x 8 root   root   4.0K May  8 19:47 ..\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_apt -> \/usr\/lib\/nagios\/plugins\/check_apt\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_breeze -> \/usr\/lib\/nagios\/plugins\/check_breeze\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_by_ssh -> \/usr\/lib\/nagios\/plugins\/check_by_ssh\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_clamd -> \/usr\/lib\/nagios\/plugins\/check_clamd\nlrwxrwxrwx 1 root   root     37 May  8 20:05 check_cluster -> \/usr\/lib\/nagios\/plugins\/check_cluster\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_curl -> \/usr\/lib\/nagios\/plugins\/check_curl\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_dbi -> \/usr\/lib\/nagios\/plugins\/check_dbi\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_dhcp -> \/usr\/lib\/nagios\/plugins\/check_dhcp\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_dig -> \/usr\/lib\/nagios\/plugins\/check_dig\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_disk -> \/usr\/lib\/nagios\/plugins\/check_disk\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_disk_smb -> \/usr\/lib\/nagios\/plugins\/check_disk_smb\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_dns -> \/usr\/lib\/nagios\/plugins\/check_dns\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_dummy -> \/usr\/lib\/nagios\/plugins\/check_dummy\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_file_age -> \/usr\/lib\/nagios\/plugins\/check_file_age\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_flexlm -> \/usr\/lib\/nagios\/plugins\/check_flexlm\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_fping -> \/usr\/lib\/nagios\/plugins\/check_fping\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_ftp -> \/usr\/lib\/nagios\/plugins\/check_ftp\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_game -> \/usr\/lib\/nagios\/plugins\/check_game\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_host -> \/usr\/lib\/nagios\/plugins\/check_host\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_hpjd -> \/usr\/lib\/nagios\/plugins\/check_hpjd\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_http -> \/usr\/lib\/nagios\/plugins\/check_http\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_icmp -> \/usr\/lib\/nagios\/plugins\/check_icmp\nlrwxrwxrwx 1 root   root     39 May  8 20:05 check_ide_smart -> \/usr\/lib\/nagios\/plugins\/check_ide_smart\nlrwxrwxrwx 1 root   root     42 May  8 20:05 check_ifoperstatus -> \/usr\/lib\/nagios\/plugins\/check_ifoperstatus\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_ifstatus -> \/usr\/lib\/nagios\/plugins\/check_ifstatus\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_imap -> \/usr\/lib\/nagios\/plugins\/check_imap\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_ircd -> \/usr\/lib\/nagios\/plugins\/check_ircd\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_jabber -> \/usr\/lib\/nagios\/plugins\/check_jabber\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_ldap -> \/usr\/lib\/nagios\/plugins\/check_ldap\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_ldaps -> \/usr\/lib\/nagios\/plugins\/check_ldaps\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_load -> \/usr\/lib\/nagios\/plugins\/check_load\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_log -> \/usr\/lib\/nagios\/plugins\/check_log\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_mailq -> \/usr\/lib\/nagios\/plugins\/check_mailq\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_mrtg -> \/usr\/lib\/nagios\/plugins\/check_mrtg\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_mrtgtraf -> \/usr\/lib\/nagios\/plugins\/check_mrtgtraf\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_mssql -> \/usr\/lib\/nagios\/plugins\/check_mssql\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_mysql -> \/usr\/lib\/nagios\/plugins\/check_mysql\nlrwxrwxrwx 1 root   root     41 May  8 20:05 check_mysql_query -> \/usr\/lib\/nagios\/plugins\/check_mysql_query\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_nagios -> \/usr\/lib\/nagios\/plugins\/check_nagios\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_nntp -> \/usr\/lib\/nagios\/plugins\/check_nntp\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_nntps -> \/usr\/lib\/nagios\/plugins\/check_nntps\nlrwxrwxrwx 1 root   root     32 May  8 20:05 check_nt -> \/usr\/lib\/nagios\/plugins\/check_nt\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_ntp -> \/usr\/lib\/nagios\/plugins\/check_ntp\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_ntp_peer -> \/usr\/lib\/nagios\/plugins\/check_ntp_peer\nlrwxrwxrwx 1 root   root     38 May  8 20:05 check_ntp_time -> \/usr\/lib\/nagios\/plugins\/check_ntp_time\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_nwstat -> \/usr\/lib\/nagios\/plugins\/check_nwstat\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_oracle -> \/usr\/lib\/nagios\/plugins\/check_oracle\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_overcr -> \/usr\/lib\/nagios\/plugins\/check_overcr\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_pgsql -> \/usr\/lib\/nagios\/plugins\/check_pgsql\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_ping -> \/usr\/lib\/nagios\/plugins\/check_ping\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_pollen -> \/usr\/lib\/nagios\/plugins\/check_pollen\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_pop -> \/usr\/lib\/nagios\/plugins\/check_pop\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_procs -> \/usr\/lib\/nagios\/plugins\/check_procs\nlrwxrwxrwx 1 root   root     36 May  8 20:05 check_radius -> \/usr\/lib\/nagios\/plugins\/check_radius\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_real -> \/usr\/lib\/nagios\/plugins\/check_real\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_rpc -> \/usr\/lib\/nagios\/plugins\/check_rpc\nlrwxrwxrwx 1 root   root     39 May  8 20:05 check_rta_multi -> \/usr\/lib\/nagios\/plugins\/check_rta_multi\nlrwxrwxrwx 1 root   root     37 May  8 20:05 check_sensors -> \/usr\/lib\/nagios\/plugins\/check_sensors\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_simap -> \/usr\/lib\/nagios\/plugins\/check_simap\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_smtp -> \/usr\/lib\/nagios\/plugins\/check_smtp\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_snmp -> \/usr\/lib\/nagios\/plugins\/check_snmp\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_spop -> \/usr\/lib\/nagios\/plugins\/check_spop\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_ssh -> \/usr\/lib\/nagios\/plugins\/check_ssh\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_ssmtp -> \/usr\/lib\/nagios\/plugins\/check_ssmtp\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_swap -> \/usr\/lib\/nagios\/plugins\/check_swap\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_tcp -> \/usr\/lib\/nagios\/plugins\/check_tcp\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_time -> \/usr\/lib\/nagios\/plugins\/check_time\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_udp -> \/usr\/lib\/nagios\/plugins\/check_udp\nlrwxrwxrwx 1 root   root     33 May  8 20:05 check_ups -> \/usr\/lib\/nagios\/plugins\/check_ups\nlrwxrwxrwx 1 root   root     35 May  8 20:05 check_users -> \/usr\/lib\/nagios\/plugins\/check_users\nlrwxrwxrwx 1 root   root     34 May  8 20:05 check_wave -> \/usr\/lib\/nagios\/plugins\/check_wave\nlrwxrwxrwx 1 root   root     30 May  8 20:05 negate -> \/usr\/lib\/nagios\/plugins\/negate\nlrwxrwxrwx 1 root   root     30 May  8 20:05 urlize -> \/usr\/lib\/nagios\/plugins\/urlize\nlrwxrwxrwx 1 root   root     32 May  8 20:05 utils.pm -> \/usr\/lib\/nagios\/plugins\/utils.pm\nlrwxrwxrwx 1 root   root     32 May  8 20:05 utils.sh -> \/usr\/lib\/nagios\/plugins\/utils.sh\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload nagios.service<\/code><\/pre>\n\n\n\n<p>You should see localhost monitoring turn green now!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1615\" height=\"704\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-localhost-monitoring.png?v=1715199041\" alt=\"\" class=\"wp-image-22480\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-localhost-monitoring.png?v=1715199041 1615w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-localhost-monitoring-768x335.png?v=1715199041 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2024\/05\/nagios-localhost-monitoring-1536x670.png?v=1715199041 1536w\" sizes=\"(max-width: 1615px) 100vw, 1615px\" \/><\/figure>\n\n\n\n<p>Follow the links below to learn how to add hosts for monitoring as well as installing plugins and NRPE agents on other systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"add-hosts-to-nagios-server-for-monitoring\">Add Hosts to Nagios Server for Monitoring<\/h3>\n\n\n\n<p>Proceed to add hosts to Nagios server for monitoring.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/add-hosts-to-nagios-server-for-monitoring\/\" target=\"_blank\" rel=\"noreferrer noopener\">Add Hosts to Nagios Server For Monitoring<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-nrpe-agents-on-linux-hosts\">Install NRPE Agents on Linux Hosts<\/h3>\n\n\n\n<p>Install NRPE Agents to facilitate monitoring.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/?s=NRPE\" target=\"_blank\" rel=\"noreferrer noopener\">Install Nagios NRPE Agents on Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-install-nsclient-nagios-monitoring-agent-on-windows-system\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Install NSClient Nagios Monitoring Agent on Windows System<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we will provide a step-by-step tutorial on how to install Nagios Server on Ubuntu 24.04. Nagios, now known as, Nagios Core, is<\/p>\n","protected":false},"author":10,"featured_media":12562,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[72,121,73],"tags":[76,149,5033,7396],"class_list":["post-22477","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring","category-howtos","category-nagios","tag-nagios-core","tag-nagios-plugins","tag-nrpe-agents","tag-ubuntu-24-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22477"}],"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\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=22477"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22477\/revisions"}],"predecessor-version":[{"id":22483,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/22477\/revisions\/22483"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12562"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=22477"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=22477"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=22477"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}