Date: Sun, 18 Jan 2004 18:50:51 +0100 (CET) From: Michael Ranner <mranner@inode.at> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/61539: new port: net/nrg Message-ID: <200401181750.i0IHopbm090774@dwarf.jawa.at> Resent-Message-ID: <200401181800.i0II0bk5079749@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 61539 >Category: ports >Synopsis: new port: net/nrg >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: Sun Jan 18 10:00:37 PST 2004 >Closed-Date: >Last-Modified: >Originator: Michael Ranner >Release: FreeBSD 4.9-RELEASE-p1 i386 >Organization: >Environment: System: FreeBSD dwarf.jawa.at 4.9-RELEASE-p1 FreeBSD 4.9-RELEASE-p1 #4: Sat Nov 29 11:09:14 CET 2003 root@dwarf.jawa.at:/usr/src/sys/compile/DWARF i386 >Description: new port: net/nrg >How-To-Repeat: unshar in /usr/ports/net >Fix: --- nrg.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: # # nrg # nrg/pkg-plist # nrg/pkg-descr # nrg/distinfo # nrg/Makefile # nrg/files # nrg/files/patch-examples # nrg/files/run-nrg.sh # nrg/files/patch-nrg-apachestat # nrg/files/patch-nrg-sendmailstat # nrg/files/patch-nrg-bindstat # nrg/files/nrg-apcupsdstat.patch # nrg/pkg-message # echo c - nrg mkdir -p nrg > /dev/null 2>&1 echo x - nrg/pkg-plist sed 's/^X//' >nrg/pkg-plist << 'END-of-nrg/pkg-plist' Xnrg/bin/dsreport Xnrg/bin/mrtg2nrg Xnrg/bin/nrg-apachestat Xnrg/bin/nrg-autoconf Xnrg/bin/nrg-bindresponse Xnrg/bin/nrg-bindstat Xnrg/bin/nrg-bindstatd Xnrg/bin/nrg-cgikeeper Xnrg/bin/nrg-discover-apache Xnrg/bin/nrg-discover-bind Xnrg/bin/nrg-discover-errors Xnrg/bin/nrg-discover-ifaces Xnrg/bin/nrg-discover-netdev Xnrg/bin/nrg-discover-pingd Xnrg/bin/nrg-discover-pvcs Xnrg/bin/nrg-discover-sendmail Xnrg/bin/nrg-discover-snmpd Xnrg/bin/rrdmerge Xnrg/bin/nrg-discover-tables Xnrg/bin/nrg-discover-tcp Xnrg/bin/nrg-find-confs Xnrg/bin/nrg-indexmaker Xnrg/bin/nrg-rrdkeeper Xnrg/bin/nrg-pingdstat Xnrg/bin/nrg-runmaker Xnrg/bin/nrg-sendmailstat Xnrg/bin/nrg-sendmailstatd Xnrg/bin/nrg-snmpwalk Xnrg/bin/nrg-spiketrimmer Xnrg/bin/nrg-tablemaker Xnrg/bin/nrg-tcpresponse Xnrg/bin/rrdtrim Xnrg/etc/nrg-oid-names Xnrg/etc/run-star-head.pl Xnrg/etc/run-star-tail.pl Xnrg/templates/database-mrtg.rrd.tm Xnrg/templates/discover-bind.tm Xnrg/templates/discover-apache.tm Xnrg/templates/discover-errors.tm Xnrg/templates/discover-ifaces.tm Xnrg/templates/discover-netdev.tm Xnrg/templates/discover-pingd.tm Xnrg/templates/discover-pvcs.tm Xnrg/templates/discover-sendmail.tm Xnrg/templates/discover-snmpd.tm Xnrg/templates/discover-tables.tm Xnrg/templates/discover-tcp.tm Xnrg/templates/graph-current.cgi.tm Xnrg/templates/graph-longterm.cgi.tm Xnrg/templates/graph-mrtg.cgi.tm Xnrg/templates/table-df.cgi.tm Xnrg/templates/table-errors.cgi.tm Xnrg/templates/table-ifaces.cgi.tm Xnrg/templates/table-load.cgi.tm Xnrg/templates/table-mem.cgi.tm Xnrg/templates/table-ping-latency.cgi.tm Xnrg/templates/table-ping-loss.cgi.tm Xnrg/templates/table-swap.cgi.tm Xnrg/templates/table-tcp.cgi.tm Xnrg/examples/Default.conf Xnrg/examples/NRG.mconf Xnrg/examples/Site.mconf Xnrg/examples/apache.mconf Xnrg/examples/bind.mconf Xnrg/examples/cisco.mconf Xnrg/examples/ftp.mconf Xnrg/examples/http.mconf Xnrg/examples/iface-errors.mconf Xnrg/examples/ifaces.mconf Xnrg/examples/imap.mconf Xnrg/examples/ping.mconf Xnrg/examples/pop.mconf Xnrg/examples/procurve.mconf Xnrg/examples/sendmail.mconf Xnrg/examples/smtp.mconf Xnrg/examples/ssh.mconf Xnrg/examples/trunk.mconf Xnrg/examples/unix.mconf Xnrg/html/apachestat.html Xnrg/html/bindstat.html Xnrg/html/changes Xnrg/html/collectors.html Xnrg/html/conf-string-list.html Xnrg/html/conf-strings.html Xnrg/html/configuration.html Xnrg/html/contrib.html Xnrg/html/index.html Xnrg/html/install.html Xnrg/html/log2rrd.html Xnrg/html/nrg+rrd.gif Xnrg/html/metaconf-strings.html Xnrg/html/metaconf.html Xnrg/html/mrtg-vs-nrg.html Xnrg/html/mrtg2nrg.html Xnrg/html/operation.html Xnrg/html/readme.html Xnrg/html/templates.html Xnrg/html/sample-conf.html Xnrg/html/sendmailstat.html Xnrg/html/upgrade.html Xnrg/html/whats-new Xnrg/Makefile Xnrg/Default.conf Xnrg/NRG.mconf Xnrg/Site.mconf Xnrg/.VERSION Xnrg/run-nrg.sh X@dirrm nrg/templates X@dirrm nrg/html X@dirrm nrg/examples X@dirrm nrg/etc X@dirrm nrg/bin X@dirrm nrg/archive X@dirrm nrg END-of-nrg/pkg-plist echo x - nrg/pkg-descr sed 's/^X//' >nrg/pkg-descr << 'END-of-nrg/pkg-descr' XNRG is a system for maintaining and visualizing network data and Xother resource utilization data. It automates the maintenance of XRRDtool databases and graph web pages (that look like MRTG web Xpages.) NRG is primarily configured using very terse meta- Xconfiguration strings. These strings tell NRG to autodiscover Xnetwork devices and verify that their current NRG configuration Xis correct. X XWWW: http://nrg.hep.wisc.edu/ END-of-nrg/pkg-descr echo x - nrg/distinfo sed 's/^X//' >nrg/distinfo << 'END-of-nrg/distinfo' XMD5 (nrg-0.99.22.tar.gz) = 439242d8567aab1a375873128a34fc5c END-of-nrg/distinfo echo x - nrg/Makefile sed 's/^X//' >nrg/Makefile << 'END-of-nrg/Makefile' X# New ports collection makefile for: nrg X# Date created: 18 January 2004 X# Whom: Michael Ranner X# X# $FreeBSD: ports/irc/kvirc/Makefile,v 1.31 2004/01/13 23:27:16 arved Exp $ X# X XPORTNAME= nrg XPORTVERSION= 0.99.22 XCATEGORIES= net sysutils XMASTER_SITES= ftp://nrg.hep.wisc.edu/pub/src/nrg/ \ X http://www.ranner.jawa.at/stuff/ X XMAINTAINER= mranner@inode.at XCOMMENT= "NRG does visualizing network and resource utilization data" X XRUN_DEPENDS= ${SITE_PERL}/RRDp.pm:${PORTSDIR}/net/rrdtool X XNRG_WEB_PREFIX?= ${PREFIX}/www/data XNRG_WEB_DIR?= nrg XNRG_WEB_TITLE?= FreeBSD NRG Homepage X XPLIST= ${WRKDIR}/plist XUSE_REINPLACE= yes XHAS_CONFIGURE= yes XCONFIGURE_ARGS= --prefix=${LOCALBASE}/nrg XALL_TARGET= pingd X Xpre-fetch: X @${ECHO} "" X @${ECHO} "You may use the following build options:" X @${ECHO} "" X @${ECHO} " -DWITH_APCNISCLIENT to build collector for nrg-apcupsdstat" X @${ECHO} "" X X.if defined(WITH_APCNISCLIENT) XEXTRA_PATCHES+= ${PATCHDIR}/nrg-apcupsdstat.patch X.endif X Xpost-patch: X @${REINPLACE_CMD} -e "s,= @WEB_PREFIX@,= ${NRG_WEB_PREFIX},g" \ X -e "s,= @NRG_WEB_DIR@,= ${NRG_WEB_DIR},g" \ X -e "s,= @NRG_WEB_TITLE@,= \"${NRG_WEB_TITLE}\",g" \ X ${WRKSRC}/examples/Makefile.ops.in X Xpre-install: X.if defined(WITH_APCNISCLIENT) X @${ECHO} "nrg/bin/nrg-apcupsdstat" >${PLIST} X @${CAT} ${PKGDIR}/pkg-plist >>${PLIST} X.else X @${CAT} ${PKGDIR}/pkg-plist >${PLIST} X.endif X Xpost-install: X @${INSTALL_SCRIPT} ${FILESDIR}/run-nrg.sh ${PREFIX}/nrg/ X @${ECHO} X @${SED} 's|%%PREFIX%%|${PREFIX}|g' ${PKGMESSAGE} X @${ECHO} X X.include <bsd.port.mk> END-of-nrg/Makefile echo c - nrg/files mkdir -p nrg/files > /dev/null 2>&1 echo x - nrg/files/patch-examples sed 's/^X//' >nrg/files/patch-examples << 'END-of-nrg/files/patch-examples' X*** examples/Makefile.ops.in.orig Sun Jul 20 20:51:10 2003 X--- examples/Makefile.ops.in Sun Jan 18 15:52:30 2004 X*************** X*** 4,13 **** X # $Id: Makefile.ops.in,v 1.41 2003/07/20 15:16:04 rader Exp $ X # X X! WEB_PREFIX = /usr/local/web/html X! NRG_WEB_TITLE = "Somesite's NRG Home Page" X MCONF_FILES = NRG.mconf Site.mconf X! NRG_WEB_DIR = nrg X X prefix = @prefix@ X exec_prefix = @prefix@ X--- 4,13 ---- X # $Id: Makefile.ops.in,v 1.41 2003/07/20 15:16:04 rader Exp $ X # X X! WEB_PREFIX = @WEB_PREFIX@ X! NRG_WEB_TITLE = @NRG_WEB_TITLE@ X MCONF_FILES = NRG.mconf Site.mconf X! NRG_WEB_DIR = @NRG_WEB_DIR@ X X prefix = @prefix@ X exec_prefix = @prefix@ END-of-nrg/files/patch-examples echo x - nrg/files/run-nrg.sh sed 's/^X//' >nrg/files/run-nrg.sh << 'END-of-nrg/files/run-nrg.sh' X#!/bin/sh X XLOG=/var/log/run-nrg.log X X#renice 5 -p $$ >/dev/null 2>&1 X/usr/local/nrg/run-nrg >$LOG X#/usr/local/nrg/run-nrg.local >>$LOG END-of-nrg/files/run-nrg.sh echo x - nrg/files/patch-nrg-apachestat sed 's/^X//' >nrg/files/patch-nrg-apachestat << 'END-of-nrg/files/patch-nrg-apachestat' X*** collectors/nrg-apachestat.in.orig Sun Jan 18 17:19:10 2004 X--- collectors/nrg-apachestat.in Sun Jan 18 17:18:57 2004 X*************** X*** 11,17 **** X $mode = "requests"; X $server = "localhost"; X $port = "80"; X! $url = "server-status"; X $stamp = 0; X $stat = 0; X X--- 11,17 ---- X $mode = "requests"; X $server = "localhost"; X $port = "80"; X! $url = "server-status?auto"; X $stamp = 0; X $stat = 0; X X*************** X*** 88,102 **** X # parse the stats... X X while(<SOCK>) { X if ( $_ =~ /Server uptime:/ ) { X if ( $_ =~ /(\d+) hour/ ) { $uptime += $1*60*60; } X if ( $_ =~ /(\d+) minute/ ) { $uptime += $1*60; } X if ( $_ =~ /(\d+) second/ ) { $uptime += $1; } X } X! if ( $mode eq 'requests' && $_ =~ /Total accesses: (\d+)/ ) { X $stat = $1; X &debug("$stat accesses\n"); X! last; X } X if ( $mode eq 'bytes' && $_ =~ /Total Traffic: (\d+) kB/ ) { X $stat = $1*1024; X--- 88,111 ---- X # parse the stats... X X while(<SOCK>) { X+ if ( $_ =~ /Uptime: (\d+)/ ) { X+ $uptime = $1; X+ last; X+ } X if ( $_ =~ /Server uptime:/ ) { X if ( $_ =~ /(\d+) hour/ ) { $uptime += $1*60*60; } X if ( $_ =~ /(\d+) minute/ ) { $uptime += $1*60; } X if ( $_ =~ /(\d+) second/ ) { $uptime += $1; } X } X! if ( $mode eq 'requests' && $_ =~ /Total accesses: (\d+)/i ) { X $stat = $1; X &debug("$stat accesses\n"); X! last if $url !~ /auto$/; X! } X! if ( $mode eq 'bytes' && $_ =~ /Total kBytes: (\d+)/ ) { X! $stat = $1*1024; X! &debug("$stat bytes\n"); X! last if $url !~ /auto$/; X } X if ( $mode eq 'bytes' && $_ =~ /Total Traffic: (\d+) kB/ ) { X $stat = $1*1024; X*************** X*** 105,110 **** X--- 114,124 ---- X } X if ( $mode eq 'bytes' && $_ =~ /Total Traffic: (\d+)\.(\d) MB/ ) { X $stat = ($1*1024*1024) + (($2/10)*1024*1024); X+ &debug("$stat bytes\n"); X+ last; X+ } X+ if ( $mode eq 'bytes' && $_ =~ /Total Traffic: (\d+)\.(\d) GB/ ) { X+ $stat = ($1*1024*1024*1024) + (($2/10)*1024*1024*1024); X &debug("$stat bytes\n"); X last; X } END-of-nrg/files/patch-nrg-apachestat echo x - nrg/files/patch-nrg-sendmailstat sed 's/^X//' >nrg/files/patch-nrg-sendmailstat << 'END-of-nrg/files/patch-nrg-sendmailstat' X*** collectors/nrg-sendmailstat.in.orig Sun Jan 18 18:30:46 2004 X--- collectors/nrg-sendmailstat.in Sun Jan 18 18:31:29 2004 X*************** X*** 13,19 **** X X $mode = 'msgs'; X $server = 'localhost'; X! $port = '88889'; X $stamp = '0'; X $stat = '0'; X X--- 13,19 ---- X X $mode = 'msgs'; X $server = 'localhost'; X! $port = '28889'; X $stamp = '0'; X $stat = '0'; X END-of-nrg/files/patch-nrg-sendmailstat echo x - nrg/files/patch-nrg-bindstat sed 's/^X//' >nrg/files/patch-nrg-bindstat << 'END-of-nrg/files/patch-nrg-bindstat' X*** collectors/nrg-bindstat.in.orig Sun Jan 18 18:30:39 2004 X--- collectors/nrg-bindstat.in Sun Jan 18 18:31:34 2004 X*************** X*** 24,30 **** X $version = "4.9.6"; X $mode = "queries"; X $server = "localhost"; X! $port = "88888"; X $stamp = 0; X $stat = 0; X X--- 24,30 ---- X $version = "4.9.6"; X $mode = "queries"; X $server = "localhost"; X! $port = "28888"; X $stamp = 0; X $stat = 0; X END-of-nrg/files/patch-nrg-bindstat echo x - nrg/files/nrg-apcupsdstat.patch sed 's/^X//' >nrg/files/nrg-apcupsdstat.patch << 'END-of-nrg/files/nrg-apcupsdstat.patch' X*** Makefile.in.orig Sun Jan 18 17:28:08 2004 X--- Makefile.in Sun Jan 18 17:27:53 2004 X*************** X*** 19,25 **** X CONTRIB_DIR = ${prefix}/contrib X X BIN_FILES = \ X! dsreport mrtg2nrg nrg-apachestat nrg-autoconf \ X nrg-bindresponse nrg-bindstat nrg-bindstatd \ X nrg-cgikeeper nrg-discover-apache nrg-discover-bind \ X nrg-discover-errors nrg-discover-ifaces nrg-discover-netdev \ X--- 19,25 ---- X CONTRIB_DIR = ${prefix}/contrib X X BIN_FILES = \ X! dsreport mrtg2nrg nrg-apachestat nrg-apcupsdstat nrg-autoconf \ X nrg-bindresponse nrg-bindstat nrg-bindstatd \ X nrg-cgikeeper nrg-discover-apache nrg-discover-bind \ X nrg-discover-errors nrg-discover-ifaces nrg-discover-netdev \ X*** configure.orig Sun Jul 20 20:51:09 2003 X--- configure Sun Jan 18 17:50:34 2004 X*************** X*** 2019,2024 **** X--- 2019,2025 ---- X Makefile \ X collectors/nrg-apmstat \ X collectors/nrg-apachestat \ X+ collectors/nrg-apcupsdstat \ X collectors/nrg-bindresponse \ X collectors/nrg-bindstat \ X collectors/nrg-bindstatd \ X*************** X*** 2189,2194 **** X--- 2190,2196 ---- X Makefile \ X collectors/nrg-apmstat \ X collectors/nrg-apachestat \ X+ collectors/nrg-apcupsdstat \ X collectors/nrg-bindresponse \ X collectors/nrg-bindstat \ X collectors/nrg-bindstatd \ X*************** X*** 2312,2317 **** X--- 2314,2320 ---- X X for f in \ X collectors/nrg-apachestat \ X+ collectors/nrg-apcupsdstat \ X collectors/nrg-bindresponse \ X collectors/nrg-bindstat \ X collectors/nrg-bindstatd \ X*** collectors/nrg-apcupsdstat.in.orig Sun Jan 18 17:26:14 2004 X--- collectors/nrg-apcupsdstat.in Sun Jan 18 17:25:55 2004 X*************** X*** 0 **** X--- 1,146 ---- X+ #!@PERL@ X+ # X+ # nrg-apcupsdstat - a nrg collector for reporting apcupsd statistics X+ # X+ # options: temp and battery X+ # X+ # michael ranner <mranner@inode.at> X+ # X+ # $Id$ X+ # X+ X+ $mode = 'battery'; X+ $server = 'localhost'; X+ $port = '7000'; X+ $stamp = '0'; X+ $stat = '0'; X+ $apcnisclient = "/usr/local/bin/apcnisclient"; X+ X+ #------------------------------------------------------------------ X+ # parse argv... X+ X+ while ( $ARGV[0] =~ /^-/ ) { X+ $arg = $ARGV[0]; X+ if ( $arg =~ /^-d/ ) { X+ $debug = 1; X+ shift @ARGV; X+ } elsif ( $arg =~ /^-p/ ) { X+ $port = $ARGV[1]; X+ shift @ARGV; shift @ARGV; X+ } elsif ( $arg =~ /^-m/ ) { X+ $mode = $ARGV[1]; X+ shift @ARGV; shift @ARGV; X+ } else { X+ print "unknown option: \"$arg\"\n"; X+ &usage; X+ exit 1; X+ } X+ $i++; X+ } X+ X+ if ( $#ARGV != 0 ) { X+ print "usage: nrg-apcupsdstat [args] apc_server\n"; X+ exit; X+ } X+ $server = $ARGV[0]; X+ X+ if ( $debug ) { X+ $date = `date`; chop $date; X+ print "nrg-apcupsdstat: started in debug mode at $date\n"; X+ print "nrg-apcupsdstat: contacting $server at $port\n"; X+ } X+ X+ if ( $mode ne 'load' && $mode ne 'temp' && $mode ne 'battery' X+ && $mode ne 'inv' && $mode ne 'outv' && $mode ne 'battv' ) { X+ print "unknown mode: \"$mode\"\n"; X+ &usage; X+ exit 1; X+ } X+ X+ #------------------------------------------------------------------ X+ # get the stats from apc nis client... X+ X+ if ( $port !~ /^\d+$/ ) { X+ $port = getservbyname($port,'tcp') || &abend; X+ } X+ X+ open(CLIENT, "$apcnisclient $server:$port status|"); X+ X+ while(<CLIENT>) { X+ push(@details, $_); X+ } X+ close(CLIENT); X+ X+ if ( ! @details ) { &abend; } X+ X+ #------------------------------------------------------------------ X+ # parse the stats... X+ X+ foreach $_ (@details) { X+ ($n, $stamp) = split(": ") if /^DATE/; X+ X+ if ($mode eq "battery") { X+ next if !/^BCHARGE/; X+ ($k, $n, $stat) = split; X+ last; X+ } elsif ($mode eq "battv") { X+ next if !/^BATTV/; X+ ($k, $n, $stat) = split; X+ last; X+ } elsif ($mode eq "inv") { X+ next if !/^LINEV/; X+ ($k, $n, $stat) = split; X+ last; X+ } elsif ($mode eq "load") { X+ next if !/^LOADPCT/; X+ ($k, $n, $stat) = split; X+ last; X+ } elsif ($mode eq "temp") { X+ next if !/^ITEMP/; X+ ($k, $n, $stat) = split; X+ last; X+ } elsif ($mode eq "outv") { X+ next if !/^OUTPUTV/; X+ ($k, $n, $stat) = split; X+ last; X+ } X+ X+ } X+ X+ $stamp = time; X+ X+ #------------------------------------------------------------------ X+ # print out nrg collector format output... X+ X+ if ( ! $stamp || ! $stat ) { X+ #print "nrg-apcupsdstat: could not get stats from $server!\n"; X+ $stamp = time; X+ $details = "no stats from $server"; X+ } else { X+ $details = "$stat $mode GAUGE"; X+ } X+ X+ $localtime = scalar localtime($stamp); X+ print "$stamp $localtime\n"; X+ print "INF uptime\n"; # FIXME X+ print "$details\n"; X+ X+ exit; X+ X+ #================================================================== X+ X+ sub usage { X+ print "usage: nrg-apcupsdstat [-d] [-p port] [-m mode] apc_server\n"; X+ } X+ X+ #------------------------------------------------------------------ X+ X+ sub abend { X+ if ( $debug) {"nrg-sendmail: connection to $server:$port failed\n";} X+ $stamp = time; X+ $localtime = scalar localtime($stamp); X+ print "$stamp $localtime\n"; X+ print "INF uptime\n"; X+ print "connection to $server port $port failed\n"; X+ exit; X+ } END-of-nrg/files/nrg-apcupsdstat.patch echo x - nrg/pkg-message sed 's/^X//' >nrg/pkg-message << 'END-of-nrg/pkg-message' X************************************************************ X XFor configuration and upgrade, please read file located at: X%%PREFIX%%/nrg/html/index.html X XAfer configuration add the next line to crontab: X*/5 * * * * %%PREFIX%%/nrg/run-nrg.sh X X************************************************************ END-of-nrg/pkg-message exit --- nrg.shar ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401181750.i0IHopbm090774>