Permalink
Browse files

New email notifications for NEMS 1.5

  • Loading branch information...
NEMS Linux
NEMS Linux committed Oct 29, 2018
1 parent 0157c70 commit 82b19b170ddd02dc49f4c84fb9a987788c2b3eb7
Showing with 56 additions and 22 deletions.
  1. +3 −0 build/040-phpmailer
  2. +8 −3 build/050-nagios
  3. +0 −19 build/051-nagios-plugins
  4. +27 −0 build/052-nems-nagios-plugins
  5. +18 −0 nems-upgrade/1.4.1-1.5
@@ -0,0 +1,3 @@
#!/bin/bash
cp -Rf /root/nems/nems-migrator/data/1.5/PHPMailer /var/www/
chown -R www-data:www-data /var/www/PHPMailer
@@ -7,9 +7,14 @@
usermod -a -G nagcmd nagios
usermod -a -G nagcmd www-data
cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
tar -zxvf nagios-4.3.4.tar.gz
cd /tmp/nagios-4.3.4/
# NEMS 1.4.1
# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.4.tar.gz
# tar -zxvf nagios-4.3.4.tar.gz
# cd /tmp/nagios-4.3.4/
# NEMS 1.5
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.2.tar.gz
tar -zxvf nagios-4.4.2.tar.gz
cd /tmp/nagios-4.4.2/
./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/conf-available/
make all
make install
@@ -70,22 +70,3 @@
cp -f plugins/check_snmp /usr/local/nagios/libexec/
fi
# Setup an interpreter for notify-by-pushover (and possibly others... prevents problems)
if [[ ! -f /usr/local/bin/php ]]; then
if [[ -f /usr/bin/php ]]; then
ln -s /usr/bin/php /usr/local/bin/php
fi
fi
# Install notify-by-pushover
cp -f /root/nems/nems-migrator/data/1.4/submodules/barryo/nagios-plugins/notify-by-pushover.php /usr/local/nagios/libexec/
/bin/sed -i -- 's,Nagios Alert,NEMS Alert,g' /usr/local/nagios/libexec/notify-by-pushover.php
# Install notify-by-telegram
cp /root/nems/nems-migrator/data/1.4/nagios/plugins/telegram_nems.lua /usr/local/bin/
chmod +x /usr/local/bin/telegram_nems.lua
# Install various plugins
cp /root/nems/nems-migrator/data/1.4/nagios/plugins/check_mikrotik_switch /usr/local/nagios/libexec/
cp /root/nems/nems-migrator/data/1.4/nagios/plugins/check_minecraft /usr/local/nagios/libexec/
cp /root/nems/nems-migrator/data/1.4/nagios/plugins/check_rpi_temperature /usr/local/nagios/libexec/
@@ -0,0 +1,27 @@
#!/bin/bash
# Setup an interpreter for notify-by-pushover (and possibly others... prevents problems)
if [[ ! -f /usr/local/bin/php ]]; then
if [[ -f /usr/bin/php ]]; then
ln -s /usr/bin/php /usr/local/bin/php
fi
fi
# Install NEMS Email Notifications Plugins
cp -f /root/nems/nems-migrator/data/1.5/nagios/plugins/nems_sendmail_host /usr/local/nagios/libexec/
cp -f /root/nems/nems-migrator/data/1.5/nagios/plugins/nems_sendmail_service /usr/local/nagios/libexec/
# Install notify-by-pushover
cp -f /root/nems/nems-migrator/data/1.4/submodules/barryo/nagios-plugins/notify-by-pushover.php /usr/local/nagios/libexec/
/bin/sed -i -- 's,Nagios Alert,NEMS Alert,g' /usr/local/nagios/libexec/notify-by-pushover.php
# Install notify-by-telegram
cp -f /root/nems/nems-migrator/data/1.4/nagios/plugins/telegram_nems.lua /usr/local/bin/
chmod +x /usr/local/bin/telegram_nems.lua
# Install various plugins
cp -f /root/nems/nems-migrator/data/1.4/nagios/plugins/check_mikrotik_switch /usr/local/nagios/libexec/
cp -f /root/nems/nems-migrator/data/1.4/nagios/plugins/check_minecraft /usr/local/nagios/libexec/
cp -f /root/nems/nems-migrator/data/1.4/nagios/plugins/check_rpi_temperature /usr/local/nagios/libexec/
@@ -1,14 +1,32 @@
#!/bin/bash
# This script helps migrate pre-built 1.4.1 images to NEMS 1.5
# Not a user upgrade script. This is intended to save me time when building the new version
# Ie., no need to re-build the entire port.
platform=$(/usr/local/share/nems/nems-scripts/info.sh platform)
ver=$(/usr/local/share/nems/nems-scripts/info.sh nemsver)
if [[ "$ver" == "1.4.1" ]]; then
# All Platforms
## Update the core OS
apt update && apt -y upgrade
apt -y dist-upgrade
## Upgrade PHP from 7.0 to 7.2
echo "Removing PHP 7.0..." && apt -y purge php7.0* && echo "Done removing PHP 7.0." && /root/nems/nems-admin/build/036-php72
## Upgrade Nagios to from 4.3.4 to 4.4.2
if [[ -d /tmp/libexec ]]; then rm -rf /tmp/libexec; fi
mv /usr/local/nagios/libexec /tmp/ && rm -rf /usr/local/nagios/ && /nems/nems-admin/build/050-nagios && systemctl stop nagios && rm -rf /usr/local/nagios/libexec && mv /tmp/libexec /usr/local/nagios/ && systemctl start nagios
## Install PHPMailer
/root/nems/nems-admin/build/040-phpmailer
## Install NEMS Nagios Plugins
/root/nems/nems-admin/build/052-nems-nagios-plugins
else
echo "Cannot uprade NEMS $ver to 1.5."
fi

0 comments on commit 82b19b1

Please sign in to comment.