Zabbix monitoring RPM
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
1.8 KiB

#!/bin/sh
7 years ago
#
# chkconfig: - 86 14
# description: Zabbix agent daemon
# processname: zabbix_agentd
# config: /etc/zabbix/zabbix_agentd.conf
7 years ago
#
### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: zabbix zabbix-proxy
# Should-Stop: zabbix zabbix-proxy
7 years ago
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix agent
# Description: Zabbix agent
7 years ago
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/sbin/zabbix_agentd ]; then
exec=/usr/sbin/zabbix_agentd
else
exit 5
fi
prog=${exec##*/}
conf=/etc/zabbix/zabbix_agentd.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
timeout=10
if [ -f /etc/sysconfig/zabbix-agent ]; then
. /etc/sysconfig/zabbix-agent
fi
if [ -n "$ZABBIX_AGENT_USER" ]; then
user_conf="--user=$ZABBIX_AGENT_USER"
else
user_conf=''
fi
lockfile=/var/lock/subsys/zabbix-agent
7 years ago
start()
{
echo -n $"Starting Zabbix agent: "
daemon $user_conf $exec -c $conf
rv=$?
echo
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
7 years ago
stop()
{
echo -n $"Shutting down Zabbix agent: "
killproc -p $pidfile -d $timeout $prog
rv=$?
echo
[ $rv -eq 0 ] && rm -f $lockfile
return $rv
}
7 years ago
restart()
{
stop
start
}
7 years ago
case "$1" in
start|stop|restart)
$1
7 years ago
;;
force-reload)
restart
7 years ago
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0##*/} does not support the reload action: " /bin/false
exit 3
7 years ago
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
7 years ago
;;
esac