diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-analyzer/mrtg/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-analyzer/mrtg/files')
-rw-r--r-- | net-analyzer/mrtg/files/mrtg-2.17.4-socket6.patch | 11 | ||||
-rw-r--r-- | net-analyzer/mrtg/files/mrtg.confd | 16 | ||||
-rw-r--r-- | net-analyzer/mrtg/files/mrtg.rc | 53 |
3 files changed, 80 insertions, 0 deletions
diff --git a/net-analyzer/mrtg/files/mrtg-2.17.4-socket6.patch b/net-analyzer/mrtg/files/mrtg-2.17.4-socket6.patch new file mode 100644 index 000000000000..5540874d9a00 --- /dev/null +++ b/net-analyzer/mrtg/files/mrtg-2.17.4-socket6.patch @@ -0,0 +1,11 @@ +--- a/bin/mrtg ++++ b/bin/mrtg +@@ -300,7 +300,7 @@ sub main { + if ($cfg{enableipv6} eq 'yes') { + if ( eval {local $SIG{__DIE__};require Socket; require Socket6; require IO::Socket::INET6;}) { + import Socket; +- import Socket6; ++ Socket6->import(qw(inet_pton getaddrinfo)); + debug('base', "IPv6 libraries found, IPv6 enabled."); + } else { + warn "$NOW: WARNING: IPv6 libraries not found, IPv6 disabled.\n"; diff --git a/net-analyzer/mrtg/files/mrtg.confd b/net-analyzer/mrtg/files/mrtg.confd new file mode 100644 index 000000000000..3164a361955d --- /dev/null +++ b/net-analyzer/mrtg/files/mrtg.confd @@ -0,0 +1,16 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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/net-analyzer/mrtg/files/mrtg.rc b/net-analyzer/mrtg/files/mrtg.rc new file mode 100644 index 000000000000..d1ee6861cd45 --- /dev/null +++ b/net-analyzer/mrtg/files/mrtg.rc @@ -0,0 +1,53 @@ +#!/sbin/openrc-run +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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 -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" +} |