Zabbix Agent init script

Zabbix Agent init script for Debian with config argument:

More info: Zabbix Website
Manual: Zabbix Manual

Download the file here: zabbix_agent

Enable automatic start/stop of Zabbix Agent:
update-rc.d zabbix-agent defaults

#! /bin/bash
#
# Zabbix agent start/stop script
# Adjusted: Remo Staeuble
# Date: 15.11.2012
# Version: 2.0.3
# Copyright (C) 2000-2012 Zabbix SIA
#
# To get more information about Zabbix visit http://www.zabbix.com
# ####################################################################
#
### BEGIN INIT INFO
# Provides: zabbix_agentd
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $time $network $syslog iptables firehol shorewall ipmasq arno-iptables-firewall
# Should-Stop: $network $syslog iptables firehol shorewall ipmasq arno-iptables-firewall
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop Zabbix Agent
# Description: Start/stop Zabbix Agent
### END INIT INFO

NAME=zabbix_agentd
DAEMON=/usr/local/sbin/${NAME}
CONFIG=/etc/zabbix/zabbix_agent.conf
DESC=”Zabbix agent daemon”
PID=/var/run/zabbix/$NAME.pid

test -f $DAEMON || exit 0

case “$1” in
start)
echo “Starting $DESC: $NAME with config from $CONFIG”
start-stop-daemon –start –oknodo –pidfile $PID –exec $DAEMON — -c $CONFIG
;;
stop)
echo “Stopping $DESC: $NAME”
start-stop-daemon –stop –quiet –pidfile $PID –retry=TERM/10/KILL/5 && return 0
start-stop-daemon –stop –oknodo –exec $DAEMON –name $NAME –retry=TERM/10/KILL/5
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
echo “Usage: $N {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

exit 0

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected by WP Anti Spam