network/zabbix_agentd: Updated for version 2.0.6.

Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
This commit is contained in:
Michal Bialozor 2013-06-30 20:20:53 -03:00 committed by Erik Hanson
parent 28ba90f11b
commit 4dad3e8b3e
5 changed files with 55 additions and 32 deletions

View File

@ -10,6 +10,16 @@ system for consistency with local assignments.
User: zabbixagent UID: 266 GID: 266
group: zabbixagent GID: 266
You can pass alternate values for the user and group using
ZABBIXAGENTUSER and ZABBIXAGENTGROUP variables when running the build script.
zabbix_agentd needs another user/group to cooperate with other Zabbix deamons,
like zabbix_server or zabbix_proxy. This has been assigned to the following
by SlackBuilds.org, but feel free to change it on your system for consistency
with local assignments.
User: zabbix UID: 228 GID: 228
group: zabbix GID: 228
You can pass alternate values for the user and group using
ZABBIXUSER and ZABBIXGROUP variables when running the build script.

View File

@ -10,13 +10,15 @@ installation of zabbix_agentd on Slackware.
0.1) zabbix group & user
Before running the zabbix_agentd.SlackBuild script, you will need to create
the 'zabbixagent' user and group. The script won't run if these do not
exist.
the 'zabbix' user and group as well as 'zabbixagent' user. The script won't
run if these do not exist.
The suggested UID and GID is 228, but you can change this as needed:
The suggested UID and GID is 228 for 'zabbix' and 266 for 'zabbixagent',
but you can change this as needed:
# groupadd -g 266 zabbixagent
# useradd -u 266 -g zabbixagent -m zabbixagent
# groupadd -g 228 zabbix
# useradd -u 228 -g zabbix -d /dev/null -s /bin/false zabbix
# useradd -u 266 -g zabbix -d /dev/null -s /bin/false zabbixagent
1) Configuring zabbix_agentd
----------------------------

View File

