diff options
author | miwi <miwi@FreeBSD.org> | 2009-01-10 23:05:56 +0800 |
---|---|---|
committer | miwi <miwi@FreeBSD.org> | 2009-01-10 23:05:56 +0800 |
commit | ca920ef279545fe3e209443080fba4798ed05211 (patch) | |
tree | ad5e886ad94f8be332523031fd38f9f33b911ad5 /www/squidstats | |
parent | 9371ccfc14b19d90c41d215710c3a4bfe80bc0ac (diff) | |
download | freebsd-ports-graphics-ca920ef279545fe3e209443080fba4798ed05211.tar.gz freebsd-ports-graphics-ca920ef279545fe3e209443080fba4798ed05211.tar.zst freebsd-ports-graphics-ca920ef279545fe3e209443080fba4798ed05211.zip |
This is a series of scripts for gathering and presenting statistical
information about a running Squid or Cacheboy application.
WWW: http://code.google.com/p/squidstats/
PR: ports/130273
Submitted by: Adrian Chadd <adrian at FreeBSD.org>
Diffstat (limited to 'www/squidstats')
-rw-r--r-- | www/squidstats/Makefile | 41 | ||||
-rw-r--r-- | www/squidstats/distinfo | 3 | ||||
-rw-r--r-- | www/squidstats/files/pkg-install.in | 86 | ||||
-rw-r--r-- | www/squidstats/files/pkg-message.in | 35 | ||||
-rw-r--r-- | www/squidstats/pkg-descr | 4 | ||||
-rw-r--r-- | www/squidstats/pkg-plist | 26 |
6 files changed, 195 insertions, 0 deletions
diff --git a/www/squidstats/Makefile b/www/squidstats/Makefile new file mode 100644 index 00000000000..44ed3343e8d --- /dev/null +++ b/www/squidstats/Makefile @@ -0,0 +1,41 @@ +# Ports collection makefile for: squidstats +# Whom: Adrian Chadd <adrian@FreeBSD.org> +# Date Created: 10-December-2008 +# +# $FreeBSD$ +# + +PORTNAME= squidstats +PORTVERSION= 54 +CATEGORIES= www +MASTER_SITES= ${MASTER_SITE_GOOGLE_CODE} +DISTNAME= squidstats-r${PORTVERSION} + +MAINTAINER= adrian@FreeBSD.org +COMMENT= A collection of simple statistical analysis bits for Squid + +RUN_DEPENDS= p5-Config-IniFiles>=2.39:${PORTSDIR}/devel/p5-Config-IniFiles \ + p5-RRD-Simple>=1.44:${PORTSDIR}/databases/p5-RRD-Simple \ + p5-SNMP_Session>=1.11:${PORTSDIR}/net-mgmt/p5-SNMP_Session + +USE_PERL5= yes + +SQUID_UID?= squid +SQUID_GID?= squid + +SUB_FILES= pkg-message pkg-install +SUB_LIST+= SQUID_UID=${SQUID_UID} SQUID_GID=${SQUID_GID} + +pre-install: + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +post-install: + @${SETENV} PKG_PREFIX=${PREFIX} ${SH} \ + ${PKGINSTALL} ${PKGNAME} POST-INSTALL + @${ECHO_CMD} "===> post-installation information for ${PKGNAME}:" + @${ECHO_CMD} "" + @${CAT} ${PKGMESSAGE} + @${ECHO_CMD} "" + +.include <bsd.port.mk> diff --git a/www/squidstats/distinfo b/www/squidstats/distinfo new file mode 100644 index 00000000000..a7c0b983e7d --- /dev/null +++ b/www/squidstats/distinfo @@ -0,0 +1,3 @@ +MD5 (squidstats-r54.tar.gz) = 0747361f28bb883424f340288146f77f +SHA256 (squidstats-r54.tar.gz) = 9dbdcafebddbb3b62abca398da351894967cbf2e758a9c4df3df45ea82ba99c0 +SIZE (squidstats-r54.tar.gz) = 9504 diff --git a/www/squidstats/files/pkg-install.in b/www/squidstats/files/pkg-install.in new file mode 100644 index 00000000000..85e2e734537 --- /dev/null +++ b/www/squidstats/files/pkg-install.in @@ -0,0 +1,86 @@ +#!/bin/sh +# +# $FreeBSD: /tmp/pcvs/ports/www/squidstats/files/pkg-install.in,v 1.1 2009-01-10 15:05:56 miwi Exp $ +# + +PATH=/bin:/usr/bin:/usr/sbin +pkgname=$1 +squid_base="${PKG_PREFIX:-%%PREFIX%%}/squid" +squid_confdir="${PKG_PREFIX:-%%PREFIX%%}/etc/squid" +if [ -x /usr/sbin/nologin ]; then + nologin=/usr/sbin/nologin +else + nologin=/sbin/nologin +fi + +squid_user="%%SQUID_UID%%" +squid_group="%%SQUID_GID%%" +squid_name="Squid caching-proxy pseudo-owner" +squid_homedir="/usr/local/squid" +squid_gid=100 +squid_uid=100 + + +group_create () { + n_group=$1 + n_gid=$2 + if ! pw groupshow ${n_group} -q >/dev/null ; then + echo "There is no group '${n_group}' on this system, so I will try to create it (using group id ${n_gid}):" + if ! pw groupadd ${n_group} -g ${n_gid} -q ; then + echo "Failed to create group \"${n_group}\"!" >&2 + echo "Please create it manually." >&2 + exit 1 + else + echo "Group '${n_group}' created successfully:" + fi + else + echo "I will use the existing group '${n_group}':" + fi + pw groupshow ${n_group} +} + +user_create () { + n_user="$1" + n_uid="$2" + n_group="$3" + n_homedir="$4" + n_name="$5" + n_shell="$6" + + echo "Given: $1 $2 $3 $4 '$5' '$6'" + + if ! pw usershow ${n_user} -q >/dev/null ; then + echo "There is no account '${n_user}' on this system, so I will try to create it (using user id ${n_uid}):" + if ! pw useradd -q -n ${n_user} \ + -u ${n_uid} -g ${n_group} \ + -c "${n_name}" \ + -d "${n_homedir}" -s "${n_shell}" \ + -h - ; then + echo "Failed to create user '${n_user}'!" >&2 + echo "Please create it manually." >&2 + exit 1 + else + echo "User '${n_user}' created successfully:" + fi + else + echo "I will use the existing user '${n_user}':" + fi + pw usershow ${n_user} +} + +case $2 in +PRE-INSTALL) + echo "===> Pre-installation configuration for ${pkgname}" + echo "===> - Creating Groups" + group_create ${squid_group} ${squid_gid} + echo "===> - Creating Users" + user_create ${squid_user} ${squid_uid} ${squid_group} ${squid_homedir} "${squid_name}" ${nologin} + echo "===> - Done." + ;; +POST-INSTALL) + ;; +*) + exit 64 + ;; +esac +exit 0 diff --git a/www/squidstats/files/pkg-message.in b/www/squidstats/files/pkg-message.in new file mode 100644 index 00000000000..6449c701c6e --- /dev/null +++ b/www/squidstats/files/pkg-message.in @@ -0,0 +1,35 @@ + +To setup the database, run the following command as the statistics +user (generally "squid") : + +# su -m squid -c "%%PREFIX%%/bin/squidstats.pl createdb" + +Then, add a configuration section to squid.conf to allow SNMP from +localhost: + +# snmp config +acl snmp_host src 127.0.0.1 +acl all src 0.0.0.0/0 +snmp_port 3401 +acl snmppublic snmp_community public +snmp_access allow snmppublic snmp_host +snmp_access deny all + +Then make sure the following line is added to the squid crontab: +*/5 * * * * %%PREFIX%%/bin/squidstats.pl gather 2>/dev/null + +Next, the supplied graph.css file will need to be copied or +symlinked from %%PREFIX%%/share/squidstats/htdocs/graph.css +to wherever your webserver root is. + +Finally, you will need to ensure that the graph directory and +cgi-bin script are in the right place. By default, the cgi script +is installed in %%PREFIX%%/www/cgi-bin/ and the graph directory +is in /var/db/squidstats/graphs; you will need to copy the graph +script into the correct place and symlink the graph directory +into your webserver root directory. + +For example, this will symlink the graph directory into the +apache 1.x web root: + +# ln -s /var/db/squidstats/graphs /usr/local/www/data/ diff --git a/www/squidstats/pkg-descr b/www/squidstats/pkg-descr new file mode 100644 index 00000000000..c3203c463e8 --- /dev/null +++ b/www/squidstats/pkg-descr @@ -0,0 +1,4 @@ +This is a series of scripts for gathering and presenting statistical +information about a running Squid or Cacheboy application. + +WWW: http://code.google.com/p/squidstats/ diff --git a/www/squidstats/pkg-plist b/www/squidstats/pkg-plist new file mode 100644 index 00000000000..1c4ef0e5e90 --- /dev/null +++ b/www/squidstats/pkg-plist @@ -0,0 +1,26 @@ +etc/squidstats/config.ini +etc/squidstats/snmp_monitor.cfg +etc/squidstats/templates.conf +share/squidstats/templates/clients +share/squidstats/templates/dnsreq +share/squidstats/templates/fds +share/squidstats/templates/hitratio +share/squidstats/templates/icp +share/squidstats/templates/ipcachereq +share/squidstats/templates/outgoing +share/squidstats/templates/cache +share/squidstats/templates/cpu +share/squidstats/templates/dnssvc +share/squidstats/templates/fqdncachereq +share/squidstats/templates/httpsvc +share/squidstats/templates/incoming +share/squidstats/templates/objects +share/squidstats/templates/requests +share/squidstats/htdocs/graph.css +bin/squidstats.pl +www/cgi-bin/graph-summary.cgi +@dirrmtry www/cgi-bin +@dirrm etc/squidstats +@dirrm share/squidstats/htdocs +@dirrm share/squidstats/templates +@dirrm share/squidstats |