diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1fb9ef5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tmp/* diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 4100ce1..5a96714 --- a/install.sh +++ b/install.sh @@ -2,25 +2,29 @@ # Based on: https://reintech.io/blog/installing-configuring-nagios-monitoring-debian +set -e +set -x + +mkdir -o ./tmp NAGIOS_URL="$( head -1 nagios-latest.txt)" NAGIOS_PLUGINS_URL="$( head -1 nagios-plugins-latest.txt )" -apt update && apt upgrade +apt update && apt upgrade -y apt install -y build-essential -apt install -y make curl wget unzip apache2 php libapache2-mod-php libgd-dev +apt install -y make curl wget unzip apache2 php libapache2-mod-php libgd-dev libssl-dev useradd nagios groupadd nagcmd usermod -a -G nagcmd nagios -wget "${NAGIOS_URL}" -O nagios.tar.gz +wget "${NAGIOS_URL}" -O "nagios.tar.gz" -tar xzf nagios-*.tar.gz +tar xvf nagios.tar.gz -C ./tmp/ -cd nagios-* +cd ./tmp/nagios-4* ./configure --with-nagios-group=nagios --with-command-group=nagcmd @@ -32,6 +36,8 @@ make install-commandmode make install-webconf +cd - + ## Simple password htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin admin @@ -39,15 +45,17 @@ a2enmod rewrite cgi systemctl restart apache2 wget "${NAGIOS_PLUGINS_URL}" -O "nagios-plugins.tar.gz" -tar xzf nagios-plugins-*.tar.gz +tar xvf nagios-plugins.tar.gz -C ./tmp/ -cd nagios-plugins-* +cd ./tmp/nagios-plugins-* ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl make make install +cd - + /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg systemctl start nagios @@ -55,3 +63,5 @@ systemctl start nagios systemctl enable nagios +set +e +set +x diff --git a/nagios-plugins.tar.gz b/nagios-plugins.tar.gz new file mode 100644 index 0000000..f5943e6 Binary files /dev/null and b/nagios-plugins.tar.gz differ diff --git a/nagios.tar.gz b/nagios.tar.gz new file mode 100644 index 0000000..8ee6d8b Binary files /dev/null and b/nagios.tar.gz differ