commit 50a4a3ea652059319a928c93c3ba7975c33852ee Author: root Date: Mon Nov 25 01:35:17 2024 +0200 1 diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..4100ce1 --- /dev/null +++ b/install.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# Based on: https://reintech.io/blog/installing-configuring-nagios-monitoring-debian + + +NAGIOS_URL="$( head -1 nagios-latest.txt)" +NAGIOS_PLUGINS_URL="$( head -1 nagios-plugins-latest.txt )" + +apt update && apt upgrade + +apt install -y build-essential +apt install -y make curl wget unzip apache2 php libapache2-mod-php libgd-dev + +useradd nagios +groupadd nagcmd +usermod -a -G nagcmd nagios + + +wget "${NAGIOS_URL}" -O nagios.tar.gz + +tar xzf nagios-*.tar.gz + +cd nagios-* + +./configure --with-nagios-group=nagios --with-command-group=nagcmd + +make all +make install +make install-init +make install-config +make install-commandmode + +make install-webconf + +## Simple password +htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin admin + +a2enmod rewrite cgi +systemctl restart apache2 + +wget "${NAGIOS_PLUGINS_URL}" -O "nagios-plugins.tar.gz" +tar xzf nagios-plugins-*.tar.gz + +cd nagios-plugins-* + +./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl + +make +make install + +/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg + +systemctl start nagios + +systemctl enable nagios + + diff --git a/nagios-latest.txt b/nagios-latest.txt new file mode 100644 index 0000000..1fbdba7 --- /dev/null +++ b/nagios-latest.txt @@ -0,0 +1 @@ +https://github.com/NagiosEnterprises/nagioscore/releases/download/nagios-4.5.8/nagios-4.5.8.tar.gz diff --git a/nagios-plugins-latest.txt b/nagios-plugins-latest.txt new file mode 100644 index 0000000..6b7496e --- /dev/null +++ b/nagios-plugins-latest.txt @@ -0,0 +1 @@ +https://nagios-plugins.org/download/nagios-plugins-2.4.9.tar.gz