ports/57421: [NEW PORT] net/ifgraph: Simple grapher of SNMP data with RRD

Lars Thegler lars at thegler.dk
Tue Sep 30 19:50:26 UTC 2003


>Number:         57421
>Category:       ports
>Synopsis:       [NEW PORT] net/ifgraph: Simple grapher of SNMP data with RRD
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 30 12:50:21 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lars Thegler
>Release:        FreeBSD 4.9-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD minerva.thegler.dk 4.9-PRERELEASE FreeBSD 4.9-PRERELEASE #34: Wed Sep 17 05:05:12 CEST 2003
>Description:
ifGraph is a set of Perl scripts created to help network administrators
to visualize network flow on a daily, weekly, monthly, and yearly basis.
The graphics are created with RRDTool, and it shows bytes (in/out) and
errors for each interface. It also shows the current/average/max use and
the respective link/interface usage in percentages. The program also
outputs HTML files to make the visualization of the PNG/GIF/GD images
more friendly and easy.

WWW: http://www.ifgraph.org

- Lars Thegler
lars at thegler.dk

Generated with FreeBSD Port Tools 0.26
>How-To-Repeat:
>Fix:

--- ifgraph-0.4.9.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	ifgraph
#	ifgraph/Makefile
#	ifgraph/pkg-descr
#	ifgraph/distinfo
#	ifgraph/pkg-plist
#	ifgraph/files
#	ifgraph/files/patch-ifgraph.conf
#	ifgraph/files/patch-find-if.pl
#	ifgraph/files/crontab.in
#	ifgraph/files/patch-makegraph.pl
#	ifgraph/files/patch-ifgraph.pl
#	ifgraph/pkg-message
#	ifgraph/pkg-install
#	ifgraph/pkg-deinstall
#
echo c - ifgraph
mkdir -p ifgraph > /dev/null 2>&1
echo x - ifgraph/Makefile
sed 's/^X//' >ifgraph/Makefile << 'END-of-ifgraph/Makefile'
X# New ports collection makefile for:	ifgraph
X# Date created:				Sep 18 2003
X# Whom:                                 Lars Thegler <lars at thegler.dk>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	ifgraph
XPORTVERSION=	0.4.9
XCATEGORIES=	net www
XMASTER_SITES=	http://ifgraph.sourceforge.net/stable/
X
XMAINTAINER=	lars at thegler.dk
XCOMMENT=	Simple grapher of SNMP data with RRD
X
XRUN_DEPENDS=	rrdtool:${PORTSDIR}/net/rrdtool \
X		${SITE_PERL}/Net/SNMP.pm:${PORTSDIR}/net/p5-Net-SNMP
X
XUSE_PERL5=	yes
XNO_BUILD=	yes
X
XPKGMESSAGE=	${WRKDIR}/pkg-message
XPKGINSTALL=	${WRKDIR}/pkg-install
XPKGDEINSTALL=	${WRKDIR}/pkg-deinstall
X
XIFGRAPH_USER=	ifgraph
XIFGRAPH_GROUP=	ifgraph
X
XPLFILES=	find-if.pl ifgraph.pl makegraph.pl
XDOCFILES=	CHANGELOG INSTALACAO INSTALL TODO LICENSE.TXT MUDANCAS
X
XFILES_SUB=	USER=${IFGRAPH_USER} GROUP=${IFGRAPH_GROUP} \
X		PREFIX=${PREFIX} DOCSDIR=${DOCSDIR}
X
Xpre-install:
X	@ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${PKGDIR}/pkg-install > ${PKGINSTALL}
X	@ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
X
Xdo-install:
X	@ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${PKGDIR}/pkg-deinstall > ${PKGDEINSTALL}
X	@ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${PKGDIR}/pkg-message > ${PKGMESSAGE}
X.for plfile in ${PLFILES}
X	@ ${INSTALL_SCRIPT} ${WRKSRC}/${plfile} ${PREFIX}/bin
X.endfor
X	@ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${WRKSRC}/ifgraph.conf > ${WRKSRC}/ifgraph.conf.sample
X	@ ${INSTALL_DATA} ${WRKSRC}/ifgraph.conf.sample ${PREFIX}/etc
X	@ ${MKDIR} ${PREFIX}/ifgraph
X	@ ${MKDIR} ${PREFIX}/ifgraph/htdocs
X	@ ${CP} -Rp ${WRKSRC}/templates ${PREFIX}/ifgraph
X	@ ${SED} ${FILES_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
X		${FILESDIR}/crontab.in > ${PREFIX}/ifgraph/crontab.in
X	@ ${CHOWN} -R ifgraph:ifgraph ${PREFIX}/ifgraph
X	@ ${MKDIR} ${PREFIX}/var/ifgraph
X	@ ${CHOWN} ifgraph:ifgraph ${PREFIX}/var/ifgraph
X.if !defined(NOPORTDOCS)
X	@ ${MKDIR} ${DOCSDIR}
X.for docfile in ${DOCFILES}
X	@ ${INSTALL_DATA} ${WRKSRC}/${docfile} ${DOCSDIR}
X.endfor
X.endif
X
Xpost-install:
X	@ ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
X.if !defined(BATCH)
X	@ ${CAT} ${PKGMESSAGE}
X.endif
X
X.include <bsd.port.mk>
END-of-ifgraph/Makefile
echo x - ifgraph/pkg-descr
sed 's/^X//' >ifgraph/pkg-descr << 'END-of-ifgraph/pkg-descr'
XifGraph is a set of Perl scripts created to help network administrators
Xto visualize network flow on a daily, weekly, monthly, and yearly basis.
XThe graphics are created with RRDTool, and it shows bytes (in/out) and
Xerrors for each interface. It also shows the current/average/max use and
Xthe respective link/interface usage in percentages. The program also
Xoutputs HTML files to make the visualization of the PNG/GIF/GD images
Xmore friendly and easy.
X
XWWW: http://www.ifgraph.org
X
X- Lars Thegler
Xlars at thegler.dk
END-of-ifgraph/pkg-descr
echo x - ifgraph/distinfo
sed 's/^X//' >ifgraph/distinfo << 'END-of-ifgraph/distinfo'
XMD5 (ifgraph-0.4.9.tar.gz) = 9da25053e0aa376e5c7ba5c4e4c48dfa
END-of-ifgraph/distinfo
echo x - ifgraph/pkg-plist
sed 's/^X//' >ifgraph/pkg-plist << 'END-of-ifgraph/pkg-plist'
X at exec mkdir -p %D/ifgraph/htdocs
X at exec mkdir -p %D/var/ifgraph
X at exec chown ifgraph:ifgraph %D/var/ifgraph
Xbin/find-if.pl
Xbin/ifgraph.pl
Xbin/makegraph.pl
Xetc/ifgraph.conf.sample
Xifgraph/crontab.in
Xifgraph/templates/ifgraph-logo.jpg
Xifgraph/templates/en/main-header.html
Xifgraph/templates/en/if-data.html
Xifgraph/templates/en/if-header.html
Xifgraph/templates/en/if-trailer.html
Xifgraph/templates/en/main-data.html
Xifgraph/templates/en/main-trailer.html
Xifgraph/templates/pt-br/main-header.html
Xifgraph/templates/pt-br/if-data.html
Xifgraph/templates/pt-br/if-header.html
Xifgraph/templates/pt-br/if-trailer.html
Xifgraph/templates/pt-br/main-data.html
Xifgraph/templates/pt-br/main-trailer.html
X at dirrm ifgraph/templates/en/
X at dirrm ifgraph/templates/pt-br/
X at dirrm ifgraph/templates
X at unexec rmdir %D/ifgraph 2>/dev/null || true
X at unexec rmdir %D/var/ifgraph 2>/dev/null || true
X%%PORTDOCS%%%%DOCSDIR%%/CHANGELOG
X%%PORTDOCS%%%%DOCSDIR%%/INSTALACAO
X%%PORTDOCS%%%%DOCSDIR%%/INSTALL
X%%PORTDOCS%%%%DOCSDIR%%/TODO
X%%PORTDOCS%%%%DOCSDIR%%/LICENSE.TXT
X%%PORTDOCS%%%%DOCSDIR%%/MUDANCAS
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
END-of-ifgraph/pkg-plist
echo c - ifgraph/files
mkdir -p ifgraph/files > /dev/null 2>&1
echo x - ifgraph/files/patch-ifgraph.conf
sed 's/^X//' >ifgraph/files/patch-ifgraph.conf << 'END-of-ifgraph/files/patch-ifgraph.conf'
X--- ifgraph.conf.orig	Fri Sep 19 19:06:49 2003
X+++ ifgraph.conf	Fri Sep 19 19:08:52 2003
X@@ -19,10 +19,10 @@
X # will not work as expected.
X 
X [global]
X-rrdtool = /usr/local/bin/rrdtool
X-rrddir = /home/someuser/rrdfiles
X-graphdir= /home/someuser/public_html/ifgraph-0.4.9
X-template=/home/someuser/ifgraph-0.4.9/templates/en
X+rrdtool = %%PREFIX%%/bin/rrdtool
X+rrddir = %%PREFIX%%/var/ifgraph
X+graphdir = %%PREFIX%%/ifgraph/htdocs
X+template = %%PREFIX%%/ifgraph/templates/en
X imgformat=PNG
X # those are the default configurations, should be
X # overriden in each target
END-of-ifgraph/files/patch-ifgraph.conf
echo x - ifgraph/files/patch-find-if.pl
sed 's/^X//' >ifgraph/files/patch-find-if.pl << 'END-of-ifgraph/files/patch-find-if.pl'
X--- find-if.pl.orig	Sat Sep 20 14:35:38 2003
X+++ find-if.pl	Sat Sep 20 14:36:07 2003
X@@ -19,10 +19,6 @@
X #Sugestoes e criticas (sem flames!!) mailto:sartori at ifgraph.org
X #Visite: http://www.ifgraph.org
X 
X-# Let's find out where we are
X-use FindBin;
X-# # Found, now we add it to the @INC
X-use lib "$FindBin::Bin/lib";
X # # We are strict
X use strict;
X # # Get the command line options
X@@ -30,7 +26,7 @@
X getopts('adhims');
X 
X # We just nedd the basic features here
X-use Net::SNMP_365;
X+use Net::SNMP;
X 
X use vars qw($response $response2 $response3 $response4 $response5 $response6 $response7 $response8 $response9
X 	    $response10 $response11 $response12 $opt_d @ips $ip $mac $opt_a $opt_h $opt_m $opt_i $opt_s $if $desc $stat $ocin
END-of-ifgraph/files/patch-find-if.pl
echo x - ifgraph/files/crontab.in
sed 's/^X//' >ifgraph/files/crontab.in << 'END-of-ifgraph/files/crontab.in'
X# crontab file for ifGraph
X#*/5 * * * * %%PREFIX%%/bin/ifgraph.pl -c %%PREFIX%%/etc/ifgraph.conf > /dev/null
X#*/5 * * * * %%PREFIX%%/bin/makegraph.pl -c %%PREFIX%%/etc/ifgraph.conf > /dev/null
END-of-ifgraph/files/crontab.in
echo x - ifgraph/files/patch-makegraph.pl
sed 's/^X//' >ifgraph/files/patch-makegraph.pl << 'END-of-ifgraph/files/patch-makegraph.pl'
X--- makegraph.pl.orig	Sun Sep 21 12:30:49 2003
X+++ makegraph.pl	Sun Sep 21 12:32:08 2003
X@@ -19,8 +19,6 @@
X #Sugestoes e criticas (sem flames!!) mailto:sartori at ifgraph.org
X #Visite: http://www.ifgraph.org
X 
X-use FindBin;
X-use lib "$FindBin::Bin/lib";
X use strict;
X use Getopt::Std;
X use vars qw($opt_d $opt_c $opt_B $opt_b $opt_h $opt_g $opt_t $opt_T $targetindex
X@@ -30,14 +28,7 @@
X getopt('ctT');
X getopts('Bbgdh');
X 
X-# If the perl is older, we have to fetch the older Net::SNMP library
X-if ($] < 5.006) { 
X-	&debug("Warning: Older perl version $], we will use Net::SNMP 3.65\n");
X-	require Net::SNMP_365; 
X-} else {
X-	&debug("Starting ifgraph 0.4.9 with perl $[, Net::SNMP 4.3\n");
X-	require Net::SNMP;
X-}
X+use Net::SNMP;
X 
X # HELP
X if (defined($opt_h)) {
END-of-ifgraph/files/patch-makegraph.pl
echo x - ifgraph/files/patch-ifgraph.pl
sed 's/^X//' >ifgraph/files/patch-ifgraph.pl << 'END-of-ifgraph/files/patch-ifgraph.pl'
X--- ifgraph.pl.orig	Sun Sep 28 22:29:51 2003
X+++ ifgraph.pl	Sun Sep 28 22:30:19 2003
X@@ -19,10 +19,6 @@
X #Sugestoes e criticas (sem flames!!) mailto:sartori at ifgraph.org
X #Visite: http://www.ifgraph.org
X 
X-# Let's find out where we are
X-use FindBin;
X-# Found, now we add it to the @INC
X-use lib "$FindBin::Bin/lib";
X # We are strict
X use strict;
X # Get the command line options
X@@ -32,14 +28,7 @@
X getopt('cltF');
X getopts('dh');
X 
X-# If the perl is older, we have to fetch the older Net::SNMP library
X-if ($] < 5.006) { 
X-	&debug("Warning: Older perl version $], we will use Net::SNMP 3.65\n");
X-	require Net::SNMP_365; 
X-} else {
X-	&debug("Starting ifgraph 0.4.9 with perl $], Net::SNMP 4.3\n");
X-	require Net::SNMP;
X-}
X+use Net::SNMP;
X 
X # SIGINT call
X $SIG{INT}=\&sigint;
END-of-ifgraph/files/patch-ifgraph.pl
echo x - ifgraph/pkg-message
sed 's/^X//' >ifgraph/pkg-message << 'END-of-ifgraph/pkg-message'
X=================================================================
X
XifGraph has now been installed in %%PREFIX%%/ifgraph/.
X
XNOTE: A sample configuration files has been placed at:
X
X  %%PREFIX%%/etc/ifgraph.conf.sample
X
XYou need to copy this to
X
X  %%PREFIX%%/etc/ifgraph.conf
X
Xand edit it to suit your requirements.
X
XA sample crontab(5) entry has been installed. You need to activate
Xthis to start measurements and graph generation. You can do this
Xwith
X
X  crontab -u ifgraph -e
X
XDocumentation is installed in
X
X  %%DOCSDIR%%/
X
XTo enable Apache web access, add the following to your
X%%PREFIX%%/etc/apache/httpd.conf:
X
X  Alias /ifgraph/ %%PREFIX%%/ifgraph/htdocs/
X
XEnjoy!
X
X=================================================================
END-of-ifgraph/pkg-message
echo x - ifgraph/pkg-install
sed 's/^X//' >ifgraph/pkg-install << 'END-of-ifgraph/pkg-install'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
XPATH=/bin:/usr/bin:/usr/sbin
X
Xcase $2 in
X
XPRE-INSTALL)
X  echo "---> Starting pre-install script:"
X
X  if [ -z "%%USER%%" -o \
X       -z "%%GROUP%%" ]; then
X    echo "ERROR: A required pragma was empty"
X    exit 1
X  fi
X
X  if pw showgroup "%%GROUP%%" 2>/dev/null; then
X    echo "---> Using existing group \"%%GROUP%%\""
X  else
X    echo "---> Adding group \"%%GROUP%%\""
X    pw addgroup %%GROUP%% -h - || exit 1
X  fi
X
X  # Create user if required
X  if pw showuser "%%USER%%" 2>/dev/null; then
X    echo "---> Using existing user \"%%USER%%\""
X  else
X    echo "---> Adding user \"%%USER%%\""
X    pw adduser %%USER%% -g %%GROUP%% -h - \
X      -s "/sbin/nologin" -c "ifGraph User" || exit 1
X  fi
X
X  ;;
X
XPOST-INSTALL)
X  echo "---> Starting post-install script:"
X
X  if [ -z "%%USER%%" -o \
X       -z "%%PREFIX%%" ]; then
X    echo "ERROR: A required pragma was empty"
X    exit 1
X  fi
X
X  echo "---> Creating crontab(5) file for user \"%%USER%%\""
X  crontab -u "%%USER%%" "%%PREFIX%%/ifgraph/crontab.in" || exit 1
X
X  ;;
X
Xesac
END-of-ifgraph/pkg-install
echo x - ifgraph/pkg-deinstall
sed 's/^X//' >ifgraph/pkg-deinstall << 'END-of-ifgraph/pkg-deinstall'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X
XPATH=/bin:/usr/bin:/usr/sbin
X
Xcase $2 in
X
XDEINSTALL)
X  echo '---> Starting deinstall script:'
X
X  echo '---> Zeroing crontab(5) file belonging to user "%%USER%%"'
X  /usr/bin/crontab -u %%USER%% /dev/null
X  echo '     (The crontab(5) will be deleted completely when user "%%USER%%" is removed.)'
X
X  ;;
X
XPOST-DEINSTALL)
X  echo '---> Starting post-deinstall script:'
X
X  if [ -f %%PREFIX%%/etc/ifgraph.conf -o \
X       -d %%PREFIX%%/ifgraph -o \
X       -d %%PREFIX%%/var/ifgraph ]; then
X    echo '---> You seem to have made some custom ifGraph configuration.'
X    echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.'
X    echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".'
X
X  else
X    echo '---> Removing group "%%GROUP%%"'
X    /usr/sbin/pw groupdel -n %%GROUP%%
X    echo '---> Removing user "%%USER%%"'
X    echo 'y' | /usr/sbin/pw userdel -n %%USER%%
X  fi
X
X  ;;
X
Xesac
END-of-ifgraph/pkg-deinstall
exit
--- ifgraph-0.4.9.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list