Skip to content
Permalink
Browse files

Move plugins to repo

  • Loading branch information...
NEMS Linux
NEMS Linux committed Feb 25, 2019
1 parent a15e86b commit 6557939baea9f42b6819a766bc491de99fa9db94
Showing with 14 additions and 42 deletions.
  1. +14 −42 build/051-nagios-plugins
@@ -30,57 +30,29 @@ echo $0 > /var/www/html/userfiles/nems-build.cur
apt install -y gettext

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

# Remove NRPE plugin if it is installed in the wrong folder
# Check if it's a directory (not symlink) first
if [[ -d /usr/lib/nagios/plugins ]]; then
if [[ -e /usr/lib/nagios/plugins/check_nrpe ]]; then
apt -y --purge remove nagios-nrpe-plugin
fi
# remove libexed if it is a directory (not symlink)
if [[ -d /usr/local/nagios/libexec ]]; then
rm -rf /usr/local/nagios/libexec
fi

# If the plugins folder still exists, rename it (would rather delete)
if [[ -d /usr/lib/nagios/plugins ]]; then
mv /usr/lib/nagios/plugins /usr/lib/nagios/plugins~
fi

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

# If the plugins symlink doesn't already exist, create it
# This is needed for check_wmi_plus. While I could patch it, I don't want to have to maintain it TBH
if [[ ! -e /usr/lib/nagios/plugins ]]; then
ln -s /usr/local/nagios/libexec /usr/lib/nagios/plugins
# 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
apt install -y nagios-nrpe-plugin

# END Fix NRPE and check_wmi_plus

# Setup automake so this can compile on any system.
# for example, in early builds for PINE64 you'd have to do this: ./configure --build=arm --with-nagios-user=nagios --with-nagios-group=nagios
# but now automake allows automatic detection of platform
apt -y install automake
automake=$(ls -r /usr/share/automake*/config.guess | head -1)

# Obtain the source for monitoring-plugins
if [[ -d /tmp/monitoring-plugins/ ]]; then
rm -rf /tmp/monitoring-plugins/
if [[ ! -e /usr/lib/nagios/plugins/check_nrpe ]]; then
apt install -y nagios-nrpe-plugin
fi
cd /tmp
git clone https://github.com/monitoring-plugins/monitoring-plugins
cd /tmp/monitoring-plugins

./tools/setup

# This is where automake's config gets written to the nagios-plugins src:
cp $automake /tmp/monitoring-plugins/build-aux/

# Build it and install it
./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make
make install
# END Fix NRPE and check_wmi_plus

# Install the plugins
apt install -y monitoring-plugins

0 comments on commit 6557939

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