summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/mrtg/APKBUILD34
-rw-r--r--main/mrtg/mrtg.confd17
-rw-r--r--main/mrtg/mrtg.initd53
3 files changed, 104 insertions, 0 deletions
diff --git a/main/mrtg/APKBUILD b/main/mrtg/APKBUILD
new file mode 100644
index 000000000..9334db7a4
--- /dev/null
+++ b/main/mrtg/APKBUILD
@@ -0,0 +1,34 @@
+# Contributor: Jeff Bilyk<jbilyk at gmail>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mrtg
+pkgver=2.16.4
+pkgrel=1
+pkgdesc="MRTG Network Latency Monitoring"
+url="http://oss.oetiker.ch/mrtg/"
+source="http://oss.oetiker.ch/mrtg/pub/$pkgname-$pkgver.tar.gz
+ mrtg.initd mrtg.confd"
+subpackages="$pkgname-doc"
+depends="perl"
+makedepends="gd-dev libpng-dev zlib-dev"
+license="GPL"
+
+_builddir="$srcdir"/$pkgname-$pkgver
+
+build() {
+ cd "$_builddir"
+ ./configure --bindir=/usr/bin \
+ --libdir=/usr/lib \
+ --datadir=/usr/share/doc \
+ --mandir=/usr/share/doc/man \
+ || return 1
+ make
+}
+
+package() {
+ cd "$_builddir"
+ make install DESTDIR="$pkgdir"
+}
+
+md5sums="ec298200d239832ff1648fba488e1a9e mrtg-2.16.4.tar.gz
+47053d5e51ac8eefe3807d5168219f78 mrtg.initd
+a8d246d324b90fd1e37cc912d4651372 mrtg.confd"
diff --git a/main/mrtg/mrtg.confd b/main/mrtg/mrtg.confd
new file mode 100644
index 000000000..f3be157ba
--- /dev/null
+++ b/main/mrtg/mrtg.confd
@@ -0,0 +1,17 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mrtg/files/mrtg.confd,v 1.1 2005/01/26 10:35:05 ka0ttic Exp $
+
+MRTG_CONF="/etc/mrtg.conf"
+MRTG_PID="/var/run/mrtg.pid"
+
+# uncomment and set the following, if you'd like to run mrtg as a
+# different user/group
+#MRTG_USER=""
+#MRTG_GROUP=""
+
+# uncomment if you'd like to enable logging
+#MRTG_LOG="/var/log/mrtg.log"
+
+# set any extra options here
+MRTG_OPTS=""
diff --git a/main/mrtg/mrtg.initd b/main/mrtg/mrtg.initd
new file mode 100644
index 000000000..31adb2cf0
--- /dev/null
+++ b/main/mrtg/mrtg.initd
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/mrtg/files/mrtg.rc,v 1.7 2007/04/19 19:08:08 cedk Exp $
+
+depend() {
+ need net
+
+ # if monitoring snmp variables on this machine:
+ # use net-snmpd
+}
+
+checkconfig() {
+ if ! [ -f "${MRTG_CONF} ]; then
+ eerror "Please create ${MRTG_CONF} (try man cfgmaker)"
+ return 1
+ fi
+
+ mrtg --check ${MRTG_CONF}
+ return $?
+}
+
+start() {
+ # mrtg will not run if LANG=*utf8
+ # use grep instead of bash regexp for bug #159786
+ echo $LANG | grep -q -E '((^[A-Za-z0-9\_\@\-]+\.)|(^))([uU][tT][fF]-?8)$' && LANG='C'
+
+ checkconfig || return $?
+
+ # enable logging?
+ [ -n "${MRTG_LOG}" ] && \
+ MRTG_OPTS="${MRTG_OPTS} --logging ${MRTG_LOG}"
+
+ # run as a different user?
+ [ -n "${MRTG_USER}" ] && \
+ MRTG_OPTS="${MRTG_OPTS} --user ${MRTG_USER}"
+
+ # run as a different group?
+ [ -n "${MRTG_GROUP}" ] && \
+ MRTG_OPTS="${MRTG_OPTS} --group ${MRTG_GROUP}"
+
+ ebegin "Starting mrtg"
+ start-stop-daemon --start --quiet --pidfile ${MRTG_PID} --name mrtg\
+ --exec /usr/bin/mrtg -- --daemon --pid-file=${MRTG_PID} \
+ ${MRTG_OPTS} ${MRTG_CONF} >/dev/null
+ eend $? "Failed to start mrtg"
+}
+
+stop() {
+ ebegin "Stopping mrtg"
+ start-stop-daemon --stop --quiet --pidfile ${MRTG_PID}
+ eend $? "Failed to stop mrtg"
+}