diff options
author | zux <zux@pie-dabas.net> | 2018-10-01 23:21:53 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2018-10-06 07:25:16 +0700 |
commit | 4fd7167892293e59b23aab7d5fae3fe6100366ea (patch) | |
tree | 9e3657f0befb19b52ed0851295b13f88b385c8cd /network/zabbix_java_gateway | |
parent | 9e566e74ec577e2cf1cf2dd265665676e348a9cb (diff) | |
download | slackbuilds-4fd7167892293e59b23aab7d5fae3fe6100366ea.tar.gz |
network/zabbix_java_gateway: Added (distributed monitoring).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/zabbix_java_gateway')
-rw-r--r-- | network/zabbix_java_gateway/README | 14 | ||||
-rw-r--r-- | network/zabbix_java_gateway/README.SLACKWARE | 72 | ||||
-rw-r--r-- | network/zabbix_java_gateway/doinst.sh | 28 | ||||
-rw-r--r-- | network/zabbix_java_gateway/rc.zabbix_java_gateway | 79 | ||||
-rw-r--r-- | network/zabbix_java_gateway/slack-desc | 19 | ||||
-rw-r--r-- | network/zabbix_java_gateway/zabbix_java_gateway | 78 | ||||
-rw-r--r-- | network/zabbix_java_gateway/zabbix_java_gateway.SlackBuild | 147 | ||||
-rw-r--r-- | network/zabbix_java_gateway/zabbix_java_gateway.info | 10 | ||||
-rw-r--r-- | network/zabbix_java_gateway/zabbix_java_gateway_logback.xml | 27 |
9 files changed, 474 insertions, 0 deletions
diff --git a/network/zabbix_java_gateway/README b/network/zabbix_java_gateway/README new file mode 100644 index 0000000000..b4a92e1ad9 --- /dev/null +++ b/network/zabbix_java_gateway/README @@ -0,0 +1,14 @@ +Zabbix offers advanced monitoring, alerting and visualization features, +including distributed monitoring, auto-discovery, notifications, etcetera. + +zabbix_java_gateway 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_java_gateway/README.SLACKWARE b/network/zabbix_java_gateway/README.SLACKWARE new file mode 100644 index 0000000000..335e9a1ccd --- /dev/null +++ b/network/zabbix_java_gateway/README.SLACKWARE @@ -0,0 +1,72 @@ +README.Slackware +================ + +This file contains some specific instructions to complete the +installation of zabbix_java_gateway on Slackware. + +zabbix_java_gateway can run on the same host as zabbix_server, or not. + +0) Before running the SlackBuild script +--------------------------------------- + +0.1) zabbix group & user + +Before running the zabbix_java_gateway.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_java_gateway +---------------------------------- + +Very complete documentation is available online at: + https://www.zabbix.com/documentation/ + +For those in a hurry, here are some basic steps to get zabbix up & +running: + +1.4) zabbix_java_gateway configuration file + +A standard configuration file is installed as /etc/zabbix/zabbix_java_gateway.conf + +You will need to change at least the following lines: + +2) Start & Stop scripts for zabbix java gateway +----------------------------------------------- + +2.1) Automatic startup and shutdown + +If you want to start zabbix_java_gateway on system bootup, include these lines in +your /etc/rc.d/rc.local: + + # Start zabbix_server + if [ -x /etc/rc.d/rc.zabbix_java_gateway ]; then + echo "Starting zabbix java gateway..." + /etc/rc.d/rc.zabbix_java_gateway start + fi + +To guarantee a clean shutdown of zabbix_java_gateway, include this in +/etc/rc.d/rc.local_shutdown: + + # Stop zabbix_server + if [ -x /etc/rc.d/rc.zabbix_java_gateway ]; then + echo "Stopping zabbix java gateway..." + /etc/rc.d/rc.zabbix_java_gateway stop + fi + +2.2) Make /etc/rc.d/rc.zabbix_java_gateway 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_java_gateway + +3) Starting zabbix server +------------------------- + +Now you are ready to start zabbix_server by calling the startup script: + + # /etc/rc.d/rc.zabbix_java_gateway start diff --git a/network/zabbix_java_gateway/doinst.sh b/network/zabbix_java_gateway/doinst.sh new file mode 100644 index 0000000000..3a796df921 --- /dev/null +++ b/network/zabbix_java_gateway/doinst.sh @@ -0,0 +1,28 @@ +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... +} + +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.zabbix_java_gateway.new +config etc/zabbix/zabbix_java_gateway.conf.new +config var/log/zabbix/zabbix_java_gateway.log.new +rm -f var/log/zabbix/zabbix_java_gateway.log.new diff --git a/network/zabbix_java_gateway/rc.zabbix_java_gateway b/network/zabbix_java_gateway/rc.zabbix_java_gateway new file mode 100644 index 0000000000..ac65aad421 --- /dev/null +++ b/network/zabbix_java_gateway/rc.zabbix_java_gateway @@ -0,0 +1,79 @@ +#!/bin/sh + +# Usage: ./rc.zabbix_java_gateway {start|stop|restart} + +PRGNAM=zabbix_java_gateway +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 + mkdir -p ${PIDDIR} + ${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 + kill `cat /var/run/zabbix/$PRGNAM.pid` + # 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 "Usage: $(basename $0) {start|stop|restart }" + RETVAL=1 +esac + +exit $RETVAL +#EOF diff --git a/network/zabbix_java_gateway/slack-desc b/network/zabbix_java_gateway/slack-desc new file mode 100644 index 0000000000..822bf8dd9c --- /dev/null +++ b/network/zabbix_java_gateway/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 ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +zabbix_java_gateway: zabbix_java_gateway (enterprise-class distributed monitoring solution) +zabbix_java_gateway: +zabbix_java_gateway: Zabbix offers advanced monitoring, alerting and visualization +zabbix_java_gateway: features, including distributed monitoring, auto-discovery, +zabbix_java_gateway: notifications etc. +zabbix_java_gateway: +zabbix_java_gateway: https://www.zabbix.com/ +zabbix_java_gateway: +zabbix_java_gateway: +zabbix_java_gateway: +zabbix_java_gateway: diff --git a/network/zabbix_java_gateway/zabbix_java_gateway b/network/zabbix_java_gateway/zabbix_java_gateway new file mode 100644 index 0000000000..42afce77b4 --- /dev/null +++ b/network/zabbix_java_gateway/zabbix_java_gateway @@ -0,0 +1,78 @@ +#!/bin/bash + +if [ -r /etc/zabbix/zabbix_java_gateway.conf ]; then + . /etc/zabbix/zabbix_java_gateway.conf +fi + +if [ -z $GATEWAY_HOME ]; then + GATEWAY_HOME="/usr/sbin/zabbix_java" +fi + +if [ -n "$PID_FILE" -a -f "$PID_FILE" ]; then + PID=`cat "$PID_FILE"` + if ps -p "$PID" > /dev/null 2>&1; then + echo "Zabbix Java Gateway is already running" + exit 1 + fi + rm -f "$PID_FILE" +fi + +JAVA=${JAVA:-java} +JAVA_OPTIONS="-server $JAVA_OPTIONS" +JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml" + +cd $GATEWAY_HOME + +CLASSPATH="lib" +for jar in lib/*.jar bin/*.jar; do + CLASSPATH="$CLASSPATH:$jar" +done + +if [ -n "$PID_FILE" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.pidFile=$PID_FILE" +fi +if [ -n "$LISTEN_IP" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$LISTEN_IP" +fi +if [ -n "$LISTEN_PORT" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$LISTEN_PORT" +fi +if [ -n "$START_POLLERS" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$START_POLLERS" +fi +if [ -n "$TIMEOUT" ]; then + ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$TIMEOUT -Dsun.rmi.transport.tcp.responseTimeout=${TIMEOUT}000" +fi + +COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway" + +if [ -n "$PID_FILE" ]; then + + # check that the PID file can be created + + touch "$PID_FILE" + if [ $? -ne 0 ]; then + echo "Zabbix Java Gateway did not start: cannot create PID file" + exit 1 + fi + + # start the gateway and output pretty errors to the console + + STDOUT=`$COMMAND_LINE & echo $! > "$PID_FILE"` + if [ -n "$STDOUT" ]; then + echo "$STDOUT" + fi + + # verify that the gateway started successfully + + PID=`cat "$PID_FILE"` + ps -p "$PID" > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Zabbix Java Gateway did not start" + rm -f "$PID_FILE" + exit 1 + fi + +else + exec $COMMAND_LINE +fi diff --git a/network/zabbix_java_gateway/zabbix_java_gateway.SlackBuild b/network/zabbix_java_gateway/zabbix_java_gateway.SlackBuild new file mode 100644 index 0000000000..96f4d18672 --- /dev/null +++ b/network/zabbix_java_gateway/zabbix_java_gateway.SlackBuild @@ -0,0 +1,147 @@ +#!/bin/sh + +# Slackware build script for zabbix_server + +# Copyright 2013-2014 Michal Bialozor, Gdansk, Pomorskie, POLAND +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=zabbix_java_gateway +VERSION=${VERSION:-3.4.14} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +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 https://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." + echo " # groupadd -g $ZABBIXGID $ZABBIXGROUP" + echo " # useradd -u $ZABBIXUID -g $ZABBIXGROUP -d /dev/null -s /bin/false $ZABBIXUSER" + exit 1 +fi + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +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 -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc/zabbix \ + --datadir=/etc \ + --localstatedir=/var/lib \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --enable-java \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "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 +chmod g+w $PKG/var/log/$PRGSHORT + +# 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/ +sed -e "s,PID_FILE=\"/tmp/zabbix_java.pid\",PID_FILE=/var/run/$PRGSHORT/$PRGNAM.pid," \ + $PKG/usr/sbin/zabbix_java/settings.sh > $PKG/etc/$PRGSHORT/$PRGNAM.conf.new +cp $CWD/zabbix_java_gateway_logback.xml $PKG/etc/$PRGSHORT/ +rm -f $PKG/usr/sbin/zabbix_java/settings.sh + +# Init script +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new +cp $CWD/$PRGNAM $PKG/usr/sbin/$PRGNAM + +# Documentation +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +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 + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/zabbix_java_gateway/zabbix_java_gateway.info b/network/zabbix_java_gateway/zabbix_java_gateway.info new file mode 100644 index 0000000000..c57ad0c737 --- /dev/null +++ b/network/zabbix_java_gateway/zabbix_java_gateway.info @@ -0,0 +1,10 @@ +PRGNAM="zabbix_java_gateway" +VERSION="3.4.14" +HOMEPAGE="https://www.zabbix.com" +DOWNLOAD="https://downloads.sourceforge.net/zabbix/zabbix-3.4.14.tar.gz" +MD5SUM="16cdacf7198538c0456523d75bb149c7" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="iksemel jdk" +MAINTAINER="zux" +EMAIL="zux@pie-dabas.net" diff --git a/network/zabbix_java_gateway/zabbix_java_gateway_logback.xml b/network/zabbix_java_gateway/zabbix_java_gateway_logback.xml new file mode 100644 index 0000000000..2560f74468 --- /dev/null +++ b/network/zabbix_java_gateway/zabbix_java_gateway_logback.xml @@ -0,0 +1,27 @@ +<configuration scan="true" scanPeriod="15 seconds"> + + <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> + + <file>/var/log/zabbix/zabbix_java_gateway.log</file> + + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>/var/log/zabbix/zabbix_java_gateway.log.%i</fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>3</maxIndex> + </rollingPolicy> + + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + + <encoder> + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> + </encoder> + + </appender> + + <root level="info"> + <appender-ref ref="FILE" /> + </root> + +</configuration> |