Skip to content

Commit

Permalink
Updates for 1.6, Add NagiosTV
Browse files Browse the repository at this point in the history
  • Loading branch information
NEMS Linux committed Dec 12, 2019
1 parent d00ea94 commit aca21d5
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 15 deletions.
10 changes: 7 additions & 3 deletions build/045-nagios
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ fi
# 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.3.tar.gz
tar -zxvf nagios-4.4.3.tar.gz
cd /tmp/nagios-4.4.3/
# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.3.tar.gz
# tar -zxvf nagios-4.4.3.tar.gz
# cd /tmp/nagios-4.4.3/
# NEMS 1.6
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
tar -zxvf nagios-4.4.5.tar.gz
cd /tmp/nagios-4.4.5/
./configure --with-nagios-group=nagios --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/conf-available/
make all
make install
Expand Down
8 changes: 4 additions & 4 deletions build/130-nconf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apt install -y libdbi-perl libdbd-mysql-perl
/bin/systemctl restart apache2
git clone --branch 1.6 https://github.com/Cat5TV/nconf && chown -R www-data:www-data nconf
# Import nConf Configuration
cp -f /root/nems/nems-migrator/data/1.4/nconf/deployment.ini /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.4/nconf/authentication.php /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.4/nconf/mysql.php /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.4/nconf/nconf.php /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.6/nconf/deployment.ini /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.6/nconf/authentication.php /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.6/nconf/mysql.php /var/www/nconf/config/
cp -f /root/nems/nems-migrator/data/1.6/nconf/nconf.php /var/www/nconf/config/
39 changes: 39 additions & 0 deletions build/146-nagiostv
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

if [[ -d /var/www/nagiostv ]]; then
echo 'Reinstalling NagiosTV...'
a2disconf nagiostv
rm /etc/apache2/conf-available/nagiostv.conf
rm -rf /var/www/nagiostv
else
echo 'Installing NagiosTV...'
fi

tmpdir=`mktemp -d -p /tmp/`
cd $tmpdir

# Obtain NagiosTV
wget https://github.com/chriscareycode/nagiostv-react/releases/download/v0.4.6/nagiostv-0.4.6.tar.gz
tar xvfz nagiostv-0.4.6.tar.gz
mv nagiostv /var/www/

# If successful, enable NagiosTV
if [[ -d /var/www/nagiostv ]]; then
# Add the apache2 conf
cp -f /root/nems/nems-migrator/data/1.6/nagiostv.conf /etc/apache2/conf-available/
echo '{"titleString":"NEMS Tactical Overview","baseUrl":"/nagios/cgi-bin/","alertDaysBack":14,"alertMaxItems":1000,"hideServicePending":false,"hideServiceWarning":false,"hideServiceUnknown":false,"hideServiceCritical":false,"hideServiceAcked":false,"hideServiceScheduled":false,"hideServiceFlapping":false,"serviceSortOrder":"newest","hideHostPending":false,"hideHostDown":false,"hideHostUnreachable":false,"hideHostAcked":false,"hideHostScheduled":false,"hideHostFlapping":false,"hideHistory":false,"hideHistoryTitle":false,"hideHistoryChart":false,"hostSortOrder":"newest","versionCheckDays":0,"language":"English","flynnEnabled":false,"flynnConcernedAt":1,"flynnAngryAt":4,"flynnBloodyAt":8,"flynnCssScale":"0.8","showEmoji":false,"speakItems":true,"speakItemsVoice":"","playSoundEffects":true,"soundEffectCritical":"./sample-audio/critical.mp3","soundEffectWarning":"./sample-audio/warning.mp3","soundEffectOk":"./sample-audio/ok.mp3"}' > /var/www/nagiostv/client-settings.json
# Hide cruft
echo '.SettingsBox, .FooterAreaRight, .FooterAreaMiddle, .softIcon { display:none; }' >> /var/www/nagiostv/static/css/main.*.css
# Set permissions
chown -R www-data:www-data /var/www/nagiostv
chown root:root /etc/apache2/conf-available/nagiostv.conf
# Enable nagiostv
a2enconf nagiostv
# Reload apache2
/usr/bin/systemctl reload apache2
echo 'Done installing NagiosTV Dashboard'
else
echo 'Failed installing NagiosTV Dashboard'
fi
rm -rf $tmpdir
1 change: 1 addition & 0 deletions build/client-settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"titleString":"NEMS Tactical Overview","baseUrl":"/nagios/cgi-bin/","alertDaysBack":14,"alertMaxItems":1000,"hideServicePending":false,"hideServiceWarning":false,"hideServiceUnknown":false,"hideServiceCritical":false,"hideServiceAcked":false,"hideServiceScheduled":false,"hideServiceFlapping":false,"serviceSortOrder":"newest","hideHostPending":false,"hideHostDown":false,"hideHostUnreachable":false,"hideHostAcked":false,"hideHostScheduled":false,"hideHostFlapping":false,"hideHistory":false,"hideHistoryTitle":false,"hideHistoryChart":false,"hostSortOrder":"newest","versionCheckDays":1,"language":"English","flynnEnabled":false,"flynnConcernedAt":1,"flynnAngryAt":4,"flynnBloodyAt":8,"flynnCssScale":"0.8","showEmoji":true,"speakItems":true,"speakItemsVoice":"","playSoundEffects":true,"soundEffectCritical":"./sample-audio/critical.mp3","soundEffectWarning":"./sample-audio/warning.mp3","soundEffectOk":"./sample-audio/ok.mp3"}
2 changes: 1 addition & 1 deletion helpers/nems-conf-to-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Automatically replaces the config files in NEMS Migrator any time you update NEMS-Sample mysql db (so they match)

