zabbix_agentd: initial import

This commit is contained in:
Mikhail Kolesnik 2006-10-28 23:29:12 +03:00
parent b3e4892d14
commit 2e317cfb9b
7 changed files with 215 additions and 0 deletions

13
zabbix_agentd/.footprint Normal file
View File

@ -0,0 +1,13 @@
drwxr-xr-x root/root etc/
drwxr-xr-x root/root etc/rc.d/
-rwxr-xr-x root/root etc/rc.d/zabbix_agentd
drwxr-xr-x root/root etc/zabbix/
-rw-r--r-- root/root etc/zabbix/zabbix_agentd.conf
drwxr-xr-x root/root usr/
drwxr-xr-x root/root usr/bin/
-rwxr-xr-x root/root usr/bin/zabbix_agentd
drwxr-xr-x root/root var/
drwxr-xr-x root/root var/log/
-rw------- daemon/daemon var/log/zabbix_agentd.log (EMPTY)
drwxr-xr-x root/root var/run/
drwxr-xr-x daemon/daemon var/run/zabbix_agentd/

3
zabbix_agentd/.md5sum Normal file
View File

@ -0,0 +1,3 @@
a4cb17ac443050ab7014e4b9c7895892 zabbix-1.1.3.tar.gz
d045d678625b21360fdb479166929f26 zabbix_agentd
39332900705c928549b95e3dfd124934 zabbix_agentd.conf

24
zabbix_agentd/Pkgfile Normal file
View File

@ -0,0 +1,24 @@
# Description: zabbix agentd
# URL: http://www.zabbix.com
# Maintainer: mike at openbunker dot org
# Depends on:
name=zabbix_agentd
version=1.1.3
release=1
source=(http://dl.sourceforge.net/sourceforge/zabbix/zabbix-$version.tar.gz \
zabbix_agentd.conf zabbix_agentd)
build() {
cd zabbix-$version
./configure --prefix=/usr \
--enable-agent
make
mkdir -p $PKG/{var/log,var/run/zabbix_agentd,usr/bin}
chown daemon:daemon $PKG/var/run/zabbix_agentd
touch zabbix_agentd.log
install -m 600 -o daemon -g daemon zabbix_agentd.log $PKG/var/log
install -m 755 src/zabbix_agent/zabbix_agentd $PKG/usr/bin
install -D -m 644 $SRC/zabbix_agentd.conf $PKG/etc/zabbix/zabbix_agentd.conf
install -D -m 755 $SRC/zabbix_agentd $PKG/etc/rc.d/zabbix_agentd
}

20
zabbix_agentd/README Normal file
View File

@ -0,0 +1,20 @@
README for zabbix agent daemon
REQUIREMENTS
PRE-INSTALL
This port include zabbix_agentd. For other apps see my zabbix_agents port.
Do not combine zabbix_agentd with zabbix_agents and zabbix_server with
zabbix_agents ports.
POST-INSTALL
1. Change Hostname, ListenIP and Server in /etc/zabbix_agentd.conf to something useful.
2. On the client (monitored) machines, you may add the following lines to
/etc/services:
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
3. Run post-install to create dedicated user for the agent instead of 'daemon'.
RESOURCES

48
zabbix_agentd/post-install Executable file
View File

