Skip to content
Permalink
Browse files

PATCH-000001 - Rebuild all plugins

  • Loading branch information...
NEMS Linux
NEMS Linux committed Mar 15, 2019
1 parent 3707118 commit f9e6c6920f86ec725a3aa1f3fda05de5aa1f4d2b
File renamed without changes.
@@ -0,0 +1,66 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

# This script cleans up / removes all installed Nagios plugins to prepare for installation/re-installation

# Remove old apt installed version
apt -y remove --purge monitoring-plugins*

apt -y remove --purge nagios-nrpe-plugin

apt -y autoremove

# Install dependencies
# Doing one per apt instance to avoid it failing if one package is missing
apt update
apt install -y libnet-snmp-perl
apt install -y snmp
apt install -y snmpd
apt install -y snmp-mibs-downloader
apt install -y dnsutils
apt install -y fping
apt install -y iputils-ping
apt install -y libfreeradius-client-dev
apt install -y libldap2-dev
apt install -y default-libmysqlclient-dev
apt install -y libdbi-dev
apt install -y libdbi-perl
apt install -y smbclient
apt install -y qstat
apt install -y openssl
apt install -y openssl-devel
apt install -y gettext
apt install -y openssl

# Install PostgreSQL development libraries so
# check_psql (monitoring-plugins) can compile
apt install -y libpq-dev



# Cleanup residue and then prep folders

# remove libexec if it is a directory (not symlink)
if [[ -d /usr/local/nagios/libexec ]]; then
rm -rf /usr/local/nagios/libexec
fi

if [[ -e /usr/lib/nagios/plugins ]]; then
rm -rf /usr/lib/nagios/plugins
fi

# Create the target folder if it doesn't exist
if [[ ! -d /usr/lib/nagios ]]; then
mkdir -p /usr/lib/nagios/plugins
fi

# If the libexec symlink doesn't already exist, create it
if [[ ! -e /usr/local/nagios/libexec ]]; then
ln -s /usr/lib/nagios/plugins /usr/local/nagios/libexec
fi

# Reinstall check_nrpe, which will now pop into the correct folder due to the symlink
if [[ ! -e /usr/lib/nagios/plugins/check_nrpe ]]; then
apt install -y nagios-nrpe-plugin
fi

@@ -1,76 +1,17 @@
#!/bin/bash
echo $0 > /var/www/html/userfiles/nems-build.cur

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This script is run during initial NEMS compile, but because sometimes #
# bugs are fixed in nagios-plugins that could affect users, you can also #
# run this at any time to reinstall all plugins. #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Remove old apt installed version
apt -y remove --purge monitoring-plugins

# Install dependencies
# Doing one per apt instance to avoid it failing if one package is missing
apt update
apt install -y libnet-snmp-perl
apt install -y snmp
apt install -y snmpd
apt install -y snmp-mibs-downloader
apt install -y dnsutils
apt install -y fping
apt install -y iputils-ping
apt install -y libfreeradius-client-dev
apt install -y libldap2-dev
apt install -y default-libmysqlclient-dev
apt install -y libdbi-dev
apt install -y libdbi-perl
apt install -y smbclient
apt install -y qstat
apt install -y openssl
apt install -y openssl-devel

apt install -y gettext

# BEGIN Fix NRPE and check_wmi_plus
apt -y remove --purge nagios-nrpe-plugin

apt -y autoremove

# remove libexec if it is a directory (not symlink)
if [[ -d /usr/local/nagios/libexec ]]; then
rm -rf /usr/local/nagios/libexec
fi

if [[ -e /usr/lib/nagios/plugins ]]; then
rm -rf /usr/lib/nagios/plugins
fi

# Create the target folder if it doesn't exist
if [[ ! -d /usr/lib/nagios ]]; then
mkdir -p /usr/lib/nagios/plugins
fi

# If the libexec symlink doesn't already exist, create it
if [[ ! -e /usr/local/nagios/libexec ]]; then
ln -s /usr/lib/nagios/plugins /usr/local/nagios/libexec
fi

# Reinstall check_nrpe, which will now pop into the correct folder due to the symlink
if [[ ! -e /usr/lib/nagios/plugins/check_nrpe ]]; then
apt install -y nagios-nrpe-plugin
fi

# END Fix NRPE and check_wmi_plus

# Install the plugins
cd /tmp
if [[ -e monitoring-plugins ]]; then
rm -rf monitoring-plugins
fi
git clone https://github.com/Cat5TV/monitoring-plugins
cd monitoring-plugins
./tools/setup
./configure --prefix=/usr/local/nagios/ --with-cgiurl=/nagios/cgi-bin
make
make install
# Install monitoring-plugins (the continuation of the now dead nagios-plugins)
# cd /tmp
# if [[ -e monitoring-plugins ]]; then
# rm -rf monitoring-plugins
# fi
# git clone https://github.com/Cat5TV/monitoring-plugins
# cd monitoring-plugins
# ./tools/setup
# ./configure --prefix=/usr/local/nagios/ --with-cgiurl=/nagios/cgi-bin --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
# make
# make install
apt -y install --reinstall monitoring-plugins-common
apt -y install --reinstall monitoring-plugins-basic
apt -y install --reinstall monitoring-plugins-standard
@@ -0,0 +1,17 @@
#!/bin/bash

# For early builds of NEMS Linux 1.5

# Reinstall monitoring-plugins to resolve stdout error and other issue with e$
# This is a major update and will take a while to run
if ! grep -q "PATCH-000001" /var/log/nems/patches.log; then
echo '****** PATCH-000001 *******'
echo '*** THIS IS A BIG PATCH ***'
echo 'Expect to wait a long time...'
sleep 5
/root/nems/nems-admin/build/046-plugins-prep && /root/nems/nems-admin/bui$
else
echo "This patch is already applied."
fi


0 comments on commit f9e6c69

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