mirror of
https://github.com/netbirdio/FreeBSD-ports.git
synced 2026-05-22 18:42:42 -07:00
Real-time log statistics server
WWW: http://search.cpan.org/~LONERR/Tail-Stat/ PR: ports/152041 Submitted by: Oleg A. Mamontov <oleg at mamontov.net>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# New ports collection makefile for: p5-Tail-Stat
|
||||
# Date created: 2010-11-08
|
||||
# Whom: Oleg A. Mamontov <oleg@mamontov.net>
|
||||
#
|
||||
# $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 <bsd.port.mk>
|
||||
@@ -0,0 +1,2 @@
|
||||
SHA256 (Tail-Stat-0.08.tar.gz) = 1b1317c5ea4fd11b59049e4cdb571ec5dff2ae347df9586690921c14c7d00ee9
|
||||
SIZE (Tail-Stat-0.08.tar.gz) = 16200
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,3 @@
|
||||
Real-time log statistics server
|
||||
|
||||
WWW: http://search.cpan.org/~LONERR/Tail-Stat/
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user