@ -1,6 +1,6 @@
#!/bin/sh
# usage: ./rc.zabbix_agentd { start | stop | restart }
# Usage: ./rc.zabbix_agentd {start|stop|restart}
PRGNAM=zabbix_agentd
PRGDIR=/usr/sbin/
@ -10,28 +10,28 @@ DATE=$(date +%a\ %b\ %d\ %T\ %Y)
RETVAL=0
prg_start() {
echo -n "Starting $PRGNAM ... "
echo -n "Starting $PRGNAM ... "
if [ -r ${PIDDIR}${PRGNAM}.pid ]; then
if $(! /sbin/pidof $PRGNAM > /dev/null 2>&1 ) ; then
echo "Removing an old ${PIDDIR}${PRGNAM}.pid"
rm -f ${PIDDIR}${PRGNAM}.pid
fi
fi
su - @ZABBIXUSER@ -c "${PRGDIR}${PRGNAM} >> ${LOGDIR}${PRGNAM}.log 2>&1"
su -s /bin/sh -c "${PRGDIR}${PRGNAM} >> ${LOGDIR}${PRGNAM}.log 2>&1" @ZABBIXAGENTUSER@
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/$PRGNAM
sleep 2
echo "Done"
echo "done"
else
echo "Failed"
echo "failed"
fi
return $RETVAL
}
prg_stop() {
echo -n "Stopping $PRGNAM ... "
echo -n "Stopping $PRGNAM ... "
if [ -r ${PIDDIR}${PRGNAM}.pid ]; then
killall $PRGNAM
# Give it some time to die gracefully
@ -48,7 +48,7 @@ prg_stop() {
sleep 10
else
echo "$DATE EXIT: $PRGNAM stopped by user: $USER (UID: $EUID)" >> ${LOGDIR}${PRGNAM}.log
echo "Done"
echo "done"
fi
fi
rm -f /var/lock/$PRGNAM
@ -70,8 +70,7 @@ case "$1" in
prg_start
;;
*)
echo ""
echo "Usage: $(basename $0) {start | stop | restart }"
echo "Usage: $(basename $0) {start|stop|restart}"
RETVAL=1
esac

View File

@ -2,7 +2,7 @@
# Slackware build script for zabbix_agentd
# Copyright 2012 Michal Bialozor, Gdansk, POLAND
# Copyright 2013 Michal Bialozor, Gdansk, Pomorskie, POLAND
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=zabbix_agentd
VERSION=${VERSION:-1.8.16}
VERSION=${VERSION:-2.0.6}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -37,10 +37,15 @@ fi
PRGSHORT=zabbix
ZABBIXUSER=${ZABBIXUSER:-zabbixagent}
ZABBIXGROUP=${ZABBIXGROUP:-zabbixagent}
ZABBIXUID=${ZABBIXUID:-266}
ZABBIXGID=${ZABBIXGID:-266}
ZABBIXUSER=${ZABBIXUSER:-zabbix}
ZABBIXGROUP=${ZABBIXGROUP:-zabbix}
ZABBIXUID=${ZABBIXUID:-228}
ZABBIXGID=${ZABBIXGID:-228}
ZABBIXAGENTUSER=${ZABBIXAGENTUSER:-zabbixagent}
ZABBIXAGENTGROUP=${ZABBIXAGENTGROUP:-zabbixagent}
ZABBIXAGENTUID=${ZABBIXAGENTUID:-266}
ZABBIXAGENTGID=${ZABBIXAGENTGID:-266}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
@ -50,12 +55,14 @@ OUTPUT=${OUTPUT:-/tmp}
set -e
# Bail out if user or group isn't valid on your system
# For slackbuilds.org, assigned zabbixagent uid/gid are 266/266
# For slackbuilds.org, assigned zabbixagent uid/gid are 266/266 and assigned zabbix uid/gid are 228/228
# See http://slackbuilds.org/uid_gid.txt
if [ "$(grep ^$ZABBIXUSER: /etc/passwd)" = "" -o "$(grep ^$ZABBIXGROUP: /etc/group)" = "" ] ; then
echo " You must have a \"$ZABBIXGROUP\" group and user to run this script."
if [ "$(grep ^$ZABBIXAGENTUSER: /etc/passwd)" = "" -o "$(grep ^$ZABBIXAGENTUSER: /etc/passwd)" = "" -o \
"$(grep ^$ZABBIXGROUP: /etc/group)" = "" ] ; then
echo " You must have a \"$ZABBIXGROUP\" group as well as \"$ZABBIXUSER\" and \"$ZABBIXAGENTUSER\" users to run this script."
echo " # groupadd -g $ZABBIXGID $ZABBIXGROUP"
echo " # useradd -u $ZABBIXUID -g $ZABBIXGROUP -d /dev/null -s /bin/false $ZABBIXUSER"
echo " # useradd -u $ZABBIXAGENTUID -g $ZABBIXGROUP -d /dev/null -s /bin/false $ZABBIXAGENTUSER"
exit 1
fi
@ -91,7 +98,7 @@ CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--sysconfdir=/etc/zabbix \
--localstatedir=/var/lib \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
@ -110,30 +117,35 @@ for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; r
# Initial log file
mkdir -p $PKG/var/log/$PRGSHORT
chown $ZABBIXUSER:$ZABBIXGROUP $PKG/var/log/$PRGSHORT
chmod g+w $PKG/var/log/$PRGSHORT
touch $PKG/var/log/$PRGSHORT/$PRGNAM.log.new
chown -R $ZABBIXUSER:$ZABBIXGROUP $PKG/var/log/$PRGSHORT
chown $ZABBIXAGENTUSER:$ZABBIXUSER $PKG/var/log/$PRGSHORT/$PRGNAM.log.new
# Dir for pid-file
mkdir -p $PKG/var/run/$PRGSHORT
chown -R $ZABBIXUSER:$ZABBIXGROUP $PKG/var/run/$PRGSHORT
chmod g+w $PKG/var/run/$PRGSHORT
# Configuration file
mkdir -p $PKG/etc/$PRGSHORT/zabbix_agentd.conf.d
sed -e "s,# PidFile=/tmp/,PidFile=/var/run/$PRGSHORT/," \
-e "s,LogFile=/tmp/,LogFile=/var/log/$PRGSHORT/," \
misc/conf/$PRGNAM.conf > $PKG/etc/$PRGSHORT/$PRGNAM.conf.new
$PKG/etc/$PRGSHORT/$PRGNAM.conf > $PKG/etc/$PRGSHORT/$PRGNAM.conf.new
rm -rf $PKG/etc/$PRGSHORT/zabbix_agent.conf.d $PKG/etc/$PRGSHORT/zabbix_agent.conf \
$PKG/etc/$PRGSHORT/$PRGNAM.conf
# Init script
mkdir -p $PKG/etc/rc.d
sed "s|@ZABBIXUSER@|$ZABBIXUSER|" $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new
sed "s|@ZABBIXAGENTUSER@|$ZABBIXAGENTUSER|" $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new
# Documentation
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHORS COPYING ChangeLog CREDITS INSTALL NEWS README \
cp -a AUTHORS COPYING ChangeLog INSTALL NEWS README \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
# Installation scripts
mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

View File

@ -1,8 +1,8 @@
PRGNAM="zabbix_agentd"
VERSION="1.8.16"
VERSION="2.0.6"
HOMEPAGE="http://www.zabbix.com"
DOWNLOAD="http://downloads.sourceforge.net/zabbix/zabbix-1.8.16.tar.gz"
MD5SUM="891b7a5c915f3060b66687a483dc0551"
DOWNLOAD="http://downloads.sourceforge.net/zabbix/zabbix-2.0.6.tar.gz"
MD5SUM="f7261987731dd74b58cb1da890655ddc"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""