network/nagios: Updated for version 4.3.4.

Signed-off-by: Mario Preksavec <mario@slackware.hr>
This commit is contained in:
Mario Preksavec 2017-09-25 11:39:41 +02:00 committed by Willy Sudiarto Raharjo
parent 07efe8658c
commit af149b3737
5 changed files with 46 additions and 36 deletions

View File

@ -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
(nagios-plugins is also an option, but make sure to edit resource.cfg).
For a useful setup, you will want to have monitoring-plugins installed.
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>.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=""