@ -0,0 +1,48 @@
#!/bin/sh
#
# - add $ADD_USER user, $ADD_GROUP group
# - change files permissions
# - reflect changes in config
#
# We'll assume 'passwd', 'group' and 'shadow' files are in sync.
ADD_GID=70
ADD_UID=70
ADD_USER=zbxagent
ADD_USER_HOME=/var/empty
ADD_USER_SHELL=/bin/bash
ADD_GROUP=zbxagent
ADD_STATUS=0
if [ -z `getent group | gawk -F: '{ print $1 }' | grep ^$ADD_GROUP$` ]; then
while [ `getent group | gawk -F: '{ print $3 }' | grep ^$ADD_GID$` ]
do
let ADD_GID+=1
done
/usr/sbin/groupadd -g $ADD_GID $ADD_GROUP || exit 1
echo "$0: Created $ADD_GROUP group, GID=$ADD_GID"
else
echo "$0: $ADD_GROUP group already exists, trying to create user..."
fi
if [ -z `getent passwd | gawk -F: '{ print $1 }' | grep ^$ADD_USER$` ]; then
while [ `getent passwd | gawk -F: '{ print $3 }' | grep ^$ADD_UID$` ]
do
let ADD_UID+=1
done
/usr/sbin/useradd -d $ADD_USER_HOME -s $ADD_USER_SHELL -u $ADD_UID -g $ADD_GROUP $ADD_USER || exit 1
echo "$0: Created $ADD_USER user, UID=$ADD_UID"
else
echo "$0: $ADD_USER user already exists"
if [[ `getent passwd | grep ^$ADD_USER: | gawk -F: '{ print $4 }'` != `getent group | grep ^$ADD_GROUP: | gawk -F: '{ print $3 }'` ]]; then
echo "$0: existing $ADD_USER user is not in $ADD_GROUP group (fix it by hand)."
ADD_STAUS=2
fi
fi
# additional
chown $ADD_USER:$ADD_GROUP /var/log/zabbix_agentd.log
chown $ADD_USER:$ADD_GROUP /var/run/zabbix_agentd
sed -i s/"su\ daemon\ \-c\ \/usr\/bin\/zabbix_agentd$"/"su\ $ADD_USER\ \-c\ \/usr\/bin\/zabbix_agentd"/ /etc/rc.d/zabbix_agentd
exit $ADD_STATUS

View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# /etc/rc.d/zabbix_agentd: start/stop zabbix agent daemon
#
case $1 in
start)
su daemon -c /usr/bin/zabbix_agentd
;;
stop)
killall -q /usr/bin/zabbix_agentd
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 [start|stop|restart]"
;;
esac
# End of file

View File

@ -0,0 +1,84 @@
# This is config file for zabbix_agentd
# To get more information about ZABBIX, go http://www.zabbix.com
############ GENERAL PARAMETERS #################
# List of comma delimited IP addresses (or hostnames) of ZABBIX servers.
# No spaces allowed. First entry is used for sending active checks.
# Note that hostnames must resolve hostname->IP address and
# IP address->hostname.
#
Server=127.0.0.1
# Server port for sending active checks. Default is 10051
#
#ServerPort=10051
# Unique hostname. Required for active checks.
#
Hostname=localhost
# Listen port. Default is 10050
#
#ListenPort=10050
# IP address to bind agent
# If missing, bind to all available IPs
#
ListenIP=127.0.0.1
# Number of pre-forked instances of zabbix_agentd.
# Default value is 5
# This parameter must be between 1 and 16
#
#StartAgents=5
# How often refresh list of active checks. 2 minutes by default.
#
#RefreshActiveChecks=120
# Disable active checks. The agent will work in passive mode listening server.
# Default is 0
#
#DisableActive=1
# Enable remote commands for ZABBIX agent. By default remote commands are disabled.
#
#EnableRemoteCommands=1
# Specifies debug level
# 0 - debug is not created
# 1 - critical information
# 2 - error information
# 3 - warnings (default)
# 4 - for debugging (produces lots of information)
#
#DebugLevel=3
# Name of PID file
#
PidFile=/var/run/zabbix_agentd/zabbix_agentd.pid
# Name of log file.
# If not set, syslog will be used
#
LogFile=/var/log/zabbix_agentd.log
# Spend no more than Timeout seconds on processing
# Must be between 1 and 30. Default is 3
#
#Timeout=3
####### USER-DEFINED MONITORED PARAMETERS #######
# Format: UserParameter=<key>,<shell command>
# Note that shell command must not return empty string or EOL only
#UserParameter=system.test,who|wc -l
### Set of parameter for monitoring MySQL server (v3.23.42 and later)
### Change -u<username> and add -p<password> if required
#UserParameter=mysql.ping,mysqladmin -uroot ping|grep alive|wc -l
#UserParameter=mysql.uptime,mysqladmin -uroot status|cut -f2 -d":"|cut -f1 -d"T"
#UserParameter=mysql.threads,mysqladmin -uroot status|cut -f3 -d":"|cut -f1 -d"Q"
#UserParameter=mysql.questions,mysqladmin -uroot status|cut -f4 -d":"|cut -f1 -d"S"
#UserParameter=mysql.slowqueries,mysqladmin -uroot status|cut -f5 -d":"|cut -f1 -d"O"
#UserParameter=mysql.qps,mysqladmin -uroot status|cut -f9 -d":"
#UserParameter=mysql.version,mysql -V