Skip to content
Permalink
Browse files

Move nagiosgraphs to 152

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 13, 2019
1 parent 93a0817 commit 83310bcd28997843f26c12624fcaae42a7360e24
Showing with 59 additions and 0 deletions.
  1. +59 −0 build/152-nagiosgraph
@@ -0,0 +1,59 @@
#!/bin/bash
# https://raymii.org/s/tutorials/Nagios_Core_4_Installation_on_Ubuntu_12.04.html
# https://ahmermansoor.blogspot.com/2016/09/install-configure-nagiosgraph-on-nagios.html
# *** https://www.allcloud.io/how-to/install-nagiosgraph/ ***

# This has to happen AFTER 150-nems as the symlink for the nagios theme has to resolve to nems-www

# Install dependencies
apt -y install libgd-graph-perl
apt -y install libnagios-object-perl

if [[ -d /usr/local/src/nagiosgraph ]]; then
rm -Rf /tmp/nagiosgraph/
fi
mkdir -p /tmp/nagiosgraph/
cd /tmp/nagiosgraph/
wget http://downloads.sourceforge.net/project/nagiosgraph/nagiosgraph/1.5.2/nagiosgraph-1.5.2.tar.gz
tar -xf nagiosgraph-1.5.2.tar.gz
cd nagiosgraph-1.5.2

if [[ -d /usr/local/nagios/nagiosgraph ]]; then
rm -rf /usr/local/nagios/nagiosgraph
fi
mkdir /usr/local/nagios/nagiosgraph
cp -r etc /usr/local/nagios/nagiosgraph/

sed -i "s#/opt/nagiosgraph/etc#/usr/local/nagios/nagiosgraph/etc#g" cgi/*cgi
cp cgi/*.cgi /usr/local/nagios/sbin

sed -i "s#/opt/nagiosgraph/etc#/usr/local/nagios/nagiosgraph/etc#g" lib/insert.pl
cp lib/insert.pl /usr/local/nagios/libexec

cp share/nagiosgraph.css /usr/local/nagios/share
cp share/nagiosgraph.js /usr/local/nagios/share

cp -f /root/nems/nems-migrator/data/1.5/nagios/misc/nagiosgraph.conf /usr/local/nagios/nagiosgraph/etc/

mkdir /usr/local/nagios/nagiosgraph/var
mkdir /usr/local/nagios/nagiosgraph/var/rrd

echo '<script type="text/javascript" src="/nagios/nagiosgraph.js"></script>' > /usr/local/nagios/share/ssi/common-header.ssi

cp /root/nems/nems-migrator/data/1.5/nagios/etc/nagios.cfg /usr/local/nagios/etc/

chown -R nagios:nagios /usr/local/nagios/
chmod 755 /usr/local/nagios/nagiosgraph/var/rrd
touch /usr/local/nagios/nagiosgraph/var/nagiosgraph.log
chmod 664 /usr/local/nagios/nagiosgraph/var/nagiosgraph.log
touch /usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
chown www-data /usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log
chmod 664 /usr/local/nagios/nagiosgraph/var/nagiosgraph-cgi.log

cp -f share/graph.gif /usr/local/nagios/share/images/action.gif

# Cleanup backups of CSS files
rm /var/www/html/share/nagios_themes/nems-1.3/nagiosgraph.css.*

systemctl restart nagios

0 comments on commit 83310bc

Please sign in to comment.
You can’t perform that action at this time.