diff options
author | Niels Horn <niels.horn@gmail.com> | 2010-05-13 01:00:27 +0200 |
---|---|---|
committer | Erik Hanson <erik@slackbuilds.org> | 2010-05-13 01:00:27 +0200 |
commit | 6c4ec6e689ca33b6e8026211a5f847cffe655ded (patch) | |
tree | a0e29f4ef186edc9ca8feb0c559ce7e5520feea1 /network/zabbix_server | |
parent | cc817703debc23860b74bac3abcc53f93dde6de0 (diff) |
network/zabbix_server: Added to 13.0 repository
Diffstat (limited to 'network/zabbix_server')
-rw-r--r-- | network/zabbix_server/README | 14 | ||||
-rw-r--r-- | network/zabbix_server/README.SLACKWARE | 131 | ||||
-rw-r--r-- | network/zabbix_server/doinst.sh | 24 | ||||
-rw-r--r-- | network/zabbix_server/rc.zabbix_server | 79 | ||||
-rw-r--r-- | network/zabbix_server/slack-desc | 19 | ||||
-rw-r--r-- | network/zabbix_server/zabbix_server.SlackBuild | 136 | ||||
-rw-r--r-- | network/zabbix_server/zabbix_server.info | 10 |
7 files changed, 413 insertions, 0 deletions
diff --git a/network/zabbix_server/README b/network/zabbix_server/README new file mode 100644 index 0000000000000..25d033303ec31 --- /dev/null +++ b/network/zabbix_server/README @@ -0,0 +1,14 @@ +Zabbix offers advanced monitoring, alerting and visualization features, +including distributed monitoring, auto-discovery, notifications, etcetera. + +zabbix_server 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_server/README.SLACKWARE b/network/zabbix_server/README.SLACKWARE new file mode 100644 index 0000000000000..c2865e8fbb845 --- /dev/null +++ b/network/zabbix_server/README.SLACKWARE @@ -0,0 +1,131 @@ +README.Slackware +================ + +This file contains some specific instructions to complete the +installation of zabbix_server on Slackware. + +You will need to have a working installation of httpd and MySQL (*) for +zabbix_server to run. MySQL server does not have to be on the same box as your +zabbix_server, but they need to be able to communicate and you will need at +least the MySQL client on the box that will run zabbix_server. + +(*) 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_server.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_server +---------------------------- + +A very complete (320 pages) PDF manual is included and installed in +the /usr/doc/zabbix_server-<version>/ directory. +For those in a hurry, here are some basic steps to get zabbix 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; + mysql> use mysql; + mysql> grant all on zabbix.* to zabbix@<your_zabbix_server> 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_server>) + +On your zabbix server, connect to the new database: + + # cd /usr/share/zabbix_server/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> source data/data.sql; + mysql> source data/images_mysql.sql; + mysql> quit + +1.2) Configure PHP + +zabbix requires some parameters in /etc/httpd/php.ini to be altered: + + - date.timezone Needs to be set (default = blank) + - max_execution_time = 300 Default = 30 + +After changing the php.ini file, you'll need to restart httpd for the +changes to have effect: + + # /etc/rc.d/rc.httpd restart + +1.3) zabbix_server configuration file + +A standard configuration file is installed as /etc/zabbix/zabbix_server.conf + +You will need to change at least the following lines: + + 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_server on system bootup, include these lines in +your /etc/rc.d/rc.local: + + # Start zabbix_server + if [ -x /etc/rc.d/rc.zabbix_server ]; then + echo "Starting zabbix server..." + /etc/rc.d/rc.zabbix_server start + fi + +To guarantee a clean shutdown of zabbix_server, include this in +/etc/rc.d/rc.local_shutdown: + + # Stop zabbix_server + if [ -x /etc/rc.d/rc.zabbix_server ]; then + echo "Stopping zabbix server..." + /etc/rc.d/rc.zabbix_server stop + fi + +2.2) Make /etc/rc.d/rc.zabbix_server 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_server + +4) Starting zabbix server +------------------------- + +Now you are ready to start zabbix_server by calling the startup script: + + # /etc/rc.d/rc.zabbix_server start + +Once zabbix_server has started and configured correctly, you should be able +to access it by pointing your browser at: + + http://(ip-of-your-zabbix-server)/zabbix/ + +From here on, you can follow the manual to start the initial configuration +and set up all the items to monitor. diff --git a/network/zabbix_server/doinst.sh b/network/zabbix_server/doinst.sh new file mode 100644 index 0000000000000..c7d39be880785 --- /dev/null +++ b/network/zabbix_server/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_server.new: +if [ -e etc/rc.d/rc.zabbix_server ]; then + cp -a etc/rc.d/rc.zabbix_server etc/rc.d/rc.zabbix_server.new.incoming + cat etc/rc.d/rc.zabbix_server.new > etc/rc.d/rc.zabbix_server.new.incoming + mv etc/rc.d/rc.zabbix_server.new.incoming etc/rc.d/rc.zabbix_server.new +fi + +config etc/rc.d/rc.zabbix_server.new +config etc/zabbix/zabbix_server.conf.new +config var/log/zabbix/zabbix_server.log.new +rm -f var/log/zabbix/zabbix_server.log.new + diff --git a/network/zabbix_server/rc.zabbix_server b/network/zabbix_server/rc.zabbix_server new file mode 100644 index 0000000000000..5a900ca1e8005 --- /dev/null +++ b/network/zabbix_server/rc.zabbix_server @@ -0,0 +1,79 @@ +#!/bin/sh + +# usage: ./rc.zabbix_server { start | stop | restart } + +PRGNAM=zabbix_server +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_server/slack-desc b/network/zabbix_server/slack-desc new file mode 100644 index 0000000000000..a42b63d7de36d --- /dev/null +++ b/network/zabbix_server/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_server: zabbix_server (enterprise-class distributed monitoring solution) +zabbix_server: +zabbix_server: Zabbix offers advanced monitoring, alerting and visualization +zabbix_server: features, including distributed monitoring, auto-discovery, +zabbix_server: notifications etc. +zabbix_server: +zabbix_server: http://www.zabbix.com/ +zabbix_server: +zabbix_server: +zabbix_server: +zabbix_server: diff --git a/network/zabbix_server/zabbix_server.SlackBuild b/network/zabbix_server/zabbix_server.SlackBuild new file mode 100644 index 0000000000000..fc4b944622532 --- /dev/null +++ b/network/zabbix_server/zabbix_server.SlackBuild @@ -0,0 +1,136 @@ +#!/bin/sh + +# Slackware build script for zabbix_server +# maintained by Niels Horn <niels.horn@gmail.com> +# revision date 2010-01-27 + +PRGNAM=zabbix_server +VERSION=1.8.1 +ARCH=${ARCH:-i486} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +PRGSHORT=zabbix + +DOCROOT=${DOCROOT:-/var/www/htdocs} +PHPUSER=${PHPUSER:-root} +PHPGROUP=${PHPGROUP:-apache} + +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-server \ + --with-mysql \ + --with-net-snmp \ + --with-libcurl \ + --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 +) + +# Install "frontend" to $DOCROOT/zabbix +mkdir -p $PKG/$DOCROOT/$PRGSHORT +cp -a frontends/php/* \ + $PKG/$DOCROOT/$PRGSHORT/ +chown -R $PHPUSER:$PHPGROUP $PKG/$DOCROOT/$PRGSHORT + +# Database scripts +mkdir -p $PKG/usr/share/$PRGNAM/{create,upgrades} +cp -a create/data 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=/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 docs/* \ + $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_server/zabbix_server.info b/network/zabbix_server/zabbix_server.info new file mode 100644 index 0000000000000..0a27aaac10ebf --- /dev/null +++ b/network/zabbix_server/zabbix_server.info @@ -0,0 +1,10 @@ +PRGNAM="zabbix_server" +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" |