diff options
Diffstat (limited to 'network')
-rw-r--r-- | network/zabbix_agentd/README | 17 | ||||
-rw-r--r-- | network/zabbix_agentd/README.SLACKWARE | 71 | ||||
-rw-r--r-- | network/zabbix_agentd/doinst.sh | 24 | ||||
-rw-r--r-- | network/zabbix_agentd/rc.zabbix_agentd | 79 | ||||
-rw-r--r-- | network/zabbix_agentd/slack-desc | 19 | ||||
-rw-r--r-- | network/zabbix_agentd/zabbix_agentd.SlackBuild | 116 | ||||
-rw-r--r-- | network/zabbix_agentd/zabbix_agentd.info | 10 |
7 files changed, 336 insertions, 0 deletions
diff --git a/network/zabbix_agentd/README b/network/zabbix_agentd/README new file mode 100644 index 0000000000..649bc61434 --- /dev/null +++ b/network/zabbix_agentd/README @@ -0,0 +1,17 @@ +zabbix_agentd is the Linux agent daemon used to monitor Linux boxes +and send the data to the zabbix server. + +Zabbix offers advanced monitoring, alerting and visualization features, +including distributed monitoring, auto-discovery, notifications, etcetera. + +zabbix_agentd needs to run under its own user/group. 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. + +For some important post-build and basic configuration instructions, +see the included README.SLACKWARE file. diff --git a/network/zabbix_agentd/README.SLACKWARE b/network/zabbix_agentd/README.SLACKWARE new file mode 100644 index 0000000000..d1b96b52ea --- /dev/null +++ b/network/zabbix_agentd/README.SLACKWARE @@ -0,0 +1,71 @@ +README.Slackware +================ + +This file contains some specific instructions to complete the +installation of zabbix_agentd on Slackware. + +0) Before running the SlackBuild script +--------------------------------------- + +0.1) zabbix group & user + +Before running the zabbix_agentd.SlackBuild script, you will need to create +the 'zabbix' user and group. The script won't run if these do not +exist. + +The suggested UID and GID is 228, but you can change this as needed: + + # groupadd -g 228 zabbix + # useradd -u 228 -g zabbix -d /dev/null -s /bin/false zabbix + +1) Configuring zabbix_agentd +---------------------------- + +A standard configuration file is installed as /etc/zabbix/zabbix_agentd.conf + +At least the following lines need to be configured: + + Server=<ip_of_your_zabbix_server> + Hostname=<hostname_of_your_zabbix_server> + +2) Start & Stop scripts for zabbix agent daemon +----------------------------------------------- + +2.1) Automatic startup and shutdown + +If you want to start zabbix_agentd on system bootup, include these lines in +your /etc/rc.d/rc.local: + + # Start zabbix_agentd + if [ -x /etc/rc.d/rc.zabbix_agentd ]; then + echo "Starting zabbix agent daemon..." + /etc/rc.d/rc.zabbix_agentd start + fi + +To guarantee a clean shutdown of zabbix_agentd, include this in +/etc/rc.d/rc.local_shutdown: + + # Stop zabbix_agentd + if [ -x /etc/rc.d/rc.zabbix_agentd ]; then + echo "Stopping zabbix agent daemon..." + /etc/rc.d/rc.zabbix_agentd stop + fi + +2.2) Make /etc/rc.d/rc.zabbix_agentd executable + +Additionally, you'll have to set the rc script to be executable just like +any other Slackware rc script: + + # chmod +x /etc/rc.d/rc.zabbix_agentd + +4) Starting zabbix agent daemon +------------------------------- + +Now you are ready to start zabbix_agentd by calling the startup script: + + # /etc/rc.d/rc.zabbix_agentd start + +You can check the log file (/var/log/zabbix/zabbig_agentd.log) in case of +problems. +Zabbix uses ports 10050 & 10051 to communicate, so make sure these aren't +blocked on your network. diff --git a/network/zabbix_agentd/doinst.sh b/network/zabbix_agentd/doinst.sh new file mode 100644 index 0000000000..1bc367ca63 --- /dev/null +++ b/network/zabbix_agentd/doinst.sh @@ -0,0 +1,24 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.zabbix_agentd.new: +if [ -e etc/rc.d/rc.zabbix_agentd ]; then + cp -a etc/rc.d/rc.zabbix_agentd etc/rc.d/rc.zabbix_agentd.new.incoming + cat etc/rc.d/rc.zabbix_agentd.new > etc/rc.d/rc.zabbix_agentd.new.incoming + mv etc/rc.d/rc.zabbix_agentd.new.incoming etc/rc.d/rc.zabbix_agentd.new +fi + +config etc/rc.d/rc.zabbix_agentd.new +config etc/zabbix/zabbix_agentd.conf.new +config var/log/zabbix/zabbix_agentd.log.new +rm -f var/log/zabbix/zabbix_agentd.log.new + diff --git a/network/zabbix_agentd/rc.zabbix_agentd b/network/zabbix_agentd/rc.zabbix_agentd new file mode 100644 index 0000000000..bbe5650698 --- /dev/null +++ b/network/zabbix_agentd/rc.zabbix_agentd @@ -0,0 +1,79 @@ +#!/bin/sh + +# usage: ./rc.zabbix_agentd { start | stop | restart } + +PRGNAM=zabbix_agentd +PRGDIR=/usr/sbin/ +PIDDIR=/var/run/zabbix/ +LOGDIR=/var/log/zabbix/ +DATE=$(date +%a\ %b\ %d\ %T\ %Y) +RETVAL=0 + +prg_start() { + 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 + ${PRGDIR}${PRGNAM} >> ${LOGDIR}${PRGNAM}.log 2>&1 + RETVAL=$? + + if [ $RETVAL -eq 0 ]; then + touch /var/lock/$PRGNAM + sleep 2 + echo "Done" + else + echo "Failed" + fi + return $RETVAL +} + +prg_stop() { + echo -n "Stopping $PRGNAM ... " + if [ -r ${PIDDIR}${PRGNAM}.pid ]; then + killall $PRGNAM + # Give it some time to die gracefully + for second in 0 1 2 3 4 5 6 7 8 9 10 ; do + if $(! /sbin/pidof $PRGNAM > /dev/null 2>&1 ) ; then + rm -f ${PIDDIR}${PRGNAM}.pid + break; + fi + sleep 1 + done + + if [ "$second" = "10" ]; then + echo "\nWARNING: $PRGNAM did not exit!" + sleep 10 + else + echo "$DATE EXIT: $PRGNAM stopped by user: $USER (UID: $EUID)" >> ${LOGDIR}${PRGNAM}.log + echo "Done" + fi + fi + rm -f /var/lock/$PRGNAM + return $RETVAL +} + +# How were we called: +case "$1" in + start) + prg_start + ;; + stop) + prg_stop + ;; + restart|reload) + prg_stop + # Wait a few seconds before restarting + sleep 10 + prg_start + ;; + *) + echo "" + echo "Usage: $(basename $0) {start | stop | restart }" + RETVAL=1 +esac + +exit $RETVAL +#EOF diff --git a/network/zabbix_agentd/slack-desc b/network/zabbix_agentd/slack-desc new file mode 100644 index 0000000000..8c9326831e --- /dev/null +++ b/network/zabbix_agentd/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +zabbix_agentd: zabbix_agentd (Linux agent daemon for zabbix_server) +zabbix_agentd: +zabbix_agentd: Zabbix offers advanced monitoring, alerting and visualization +zabbix_agentd: features, including distributed monitoring, auto-discovery, +zabbix_agentd: notifications etc. +zabbix_agentd: +zabbix_agentd: This is the agent daemon that communicates with the zabbix_server. +zabbix_agentd: +zabbix_agentd: http://www.zabbix.com/ +zabbix_agentd: +zabbix_agentd: diff --git a/network/zabbix_agentd/zabbix_agentd.SlackBuild b/network/zabbix_agentd/zabbix_agentd.SlackBuild new file mode 100644 index 0000000000..2efc64711f --- /dev/null +++ b/network/zabbix_agentd/zabbix_agentd.SlackBuild @@ -0,0 +1,116 @@ +#!/bin/sh + +# Slackware build script for zabbix_agentd +# maintained by Niels Horn <niels.horn@gmail.com> +# revision date 2010-01-27 + +PRGNAM=zabbix_agentd +VERSION=1.8.1 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +PRGSHORT=zabbix + +ZABBIXUSER=${ZABBIXUSER:-zabbix} +ZABBIXGROUP=${ZABBIXGROUP:-zabbix} +ZABBIXUID=${ZABBIXUID:-228} +ZABBIXGID=${ZABBIXGID:-228} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +# Bail out if user or group isn't valid on your system +# For slackbuilds.org, assigned zabbix uid/gid are 228/228 +# See http://slackbuilds.org/uid_gid.txt +if ! grep ^$ZABBIXGROUP: /etc/group 2>&1 > /dev/null; then + echo " You must have a \"$ZABBIXGROUP\" group to run this script." + echo " # groupadd -g $ZABBIXGID $ZABBIXGROUP" + exit 1 +elif ! grep ^$ZABBIXUSER: /etc/passwd 2>&1 > /dev/null; then + echo " You must have a \"$ZABBIXUSER\" user to run this script." + echo " # useradd -u $ZABBIXUID -g $ZABBIXGROUP -d /dev/null -s /bin/false $ZABBIXUSER" + exit 1 +fi + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGSHORT-$VERSION +tar xvf $CWD/$PRGSHORT-$VERSION.tar.gz +cd $PRGSHORT-$VERSION +chown -R root:root . + +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var/lib \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --enable-agent \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | \ + xargs strip --strip-unneeded 2> /dev/null || true +) + +# Initial log file +mkdir -p $PKG/var/log/$PRGSHORT +touch $PKG/var/log/$PRGSHORT/${PRGNAM}.log.new +chown -R $ZABBIXUSER:$ZABBIXGROUP $PKG/var/log/$PRGSHORT + +# Dir for pid-file +mkdir -p $PKG/var/run/$PRGSHORT +chown -R $ZABBIXUSER:$ZABBIXGROUP $PKG/var/run/$PRGSHORT + +# Configuration file +mkdir -p $PKG/etc/$PRGSHORT +sed -e "s,PidFile=/var/tmp/,PidFile=/var/run/$PRGSHORT/," \ + -e "s,LogFile=/tmp/,LogFile=/var/log/$PRGSHORT/," \ + misc/conf/$PRGNAM.conf > $PKG/etc/$PRGSHORT/$PRGNAM.conf.new + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS COPYING ChangeLog FAQ 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 + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/zabbix_agentd/zabbix_agentd.info b/network/zabbix_agentd/zabbix_agentd.info new file mode 100644 index 0000000000..a2c02940fc --- /dev/null +++ b/network/zabbix_agentd/zabbix_agentd.info @@ -0,0 +1,10 @@ +PRGNAM="zabbix_agentd" +VERSION="1.8.1" +HOMEPAGE="http://www.zabbix.com" +DOWNLOAD="http://downloads.sourceforge.net/zabbix/zabbix-1.8.1.tar.gz" +MD5SUM="ab1a5006a885d780084bb870320abbc9" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Niels Horn" +EMAIL="niels.horn@gmail.com" +APPROVED="Erik Hanson" |