aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Horn <niels.horn@gmail.com>2010-08-28 08:10:07 -0400
committerErik Hanson <erik@slackbuilds.org>2010-08-29 15:32:14 -0500
commitd8a948f940ba04e4108ba54e1a604f4acc82b9dc (patch)
tree393e8f84910b2615b8f04a692b10ddd0b501f3fb
parentf5287105ec1e82d22cf6fd8e556b1094f244bcff (diff)
network/zabbix_proxy: Added (Linux proxy daemon for zabbix_server)
Signed-off-by: dsomero <xgizzmo@slackbuilds.org>
-rw-r--r--network/zabbix_proxy/README21
-rw-r--r--network/zabbix_proxy/README.SLACKWARE116
-rw-r--r--network/zabbix_proxy/doinst.sh24
-rw-r--r--network/zabbix_proxy/rc.zabbix_proxy79
-rw-r--r--network/zabbix_proxy/slack-desc20
-rw-r--r--network/zabbix_proxy/zabbix_proxy.SlackBuild145
-rw-r--r--network/zabbix_proxy/zabbix_proxy.info10
7 files changed, 415 insertions, 0 deletions
diff --git a/network/zabbix_proxy/README b/network/zabbix_proxy/README
new file mode 100644
index 0000000000000..90e9e823ac4fc
--- /dev/null
+++ b/network/zabbix_proxy/README
@@ -0,0 +1,21 @@
+Zabbix Proxies may greatly simplify maintenance of Zabbix environment
+and increase performance of the central Zabbix server.
+
+Also, use of Zabbix Proxies is the easiest way of implementing centralized
+and distributed monitoring, when all Agents and Proxies report to one
+Zabbix server and all data is collected centrally.
+
+Zabbix offers advanced monitoring, alerting and visualization features,
+including distributed monitoring, auto-discovery, notifications, etcetera.
+
+zabbix_proxy 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_proxy/README.SLACKWARE b/network/zabbix_proxy/README.SLACKWARE
new file mode 100644
index 0000000000000..5adfeadfbdf8e
--- /dev/null
+++ b/network/zabbix_proxy/README.SLACKWARE
@@ -0,0 +1,116 @@
+README.Slackware
+================
+
+This file contains some specific instructions to complete the
+installation of zabbix_proxy on Slackware.
+
+You will need to have a working installation of MySQL (*) for zabbix_proxy
+to run. MySQL server does not have to be on the same box as your
+zabbix_proxy, but they need to be able to communicate and you will need at
+least the MySQL client on the box that will run zabbix_proxy.
+
+(*) zabbix can work with MySQL, Oracle, PostgreSQL and SQLite databases,
+ but these instructions are for MySQL, as it is included with Slackware.
+
+0) Before running the SlackBuild script
+---------------------------------------
+
+0.1) zabbix group & user
+
+Before running the zabbix_proxy.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_proxy
+---------------------------
+
+For those in a hurry, here are some basic steps to get zabbix proxy up &
+running:
+
+1.1) Create initial database
+
+On your MySQL server, connect with full privileges:
+
+ # mysql -u <your_user> -p<your_password>
+
+Create the zabbix database & user:
+
+ mysql> create database zabbix character set utf8;
+ mysql> use mysql;
+ mysql> grant all on zabbix.* to zabbix@<your_zabbix_proxy> identified by '<your_password>';
+ mysql> flush privileges;
+ mysql> quit
+
+(note: if your MySQL server and zabbix server are the same, use "localhost"
+ for <your_zabbix_proxy>)
+
+On your zabbix server, connect to the new database:
+
+ # cd /usr/share/zabbix_proxy/create
+ # mysql -h <your_mysql_server> -u zabbix -p<your_password> zabbix
+
+In MySQL, create the schema & add initial data:
+
+ mysql> source schema/mysql.sql;
+ mysql> quit
+
+1.2) zabbix_proxy configuration file
+
+A standard configuration file is installed as /etc/zabbix/zabbix_proxy.conf
+
+You will need to change at least the following lines:
+
+ Server=<ip_of_your_zabbix_proxy>
+ Hostname=<hostname_of_your_zabbix_proxy>
+
+ DBHost=<your_mysql_server> (Change if MySQL is not on localhost)
+ DBUser=zabbix ("root" doesn't sound like a good idea)
+ DBPassword=<your_password> (Change as defined above)
+
+2) Start & Stop scripts for zabbix server
+-----------------------------------------
+
+2.1) Automatic startup and shutdown
+
+If you want to start zabbix_proxy on system bootup, include these lines in
+your /etc/rc.d/rc.local:
+
+ # Start zabbix_proxy
+ if [ -x /etc/rc.d/rc.zabbix_proxy ]; then
+ echo "Starting zabbix proxy..."
+ /etc/rc.d/rc.zabbix_proxy start
+ fi
+
+To guarantee a clean shutdown of zabbix_proxy, include this in
+/etc/rc.d/rc.local_shutdown:
+
+ # Stop zabbix_proxy
+ if [ -x /etc/rc.d/rc.zabbix_proxy ]; then
+ echo "Stopping zabbix proxy..."
+ /etc/rc.d/rc.zabbix_proxy stop
+ fi
+
+2.2) Make /etc/rc.d/rc.zabbix_proxy 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_proxy
+
+3) Starting zabbix proxy daemon
+-------------------------------
+
+Now you are ready to start zabbix_proxy by calling the startup script:
+
+ # /etc/rc.d/rc.zabbix_proxy start
+
+You can check the log file (/var/log/zabbix/zabbig_proxy.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_proxy/doinst.sh b/network/zabbix_proxy/doinst.sh
new file mode 100644
index 0000000000000..ee8cda05b71c6
--- /dev/null
+++ b/network/zabbix_proxy/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_proxy.new:
+if [ -e etc/rc.d/rc.zabbix_proxy ]; then
+ cp -a etc/rc.d/rc.zabbix_proxy etc/rc.d/rc.zabbix_proxy.new.incoming
+ cat etc/rc.d/rc.zabbix_proxy.new > etc/rc.d/rc.zabbix_proxy.new.incoming
+ mv etc/rc.d/rc.zabbix_proxy.new.incoming etc/rc.d/rc.zabbix_proxy.new
+fi
+
+config etc/rc.d/rc.zabbix_proxy.new
+config etc/zabbix/zabbix_proxy.conf.new
+config var/log/zabbix/zabbix_proxy.log.new
+rm -f var/log/zabbix/zabbix_proxy.log.new
+
diff --git a/network/zabbix_proxy/rc.zabbix_proxy b/network/zabbix_proxy/rc.zabbix_proxy
new file mode 100644
index 0000000000000..7bb197483565b
--- /dev/null
+++ b/network/zabbix_proxy/rc.zabbix_proxy
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+# usage: ./rc.zabbix_proxy { start | stop | restart }
+
+PRGNAM=zabbix_proxy
+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_proxy/slack-desc b/network/zabbix_proxy/slack-desc
new file mode 100644
index 0000000000000..7c99dc0b6f2af
--- /dev/null
+++ b/network/zabbix_proxy/slack-desc
@@ -0,0 +1,20 @@
+# 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_proxy: zabbix_proxy (Linux proxy daemon for zabbix_server)
+zabbix_proxy:
+zabbix_proxy: Zabbix offers advanced monitoring, alerting and visualization
+zabbix_proxy: features, including distributed monitoring, auto-discovery,
+zabbix_proxy: notifications etc.
+zabbix_proxy:
+zabbix_proxy: This is the proxy daemon that communicates with zabbix_server.
+zabbix_proxy:
+zabbix_proxy: http://www.zabbix.com/
+zabbix_proxy:
+zabbix_proxy:
+
diff --git a/network/zabbix_proxy/zabbix_proxy.SlackBuild b/network/zabbix_proxy/zabbix_proxy.SlackBuild
new file mode 100644
index 0000000000000..cfeba5e4eda13
--- /dev/null
+++ b/network/zabbix_proxy/zabbix_proxy.SlackBuild
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+# Slackware build script for zabbix_proxy
+# (with help from Michael Bialy)
+# maintained by Niels Horn <niels.horn@gmail.com>
+# revision date 2010/08/23
+
+PRGNAM=zabbix_proxy
+VERSION=${VERSION:-1.8.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+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=""
+ ARCHQUADLET=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+ ARCHQUADLET=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+ ARCHQUADLET=""
+elif [ "$ARCH" = "arm" ]; then
+ SLKCFLAGS="-O2 -march=armv4t"
+ LIBDIRSUFFIX=""
+ ARCHQUADLET="-gnueabi"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+ ARCHQUADLET=""
+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-proxy \
+ --with-mysql \
+ --with-net-snmp \
+ --with-libcurl \
+ --build=$ARCH-slackware-linux$ARCHQUADLET
+
+make
+make install DESTDIR=$PKG
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+# Database scripts
+mkdir -p $PKG/usr/share/$PRGNAM/{create,upgrades}
+cp -a create/schema \
+ $PKG/usr/share/$PRGNAM/create/
+cp -a upgrades/dbpatches \
+ $PKG/usr/share/$PRGNAM/upgrades/
+
+# 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=/tmp/,PidFile=/var/run/$PRGSHORT/," \
+ -e "s,# DBSocket=/tmp/,DBSocket=/var/run/mysql/," \
+ -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 CREDITS 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_proxy/zabbix_proxy.info b/network/zabbix_proxy/zabbix_proxy.info
new file mode 100644
index 0000000000000..4f03540de7715
--- /dev/null
+++ b/network/zabbix_proxy/zabbix_proxy.info
@@ -0,0 +1,10 @@
+PRGNAM="zabbix_proxy"
+VERSION="1.8.3"
+HOMEPAGE="http://www.zabbix.com"
+DOWNLOAD="http://downloads.sourceforge.net/zabbix/zabbix-1.8.3.tar.gz"
+MD5SUM="575c31880d73f6fe41e730874ebfc633"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+MAINTAINER="Niels Horn"
+EMAIL="niels.horn@gmail.com"
+APPROVED="dsomero"