Add zabix agent configuration and init script (#3936)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@12749 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2008-09-28 06:43:14 +00:00
parent 369e4b96fd
commit 5f5ee085e2
3 changed files with 145 additions and 1 deletions

View File

@ -79,7 +79,45 @@ define Package/zabbix-agent/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/zabbix_agentd $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/etc/zabbix
$(INSTALL_CONF) $(PKG_BUILD_DIR)/misc/conf/zabbix_agentd.conf $(1)/etc/zabbix/
$(INSTALL_CONF) ./files/zabbix_agentd.conf $(1)/etc/zabbix/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/zabbix_agentd.init $(1)/etc/init.d/zabbix_agentd
endef
define Package/zabbix-agent/postinst
#!/bin/sh
name=zabbix
id=53
# do not change below
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
# create copies of passwd and group, if we use squashfs
rootfs=`mount |awk '/root/ { print $$5 }'`
if [ "$$rootfs" = "squashfs" ]; then
if [ -h /etc/group ]; then
rm /etc/group
cp /rom/etc/group /etc/group
fi
if [ -h /etc/passwd ]; then
rm /etc/passwd
cp /rom/etc/passwd /etc/passwd
fi
fi
fi
echo ""
if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
echo "adding group $$name to /etc/group"
echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
fi
if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
echo "adding user $$name to /etc/passwd"
echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
fi
endef
define Package/zabbix-sender/install

View File

@ -0,0 +1,85 @@
# 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
#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.
#DisableActive=1
# Enable remote commands for ZABBIX agent. By default remote commands disabled.
#EnableRemoteCommands=1
# Specifies debug level
# 0 - debug is not created
# 1 - critical information
# 2 - error information
# 3 - warnings
# 4 - information (default)
# 5 - for debugging (produces lots of information)
DebugLevel=3
# Name of PID file
PidFile=/tmp/zabbix_agentd.pid
# Name of log file.
# If not set, syslog will be used
LogFile=/tmp/zabbix_agentd.log
# Spend no more than Timeout seconds on processing
# Must be between 1 and 30
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

View File

@ -0,0 +1,21 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2008 OpenWrt.org
START=60
start() {
[ -f /etc/zabbix/zabbix_agentd.conf ] || {
echo "/etc/zabbix/zabbix_agentd.conf does not exist !";
exit 0;
};
[ -x /usr/sbin/zabbix_agentd ] && /usr/sbin/zabbix_agentd
}
stop() {
killall zabbix_agentd
}
restart() {
stop
sleep 1
start
}