|
From: <abe...@us...> - 2012-09-01 14:35:42
|
Revision: 5654
http://astlinux.svn.sourceforge.net/astlinux/?rev=5654&view=rev
Author: abelbeck
Date: 2012-09-01 14:35:35 +0000 (Sat, 01 Sep 2012)
Log Message:
-----------
zabbix, add ServerActive support for zabbix_agentd
Modified Paths:
--------------
branches/1.0/package/zabbix/zabbix.init
branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
Modified: branches/1.0/package/zabbix/zabbix.init
===================================================================
--- branches/1.0/package/zabbix/zabbix.init 2012-08-30 17:57:16 UTC (rev 5653)
+++ branches/1.0/package/zabbix/zabbix.init 2012-09-01 14:35:35 UTC (rev 5654)
@@ -2,8 +2,21 @@
. /etc/rc.conf
+. /etc/init.d/functions
+
+agent_addr_port()
+{
+ local addr="$1" port="$2"
+
+ get_numeric_ip_version "$addr"
+ if [ $? -eq 6 ]; then
+ addr="[${addr}]"
+ fi
+ echo "${addr}:${port}"
+}
+
init () {
- local server="" IFS
+ local server="" serveractive="" IFS
if [ -z "$ZABBIX_SERVER" ] && [ ! -f /mnt/kd/zabbix_agentd.conf ]; then
if [ -f /tmp/etc/zabbix_agentd.conf ]; then
@@ -29,21 +42,23 @@
fi
fi
+ serverport="${ZABBIX_SERVER_PORT:-10051}"
# Allow space/comma in ZABBIX_SERVER, but zabbix requires comma's
IFS=' ,'
for i in $ZABBIX_SERVER; do
server="$server${server:+,}$i"
+ serveractive="$serveractive${serveractive:+,}$(agent_addr_port $i $serverport)"
done
unset IFS
- serverport="${ZABBIX_SERVER_PORT:-10051}"
hostname="${ZABBIX_HOSTNAME:-$HOSTNAME}"
listenport="${ZABBIX_LISTENPORT:-10050}"
startagents="${ZABBIX_STARTAGENTS:-3}"
debuglevel="${ZABBIX_DEBUGLEVEL:-3}"
timeout="${ZABBIX_TIMEOUT:-3}"
+ proxyserver="$(echo $server | cut -d',' -f1)" # Only use first server for proxy
proxyhostname="${ZABBIX_PROXY_HOSTNAME:-proxy-$HOSTNAME}"
- proxylistenport=$(($listenport + 1))
+ proxylistenport="$serverport"
if [ $proxy_enabled -eq 1 ]; then
@@ -55,7 +70,7 @@
else
echo "# Autogenerated. Do not edit.
# A manually generated zabbix_proxy config will use /mnt/kd/zabbix_proxy.conf if it exists.
-Server=$server
+Server=$proxyserver
ServerPort=$serverport
Hostname=$proxyhostname
ListenPort=$proxylistenport
@@ -79,6 +94,7 @@
# Set zabbix_agentd server to localhost unless ZABBIX_PROXY_AGENT="no"
if [ "$ZABBIX_PROXY_AGENT" != "no" ]; then
server="127.0.0.1"
+ serveractive="127.0.0.1:${proxylistenport}"
fi
else
if [ -f /tmp/etc/zabbix_proxy.conf ]; then
@@ -95,6 +111,7 @@
echo "# Autogenerated. Do not edit.
# A manually generated zabbix_agentd config will use /mnt/kd/zabbix_agentd.conf if it exists.
Server=$server
+ServerActive=$serveractive
Hostname=$hostname
ListenPort=$listenport
StartAgents=$startagents
@@ -166,7 +183,7 @@
restart)
stop
- sleep 2
+ sleep 4 # wait longer for things to settle
start
;;
Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf
===================================================================
--- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2012-08-30 17:57:16 UTC (rev 5653)
+++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2012-09-01 14:35:35 UTC (rev 5654)
@@ -917,9 +917,9 @@
## Zabbix Agent Daemon
## Zabbix is enabled if ZABBIX_SERVER is defined.
#ZABBIX_SERVER="" # Comma/space separated list of IP addresses or hostnames for zabbix servers
-#ZABBIX_SERVER_PORT="10051" # TCP port used for retrieving/sending active check data (proxy-only)
+#ZABBIX_SERVER_PORT="10051" # TCP port used for retrieving/sending active check data
#ZABBIX_HOSTNAME="" # Unique, case sensitive hostname, required for active checks
-#ZABBIX_LISTENPORT="10050" # TCP port that zabbix_agentd listens on locally, proxy if enabled uses one port higher
+#ZABBIX_LISTENPORT="10050" # TCP port that zabbix_agentd listens on locally
#ZABBIX_STARTAGENTS="3" # Number of pre-forked instances of zabbix_agentd, must be between 1-16
#ZABBIX_DEBUGLEVEL="3" # "0" is no debug, "1" is critical, "2" is errors, "3" is warnings, "4" is full debugging
#ZABBIX_TIMEOUT="3" # Processing limit in seconds, must be between 1-30
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|