From 7092ea3a5df7a12aa73f975c08265927c520b251 Mon Sep 17 00:00:00 2001 From: Philippe Audeoud Date: Tue, 9 Nov 2010 09:02:35 +0000 Subject: Real-time log statistics server WWW: http://search.cpan.org/~LONERR/Tail-Stat/ PR: ports/152041 Submitted by: Oleg A. Mamontov --- sysutils/Makefile | 1 + sysutils/p5-Tail-Stat/Makefile | 42 ++++++++++++++++++ sysutils/p5-Tail-Stat/distinfo | 2 + sysutils/p5-Tail-Stat/files/tstatd.in | 84 +++++++++++++++++++++++++++++++++++ sysutils/p5-Tail-Stat/pkg-deinstall | 10 +++++ sysutils/p5-Tail-Stat/pkg-descr | 3 ++ sysutils/p5-Tail-Stat/pkg-install | 10 +++++ sysutils/p5-Tail-Stat/pkg-plist | 12 +++++ 8 files changed, 164 insertions(+) create mode 100644 sysutils/p5-Tail-Stat/Makefile create mode 100644 sysutils/p5-Tail-Stat/distinfo create mode 100644 sysutils/p5-Tail-Stat/files/tstatd.in create mode 100644 sysutils/p5-Tail-Stat/pkg-deinstall create mode 100644 sysutils/p5-Tail-Stat/pkg-descr create mode 100644 sysutils/p5-Tail-Stat/pkg-install create mode 100644 sysutils/p5-Tail-Stat/pkg-plist diff --git a/sysutils/Makefile b/sysutils/Makefile index ca63fec34de2..fe627c6532e2 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -595,6 +595,7 @@ SUBDIR += p5-Sys-Utmp SUBDIR += p5-Sysadm-Install SUBDIR += p5-SyslogScan + SUBDIR += p5-Tail-Stat SUBDIR += p5-Tie-Syslog SUBDIR += p5-Unix-ConfigFile SUBDIR += p5-Unix-Lsof diff --git a/sysutils/p5-Tail-Stat/Makefile b/sysutils/p5-Tail-Stat/Makefile new file mode 100644 index 000000000000..f21755482ce4 --- /dev/null +++ b/sysutils/p5-Tail-Stat/Makefile @@ -0,0 +1,42 @@ +# New ports collection makefile for: p5-Tail-Stat +# Date created: 2010-11-08 +# Whom: Oleg A. Mamontov +# +# $FreeBSD$ +# + +PORTNAME= Tail-Stat +PORTVERSION= 0.08 +CATEGORIES= sysutils perl5 +MASTER_SITES= CPAN +MASTER_SITE_SUBDIR= ../by-authors/id/L/LO/LONERR +PKGNAMEPREFIX= p5- + +MAINTAINER= oleg@mamontov.net +COMMENT= Real-time log statistics server + +RUN_DEPENDS= p5-DateTime>=0:${PORTSDIR}/devel/p5-DateTime \ + p5-JSON-XS>=0:${PORTSDIR}/converters/p5-JSON-XS \ + p5-Log-Dispatch>=2.26:${PORTSDIR}/devel/p5-Log-Dispatch \ + p5-POE>=0:${PORTSDIR}/devel/p5-POE \ + p5-Pid-File-Flock>=0:${PORTSDIR}/devel/p5-Pid-File-Flock \ + p5-Sys-Syslog>=0.16:${PORTSDIR}/sysutils/p5-Sys-Syslog \ + p5-Tie-Hash-Indexed>=0:${PORTSDIR}/devel/p5-Tie-Hash-Indexed + +PERL_CONFIGURE= yes + +USE_RC_SUBR= tstatd +SUB_LIST+= RC_SUBR_SUFFIX=${RC_SUBR_SUFFIX} + +MAN1= tstatd.1 + +MAN3= Tail::Stat.3 \ + Tail::Stat::Plugin.3 \ + Tail::Stat::Plugin::apache.3 \ + Tail::Stat::Plugin::nginx.3 \ + Tail::Stat::Plugin::spamd.3 + +post-install: + @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + +.include diff --git a/sysutils/p5-Tail-Stat/distinfo b/sysutils/p5-Tail-Stat/distinfo new file mode 100644 index 000000000000..40fceea9b97c --- /dev/null +++ b/sysutils/p5-Tail-Stat/distinfo @@ -0,0 +1,2 @@ +SHA256 (Tail-Stat-0.08.tar.gz) = 1b1317c5ea4fd11b59049e4cdb571ec5dff2ae347df9586690921c14c7d00ee9 +SIZE (Tail-Stat-0.08.tar.gz) = 16200 diff --git a/sysutils/p5-Tail-Stat/files/tstatd.in b/sysutils/p5-Tail-Stat/files/tstatd.in new file mode 100644 index 000000000000..fa985d68052f --- /dev/null +++ b/sysutils/p5-Tail-Stat/files/tstatd.in @@ -0,0 +1,84 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: tstatd +# REQUIRE: DAEMON +# +# Add the following lines to /etc/rc.conf to run tstatd: +# +# tstatd_enable (bool): Set it to "YES" to enable tstatd. +# Default is "NO". +# tstatd_profiles (strings): Example - "spam www" +# Default is empty. +# tstatd_profile_flags (string): Set extra flags. See tstatd(1) for details. +# Default is empty. +# tstatd_profile_listen (string): Set tstatd listen socket. +# Default is "127.0.0.1:3638". +# tstatd_profile_plugin (string): Set plugin name. See tstatd(1) for details. +# Default is empty. Required argument. +# tstatd_profile_user (user): Set user to run tstatd. +# Default is "nobody". +# tstatd_profile_zones (string): Set tstatd 'zones'. See tstatd(1) for details. +# Default is "nobody". Required argument. + +. /etc/rc.subr + +name="tstatd" +rcvar=${name}_enable + +load_rc_config ${name} + +: ${tstatd_enable="NO"} +: ${tstatd_profiles=""} + +command=%%PREFIX%%/bin/tstatd + + +_profile_exists() { + for _p in ${tstatd_profiles}; do + [ "${_p}" = "$1" ] && return 1; + done + return 0 +} + +if [ $# -eq 2 ]; then + _profile=$2 + _profile_exists $_profile + _exists=$? + [ ${_exists} -ne 1 ] && { + echo "`basename %%PREFIX%%/etc/rc.d/tstatd%%RC_SUBR_SUFFIX%%`: no '$2' in 'tstatd_profiles'" + exit 1 + }; + echo "-- Profile: $2 --" + eval _plugin=\${${name}_${_profile}_plugin} + [ -n "${_plugin}" ] || { + echo "`basename %%PREFIX%%/etc/rc.d/tstatd%%RC_SUBR_SUFFIX%%`: no 'tstatd_${_profile}_plugin' set" + exit 2 + }; + eval _zones=\${${name}_${_profile}_zones} + [ -n "${_zones}" ] || { + echo "`basename %%PREFIX%%/etc/rc.d/tstatd%%RC_SUBR_SUFFIX%%`: no 'tstatd_${_profile}_zones' set" + exit 2 + }; + eval _listen=\${${name}_${_profile}_listen:-127.0.0.1:3638} + eval _user=\${${name}_${_profile}_user:-nobody} + eval _flags=\${${name}_${_profile}_flags} + tstatd_flags="${_plugin} -l ${_listen} -u ${_user} -b /var/db/tstatd/${_profile}.db -p /var/run/tstatd/${_profile}.pid ${_flags} ${_zones}" + pidfile=/var/run/tstatd/${_profile}.pid +elif [ -n "${tstatd_profiles}" ]; then + _swap=$*; shift; _profiles=$* + _profiles=${_profiles:-${tstatd_profiles}} + set -- ${_swap} + for _profile in ${_profiles}; do + %%PREFIX%%/etc/rc.d/tstatd%%RC_SUBR_SUFFIX%% $1 ${_profile} + done + exit 0 +else + echo "`basename %%PREFIX%%/etc/rc.d/tstatd%%RC_SUBR_SUFFIX%%`: set 'tstatd_profiles' in rc.conf" + exit 3 +fi + + +run_rc_command "$1" + diff --git a/sysutils/p5-Tail-Stat/pkg-deinstall b/sysutils/p5-Tail-Stat/pkg-deinstall new file mode 100644 index 000000000000..10ef04778b98 --- /dev/null +++ b/sysutils/p5-Tail-Stat/pkg-deinstall @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ "$2" = "POST-DEINSTALL" ]; then + echo -e "\n=====================================================\n" + echo -n "Please, remove staled directories:" + for d in /var/db/tstatd /var/run/tstatd; do + [ -d "${d}" ] && echo -n " ${d}" + done + echo -e "\n\n=====================================================\n" +fi diff --git a/sysutils/p5-Tail-Stat/pkg-descr b/sysutils/p5-Tail-Stat/pkg-descr new file mode 100644 index 000000000000..98b4bcda1527 --- /dev/null +++ b/sysutils/p5-Tail-Stat/pkg-descr @@ -0,0 +1,3 @@ +Real-time log statistics server + +WWW: http://search.cpan.org/~LONERR/Tail-Stat/ diff --git a/sysutils/p5-Tail-Stat/pkg-install b/sysutils/p5-Tail-Stat/pkg-install new file mode 100644 index 000000000000..6c14b0d6db99 --- /dev/null +++ b/sysutils/p5-Tail-Stat/pkg-install @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ "$2" = "POST-INSTALL" ]; then + echo -n "Creating required directories:" + for d in /var/db/tstatd /var/run/tstatd; do + echo -n " ${d}" + mkdir -pm 1777 ${d} + done + echo +fi diff --git a/sysutils/p5-Tail-Stat/pkg-plist b/sysutils/p5-Tail-Stat/pkg-plist new file mode 100644 index 000000000000..45b72d1468df --- /dev/null +++ b/sysutils/p5-Tail-Stat/pkg-plist @@ -0,0 +1,12 @@ +bin/tstatd +%%SITE_PERL%%/Tail/Stat.pm +%%SITE_PERL%%/Tail/Stat/Plugin.pm +%%SITE_PERL%%/Tail/Stat/Plugin/apache.pm +%%SITE_PERL%%/Tail/Stat/Plugin/nginx.pm +%%SITE_PERL%%/Tail/Stat/Plugin/spamd.pm +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Tail/Stat/.packlist +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Tail/Stat +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Tail +@dirrm %%SITE_PERL%%/Tail/Stat/Plugin +@dirrm %%SITE_PERL%%/Tail/Stat +@dirrm %%SITE_PERL%%/Tail -- cgit v1.2.3