dest=/root/nems/nems-migrator/data/1.5/nagios/conf
dest=/root/nems/nems-migrator/data/1.6/nagios/conf

echo ""
echo "Ready to copy your /etc/nems/conf folder. Please open NConf and Generate Config."
Expand Down
4 changes: 2 additions & 2 deletions helpers/nems-db-to-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Automatically replaces the config files in NEMS Migrator any time you update NEMS-Sample mysql db (so they match)

dest=/root/nems/nems-migrator/data/1.5/nconf/confdump
dest=/root/nems/nems-migrator/data/1.6/nconf/confdump

if [[ ! -d $dest ]]; then
mkdir -p $dest
Expand All @@ -27,7 +27,7 @@ fi
/var/www/nconf/bin/get_items.pl -c checkcommand -f > $dest/global/checkcommands.cfg
/var/www/nconf/bin/get_items.pl -c contact -f > $dest/global/contacts.cfg
# Use the default contact from NEMS 1.4 instead
# cp -f /root/nems/nems-migrator/data/1.4/nagios/conf/global/contacts.cfg /root/nems/nems-migrator/data/1.5/nagios/conf/global/contacts.cfg
# cp -f /root/nems/nems-migrator/data/1.4/nagios/conf/global/contacts.cfg /root/nems/nems-migrator/data/1.6/nagios/conf/global/contacts.cfg
/var/www/nconf/bin/get_items.pl -c contactgroup -f > $dest/global/contactgroups.cfg
/var/www/nconf/bin/get_items.pl -c host-template -f > $dest/global/host_templates.cfg
/var/www/nconf/bin/get_items.pl -c service-template -f > $dest/global/service_templates.cfg
Expand Down
6 changes: 3 additions & 3 deletions notes/docker/docker-container.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Key point is that NEMS' Docker Container requires systemd, but as that would pos
Publish when ready:

- Stop the container: `docker stop nemslinux`
- `docker tag nems_1.5.1 baldnerd/nemslinux:1.5.1_build1`
- `docker login && docker push baldnerd/nemslinux:1.5.1_build1`
- `docker tag nems_1.6 baldnerd/nemslinux:1.6_build1`
- `docker login && docker push baldnerd/nemslinux:1.6_build1`

Deploy (Install):

`docker run --hostname nems --mount type=tmpfs,destination=/tmp,tmpfs-mode=1777 --mount type=tmpfs,destination=/var/www/html/backup/snapshot,tmpfs-mode=1770 --restart=unless-stopped --stop-timeout 120 --name nemslinux -d -p 80:80 -p 443:443 -p 2812:2812 baldnerd/nemslinux:1.5.1_build1`
`docker run --hostname nems --mount type=tmpfs,destination=/tmp,tmpfs-mode=1777 --mount type=tmpfs,destination=/var/www/html/backup/snapshot,tmpfs-mode=1770 --restart=unless-stopped --stop-timeout 120 --name nemslinux -d -p 80:80 -p 443:443 -p 2812:2812 baldnerd/nemslinux:1.6_build1`

Start/Stop NEMS Linux:

Expand Down
2 changes: 1 addition & 1 deletion notes/docker/stages/02/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM nemsprep:latest

LABEL nemsver="1.5.1"
LABEL nemsver="1.6"

ENV container docker
ENV LC_ALL C
Expand Down
2 changes: 1 addition & 1 deletion notes/vm/ova-create
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
tmpdir=`mktemp -d -p /tmp/`

# Run nems-cleanup.sh halt on the NEMS VM, then import OVA:
ovftool --noSSLVerify --shaAlgorithm=SHA1 "vi://root@10.0.0.3/NEMS Linux 1.5" $tmpdir/NEMS.ova
ovftool --noSSLVerify --shaAlgorithm=SHA1 "vi://root@10.0.0.3/NEMS Linux 1.6" $tmpdir/NEMS.ova

# Extract the files from OVA
mkdir $tmpdir/ova-working
Expand Down

0 comments on commit aca21d5

Please sign in to comment.