diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-08-12 13:21:02 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-08-12 15:05:13 +0000 |
commit | 966805d1e107151c1479109c7a36f863a706fdbe (patch) | |
tree | b809014be8773a134600480f547a849bee3e33b1 /testing/zabbix | |
parent | ef61dcbb6645443f0034d1479d07a34aa2ebe42b (diff) | |
download | aports-966805d1e107151c1479109c7a36f863a706fdbe.tar.bz2 aports-966805d1e107151c1479109c7a36f863a706fdbe.tar.xz |
testing/zabbix: added pre-install and init.d scripts
also build the agentd and proxy
ref #251
Diffstat (limited to 'testing/zabbix')
-rw-r--r-- | testing/zabbix/APKBUILD | 27 | ||||
-rw-r--r-- | testing/zabbix/zabbix-agentd.initd | 22 | ||||
-rw-r--r-- | testing/zabbix/zabbix-getloadavg.patch | 33 | ||||
-rw-r--r-- | testing/zabbix/zabbix-proxy.initd | 21 | ||||
-rw-r--r-- | testing/zabbix/zabbix-server.initd | 21 | ||||
-rw-r--r-- | testing/zabbix/zabbix.pre-install | 5 |
6 files changed, 123 insertions, 6 deletions
diff --git a/testing/zabbix/APKBUILD b/testing/zabbix/APKBUILD index 0091a35d5..480f424fe 100644 --- a/testing/zabbix/APKBUILD +++ b/testing/zabbix/APKBUILD @@ -2,13 +2,13 @@ # Maintainer: Natanael Copa <natanael.copa@gmail.com> pkgname=zabbix pkgver=1.8.2 -pkgrel=0 +pkgrel=1 pkgdesc="Enterprise-class open source distributed monitoring" url="www.zabbix.com" license="GPL" -depends="sqlite php php-sqlite3 php-gd fping" +depends="php php-sqlite3 php-gd fping" makedepends="sqlite-dev libiconv-dev" -install= +install="$pkgname.pre-install" pkgusers="zabbix" pkggroups="zabbix" subpackages="$pkgname-dev $pkgname-doc" @@ -17,6 +17,10 @@ source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz zabbix_trapper.conf zabbix_proxy.conf zabbix-dn_skipname.patch + zabbix-getloadavg.patch + zabbix-server.initd + zabbix-agentd.initd + zabbix-proxy.initd " _builddir="$srcdir"/$pkgname-$pkgver @@ -40,12 +44,15 @@ build() { --mandir=/usr/share/man \ --infodir=/usr/share/info \ --enable-server \ + --enable-agent \ + --enable-proxy \ + --enable-ipv6 \ --with-sqlite3 make || return 1 } package() { - local _wwwdir="$pkgdir"/usr/share/webapp/zabbix + local _wwwdir="$pkgdir"/usr/share/webapps/zabbix cd "$_builddir" make DESTDIR="$pkgdir" install @@ -57,11 +64,15 @@ package() { install -d -m0755 "$_wwwdir" install -D -m0640 "$srcdir"/zabbix_server.conf "$pkgdir"/etc/zabbix/zabbix_server.conf install -D -m0640 "$srcdir"/zabbix_trapper.conf "$pkgdir"/etc/zabbix/zabbix_trapper.conf -# install -D -m0755 "$srcdir"/zabbix-server.initd "$pkgdir"/etc/rc.d/zabbix-server install -D -m0755 "$srcdir"/zabbix-$pkgver/create/data/data.sql "$pkgdir"/usr/share/zabbix/dbms/create/data/data.sql install -D -m0755 "$srcdir"/zabbix-$pkgver/create/data/images_mysql.sql "$pkgdir"/usr/share/zabbix/dbms/create/data/images_mysql.sql install -D -m0755 "$srcdir"/zabbix-$pkgver/create/schema/mysql.sql "$pkgdir"/usr/share/zabbix/dbms/create/mysql.sql cp -r "$srcdir"/zabbix-$pkgver/frontends/php/* "$_wwwdir" + + for i in server proxy agentd; do + install -D -m0755 "$srcdir"/zabbix-$i.initd \ + "$pkgdir"/etc/init.d/zabbix-$i || return 1 + done } @@ -69,4 +80,8 @@ md5sums="fa4be4fa7ac20a33cc0aa5c27b827746 zabbix-1.8.2.tar.gz 26b0401a83bdb1dce29338e5b2786620 zabbix_server.conf 9832a81e134c8e2c11e2a06b7adbf88f zabbix_trapper.conf 0310b92afb3f35c1075fff53db737212 zabbix_proxy.conf -d13166483792401be2d25b37b0170b82 zabbix-dn_skipname.patch" +d13166483792401be2d25b37b0170b82 zabbix-dn_skipname.patch +8d1d2e53479173aac0df0c38a4d6afda zabbix-getloadavg.patch +e42394e798ab98a8ff4babe68e04633a zabbix-server.initd +88374bba8a8fdfabfcfe9be6dd12095f zabbix-agentd.initd +32abde1cc00c2eeccddb7e038117d0ab zabbix-proxy.initd" diff --git a/testing/zabbix/zabbix-agentd.initd b/testing/zabbix/zabbix-agentd.initd new file mode 100644 index 000000000..b14b5fe74 --- /dev/null +++ b/testing/zabbix/zabbix-agentd.initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/zabbix/files/1.6.6/init.d/zabbix-agentd,v 1.1 2009/10/05 15:55:23 patrick Exp $ + +depend() { + need net + provide zabbix-agent + use zabbix-server +} + +start() { + ebegin "Starting Zabbix agent" + start-stop-daemon --start -c zabbix:zabbix --exec /usr/sbin/zabbix_agentd + eend $? +} + +stop() { + ebegin "Stopping Zabbix agent" + start-stop-daemon --stop -u zabbix --pidfile /var/run/zabbix/zabbix_agentd.pid + eend $? +} diff --git a/testing/zabbix/zabbix-getloadavg.patch b/testing/zabbix/zabbix-getloadavg.patch new file mode 100644 index 000000000..44706abeb --- /dev/null +++ b/testing/zabbix/zabbix-getloadavg.patch @@ -0,0 +1,33 @@ +diff --git a/src/libs/zbxsysinfo/linux/cpu.c b/src/libs/zbxsysinfo/linux/cpu.c +index a76e756..9f9031d 100644 +--- a/src/libs/zbxsysinfo/linux/cpu.c ++++ b/src/libs/zbxsysinfo/linux/cpu.c +@@ -22,6 +22,28 @@ + #include "sysinfo.h" + #include "stats.h" + ++#ifndef HAVE_GETLOADAVG ++/*! \brief Alternative method of getting load avg on Linux only */ ++int getloadavg(double *list, int nelem) ++{ ++ FILE *LOADAVG; ++ double avg[3] = { 0.0, 0.0, 0.0 }; ++ int i, res = -1; ++ ++ if ((LOADAVG = fopen("/proc/loadavg", "r"))) { ++ fscanf(LOADAVG, "%lf %lf %lf", &avg[0], &avg[1], &avg[2]); ++ res = 0; ++ fclose(LOADAVG); ++ } ++ ++ for (i = 0; (i < nelem) && (i < 3); i++) { ++ list[i] = avg[i]; ++ } ++ ++ return res; ++} ++#endif ++ + int SYSTEM_CPU_NUM(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) + { + char mode[32]; diff --git a/testing/zabbix/zabbix-proxy.initd b/testing/zabbix/zabbix-proxy.initd new file mode 100644 index 000000000..8ac246ecc --- /dev/null +++ b/testing/zabbix/zabbix-proxy.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/zabbix/files/1.6.6/init.d/zabbix-proxy,v 1.1 2009/10/06 16:24:35 patrick Exp $ + +depend() { + need net + #use mysql postgresql +} + +start() { + ebegin "Starting Zabbix proxy" + start-stop-daemon --start -c zabbix:zabbix --exec /usr/sbin/zabbix_proxy + eend $? +} + +stop() { + ebegin "Stopping Zabbix proxy" + start-stop-daemon --stop -u zabbix --pidfile /var/run/zabbix/zabbix_proxy.pid + eend $? +} diff --git a/testing/zabbix/zabbix-server.initd b/testing/zabbix/zabbix-server.initd new file mode 100644 index 000000000..a661cd233 --- /dev/null +++ b/testing/zabbix/zabbix-server.initd @@ -0,0 +1,21 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/zabbix/files/1.6.6/init.d/zabbix-server,v 1.1 2009/10/05 15:55:23 patrick Exp $ + +depend() { + need net + use mysql postgresql +} + +start() { + ebegin "Starting Zabbix server" + start-stop-daemon --start -c zabbix:zabbix --exec /usr/sbin/zabbix_server + eend $? +} + +stop() { + ebegin "Stopping Zabbix server" + start-stop-daemon --stop -u zabbix --pidfile /var/run/zabbix/zabbix_server.pid + eend $? +} diff --git a/testing/zabbix/zabbix.pre-install b/testing/zabbix/zabbix.pre-install new file mode 100644 index 000000000..8a9e5193c --- /dev/null +++ b/testing/zabbix/zabbix.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +addgroup zabbix 2>/dev/null +adduser -S -H -h /dev/null -s /bin/false -D -G zabbix zabbix 2>/dev/null +exit 0 |