summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author Mario Preksavec2017-09-25 11:39:41 +0200
committer Willy Sudiarto Raharjo2017-09-30 02:19:35 +0200
commitaf149b3737645ac9eca576de165cd8a1bc474d0a (patch)
tree67ced2184695051d905922d3072fd28b968e0c29
parent07efe8658c0f31705c451fef8907bde9cc85e8a9 (diff)
downloadslackbuilds-af149b3737645ac9eca576de165cd8a1bc474d0a.tar.gz
network/nagios: Updated for version 4.3.4.
Signed-off-by: Mario Preksavec <mario@slackware.hr>
-rw-r--r--network/nagios/README20
-rw-r--r--network/nagios/README.SLACKWARE4
-rw-r--r--network/nagios/doinst.sh19
-rw-r--r--network/nagios/nagios.SlackBuild33
-rw-r--r--network/nagios/nagios.info6
5 files changed, 46 insertions, 36 deletions
diff --git a/network/nagios/README b/network/nagios/README
index 948f273e08..f08b8b64c3 100644
--- a/network/nagios/README
+++ b/network/nagios/README
@@ -2,28 +2,14 @@ Nagios is a powerful monitoring system that enables organizations to identify
and resolve IT infrastructure problems before they affect critical business
processes.
-Nagios requires a "nagios" user and group; create these before running the
-SlackBuild script. Examples:
-
- # groupadd -g 213 nagios
- # useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
-
-For some scripts to work, it is necessary to include the 'apache' user in
-the nagios group.
-
For some functions (most notably the "map" function), you need to have X
installed on your server. You do not have to start X though, nagios just
needs some of the libraries and fonts.
-This SlackBuild installs the basic nagios system in /var/www/htdocs/
-To change the location, set the DOCROOT variable:
- # DOCROOT=/your/docroot/dir ./nagios.SlackBuild
-
-For a useful setup, you will want to have monitoring-plugins installed.
+For a useful setup, you will want to have monitoring-plugins installed
+(nagios-plugins is also an option, but make sure to edit resource.cfg).
-To configure nagios, some knowledge of httpd is required. Check the included
-'README.SLACKWARE' file for some basic setup instructions. The include file
-for httpd is installed as /etc/httpd/extra/nagios.conf
+Check the included 'README.SLACKWARE' file for additional setup instructions.
Lots of information is available in the included documentation, and even
more can be found on the nagios site and wiki <http://wiki.nagios.org>.
diff --git a/network/nagios/README.SLACKWARE b/network/nagios/README.SLACKWARE
index 58c3afe45b..6d24c57e10 100644
--- a/network/nagios/README.SLACKWARE
+++ b/network/nagios/README.SLACKWARE
@@ -10,12 +10,12 @@ running on your computer.
0.1) Create nagios group & user
Before even running the SlackBuild script, create the necessary 'nagios'
-user and group. The SlackBuild script won't run if these do not exist.
+user and group. The SlackBuild script will remind you if these do not exist.
The suggested UID and GID is 213, but you can change this as needed:
# groupadd -g 213 nagios
- # useradd -u 213 -d /dev/null -s /bin/false -g nagios nagios
+ # useradd -u 213 -d /var/nagios -s /bin/bash -g nagios nagios
0.2) Add 'apache' to 'nagios' group
diff --git a/network/nagios/doinst.sh b/network/nagios/doinst.sh
index 4dd7fba9f9..03d95781a1 100644
--- a/network/nagios/doinst.sh
+++ b/network/nagios/doinst.sh
@@ -11,14 +11,19 @@ config() {
# Otherwise, we leave the .new copy for the admin to consider...
}
-# Keep same perms on rc.nagios.new:
-if [ -e etc/rc.d/rc.nagios ]; then
- cp -a etc/rc.d/rc.nagios etc/rc.d/rc.nagios.new.incoming
- cat etc/rc.d/rc.nagios.new > etc/rc.d/rc.nagios.new.incoming
- mv etc/rc.d/rc.nagios.new.incoming etc/rc.d/rc.nagios.new
-fi
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.nagios.new
find etc/nagios/ -name *.cfg.new | while read cfg ; do config $cfg ; done
config etc/httpd/extra/nagios.conf.new
-config etc/rc.d/rc.nagios.new
diff --git a/network/nagios/nagios.SlackBuild b/network/nagios/nagios.SlackBuild
index c2f2d5108d..d19ea44f60 100644
--- a/network/nagios/nagios.SlackBuild
+++ b/network/nagios/nagios.SlackBuild
@@ -24,7 +24,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=nagios
-VERSION=${VERSION:-4.3.2}
+VERSION=${VERSION:-4.3.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@@ -63,14 +63,33 @@ else
LIBDIRSUFFIX=""
fi
+USERNAME=${USERNAME:-nagios}
+GROUPNAME=${GROUPNAME:-nagios}
+USERID=${USERID:-213}
+GROUPID=${GROUPID:-213}
+HOMEDIR=${HOMEDIR:-/var/nagios}
+SHELLNAME=${SHELLNAME:-/bin/bash}
+
+GETUSER=$(getent passwd $USERNAME)
+GETGROUP=$(getent group $GROUPNAME)
+
set -e
-# Check if the 'nagios' user & group exist:
-if [ "$(grep ^nagios /etc/passwd)" = "" -o "$(grep ^nagios /etc/group)" = "" ] ; then
- printf "\nYou must have a nagios user and group.\n\nExample:\n"
- printf "\t# groupadd -g 213 nagios\n"
- printf "\t# useradd -d /dev/null -s /bin/false -u 213 -g nagios nagios\n\n"
- exit 1
+if [ -z "$GETUSER" -o -z "$GETGROUP" ]; then
+ printf "\n You must have a \"$PRGNAM\" user and a group to run this script\n\n"
+ [ -z "$GETGROUP" ] && printf " # groupadd -g $GROUPID $GROUPNAME\n"
+ [ -z "$GETUSER" ] && printf " # useradd -u $USERID -d $HOMEDIR -s $SHELLNAME -g $GROUPNAME $USERNAME\n"
+ printf "\n"
+ exit 1
+fi
+
+if [[ ! $GETUSER =~ ^$USERNAME:[^:]+:$USERID:$GROUPID:[^:]*:$HOMEDIR:$SHELLNAME$ ]]; then
+ printf "\n You must update the \"$PRGNAM\" user to run this script\n\n"
+ [[ $GETUSER =~ ^[^:]+:[^:]+:[^:]+:[^:]+:[^:]*:([^:]+):([^:]+)$ ]]
+ [ "${BASH_REMATCH[1]}" != "$HOMEDIR" ] && printf " # usermod -d $HOMEDIR $USERNAME\n"
+ [ "${BASH_REMATCH[2]}" != "$SHELLNAME" ] && printf " # usermod -s $SHELLNAME $USERNAME\n"
+ printf "\n"
+ exit 1
fi
rm -rf $PKG
diff --git a/network/nagios/nagios.info b/network/nagios/nagios.info
index af3a750056..d1a7bcbd3a 100644
--- a/network/nagios/nagios.info
+++ b/network/nagios/nagios.info
@@ -1,8 +1,8 @@
PRGNAM="nagios"
-VERSION="4.3.2"
+VERSION="4.3.4"
HOMEPAGE="https://www.nagios.org/"
-DOWNLOAD="https://downloads.sourceforge.net/nagios/nagios-4.3.2.tar.gz"
-MD5SUM="e3c714ee7af4994f4acce7f614525775"
+DOWNLOAD="https://downloads.sourceforge.net/nagios/nagios-4.3.4.tar.gz"
+MD5SUM="e2229f9a98c2577d51576daf19713e4d"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""