# $Id: Portfile,v 1.4 2005/10/30 22:57:26 markd Exp $ PortSystem 1.0 name nrg version 0.99.24 categories net maintainers dports@mac.com platforms darwin description Network Resource Grapher long_description NRG is an RRDtool front-end tool to monitor traffic and load \ on network links or any other resource utilization source. It \ automatically creates and maintains web pages and RRDtool databases, \ while providing short and long-term graph web pages just like MRTG. homepage http://nrg.hep.wisc.edu/ master_sites ftp://noc.hep.wisc.edu/pub/src/nrg/ \ ftp://noc.hep.wisc.edu/pub/src/nrg/old-versions checksums md5 09a1125c7b9430c260f902ce20bd9d3e depends_lib port:rrdtool patchfiles patch-nrg-discover-netdev.in.diff \ patch-nrg-discover-tcp.in.diff \ patch-roverpingd-receive.c.diff configure.pre_args --prefix=${prefix}/var/${name} configure.args --bindir=${prefix}/bin \ --sysconfdir=${prefix}/etc/${name} \ --datadir=${prefix}/share \ CFLAGS="-D__FreeBSD__" variant darwin powerpc { configure.args-append --build=powerpc-unknown-freebsd } build.target pingd destroot.target install.pingd install # Maintain empty directories destroot.keepdirs ${destroot}${prefix}/var/${name}/archive post-patch { ### NET-SNMP Bugs ### reinplace "s|@SNMPWALK@|@SNMPWALK@ -v1|g" \ "${worksrcpath}/discoverers/nrg-discover-errors.in" reinplace "s|@SNMPGET@|@SNMPGET@ -v1|g" \ ${worksrcpath}/discoverers/nrg-discover-errors.in \ ${worksrcpath}/discoverers/nrg-discover-netdev.in reinplace "s|\$args \$host \$comm_str|\$args -c \$comm_str \$host|g" \ ${worksrcpath}/discoverers/nrg-discover-errors.in \ ${worksrcpath}/discoverers/nrg-discover-snmpd.in \ ${worksrcpath}/discoverers/nrg-discover-netdev.in reinplace "s|/usr/bin/snmpget|/usr/bin/snmpget -v1|g" \ ${worksrcpath}/discoverers/nrg-discover-netdev.in \ ${worksrcpath}/discoverers/nrg-discover-snmpd.in reinplace "s|/usr/bin/snmpwalk|/usr/bin/snmpwalk -v1|g" \ ${worksrcpath}/discoverers/nrg-discover-snmpd.in reinplace "s|\$snmp_args \$system -c \$passwd|\$snmp_args -c \$passwd \$system|g" \ "${worksrcpath}/etc/run-star-tail.pl.in" ### Misc bugs ### reinplace "s|-idx||g" \ "${worksrcpath}/examples/Site.mconf" reinplace "s|/usr/local/nrg-test|@prefix@|g" \ "${worksrcpath}/examples/Default.conf.in" reinplace "s|*ping-data|*ping-latency|g" \ "${worksrcpath}/examples/Default.conf.in" reinplace "s|\$target-\$host-ping-data|\$target-\$host-ping-latency|g" \ "${worksrcpath}/templates/discover-pingd.tm" ### roverpingd fix ### reinplace "s|||g" \ ${worksrcpath}/roverpingd/send.c \ ${worksrcpath}/roverpingd/pingd.c \ ${worksrcpath}/roverpingd/read_list.c reinplace "s|||g" \ "${worksrcpath}/roverpingd/write_stats.c" reinplace "s|MAXINT|INT_MAX|g" \ "${worksrcpath}/roverpingd/write_stats.c" #### Fix paths #### reinplace "s|@prefix@/bin|@bindir@|g" \ ${worksrcpath}/etc/run-star-head.pl.in \ ${worksrcpath}/examples/NRG.mconf.in eval reinplace "s|@prefix@/bin|@bindir@|g" \ [glob ${worksrcpath}/discoverers/*.in] reinplace "s|@prefix@/etc|@sysconfdir@|g" \ ${worksrcpath}/discoverers/nrg-discover-pingd.in \ ${worksrcpath}/collectors/nrg-pingdstat.in \ ${worksrcpath}/roverpingd/pingd.h.in eval reinplace "s|@prefix@|${prefix}|g" [glob ${worksrcpath}/templates/*.in] reinplace "s|Somesite's NRG Home Page|NRG Home Page|g" \ "${worksrcpath}/examples/Makefile.ops.in" reinplace "s|exec_prefix = @prefix@|exec_prefix = ${destroot}@prefix@|g" \ ${worksrcpath}/Makefile.in reinplace "s|prefix = @prefix@|prefix = ${destroot}@prefix@|g" \ ${worksrcpath}/Makefile.in reinplace "s|BIN_DIR = @bindir@|BIN_DIR = ${destroot}@bindir@|g" \ ${worksrcpath}/Makefile.in reinplace "s|ETC_DIR = \${prefix}/etc|ETC_DIR = ${destroot}@sysconfdir@|g" \ ${worksrcpath}/Makefile.in reinplace "s|TEMPLATE_DIR = \${prefix}/templates|TEMPLATE_DIR = ${destroot}@prefix@/templates|g" \ ${worksrcpath}/Makefile.in reinplace "s|EXAMPLE_DIR = \${prefix}/examples|EXAMPLE_DIR = ${destroot}@datadir@/doc/nrg/examples|g" \ ${worksrcpath}/Makefile.in reinplace "s|HTML_DIR = \${prefix}/html|HTML_DIR = ${destroot}@datadir@/doc/nrg/html|g" \ ${worksrcpath}/Makefile.in reinplace "s|ARCHIVE_DIR = \${prefix}/archive|ARCHIVE_DIR = ${destroot}@prefix@/archive|g" \ ${worksrcpath}/Makefile.in reinplace "s|CONTRIB_DIR = \${prefix}/contrib|CONTRIB_DIR = ${destroot}@datadir@/doc/nrg/contrib|g" \ ${worksrcpath}/Makefile.in } post-destroot { # Install images to \${prefix}/var/nrg/web/icons xinstall -d -m 755 ${destroot}${prefix}/var/${name}/web/icons eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}${prefix}/var/${name}/web/icons # Copy roverpingd.init to contrib xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/contrib xinstall -m 755 ${worksrcpath}/contrib/roverpingd.init ${destroot}${prefix}/share/doc/${name}/contrib } post-activate { ui_msg "\n#### To complete the NRG installation #### 1) Make a symlink in your Apache document root to the NRG data directory (${prefix}/var/nrg/web): sudo ln -s ${prefix}/var/nrg/web /nrg 3) Modify your httpd.conf file for NRG graph pages: Uncomment lines: AddHandler cgi-script .cgi LoadModule expires_module libexec/httpd/mod_expires.so AddModule mod_expires.c Add directives: /nrg> Options ExecCGI ExpiresActive On ExpiresDefault M5 Change the Apache user and group to the NRG user and group so Apache will have permissions to create graphs when you click an RRD file link. User Group 4) Change the web root variables at the top of files Makefile and Site.mconf in directory ${prefix}/var/${name} to your Apache document root location. #### To use NRG #### 1) Set meta-configuration definitions in the Site.mconf file for each resource you want to graph by following the example meta-configuration definitions in ${prefix}/share/doc/nrg/examples. 2) Have NRG generate rrd files and html graph pages (and modify them after Site.mconf changes): cd ${prefix}/var/${name} make rediscover make notify 3) Schedule the script ${prefix}/var/${name}/run-nrg to run via cron every five minutes to poll your data sources and update the rrd files. Be sure to read the documentation in ${prefix}/share/doc/${name}/html for creating custom graphs or for more information.\n" }