source: trunk/dports/net/nrg/Portfile @ 14894

Last change on this file since 14894 was 14894, checked in by markd, 14 years ago

Bug:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
Fixed ui_msg error only

  • Property svn:eol-style set to native
File size: 6.8 KB
Line 
1# $Id: Portfile,v 1.5 2005/10/31 06:52:42 markd Exp $
2
3PortSystem      1.0
4
5name                            nrg   
6version                         0.99.24
7
8categories                      net
9maintainers                     dports@mac.com
10platforms                       darwin
11
12description                     Network Resource Grapher
13
14long_description                NRG is an RRDtool front-end tool to monitor traffic and load \
15                                on network links or any other resource utilization source.  It \
16                                automatically creates and maintains web pages and RRDtool databases, \
17                                while providing short and long-term graph web pages just like MRTG.
18
19homepage                        http://nrg.hep.wisc.edu/
20                                       
21master_sites                    ftp://noc.hep.wisc.edu/pub/src/nrg/ \
22                                ftp://noc.hep.wisc.edu/pub/src/nrg/old-versions
23
24checksums                       md5 09a1125c7b9430c260f902ce20bd9d3e
25
26depends_lib                     port:rrdtool
27
28patchfiles                      patch-nrg-discover-netdev.in.diff \
29                                patch-nrg-discover-tcp.in.diff \
30                                patch-roverpingd-receive.c.diff
31
32configure.pre_args      --prefix=${prefix}/var/${name}
33configure.args                  --bindir=${prefix}/bin \
34                                --sysconfdir=${prefix}/etc/${name} \
35                                --datadir=${prefix}/share \
36                                CFLAGS="-D__FreeBSD__"
37
38variant darwin powerpc {
39        configure.args-append   --build=powerpc-unknown-freebsd
40}
41
42
43build.target                    pingd
44destroot.target                 install.pingd install
45
46# Maintain empty directories
47destroot.keepdirs ${destroot}${prefix}/var/${name}/archive
48
49post-patch {
50
51### NET-SNMP Bugs ###
52
53        reinplace "s|@SNMPWALK@|@SNMPWALK@ -v1|g" \
54                "${worksrcpath}/discoverers/nrg-discover-errors.in"
55
56        reinplace "s|@SNMPGET@|@SNMPGET@ -v1|g" \
57                ${worksrcpath}/discoverers/nrg-discover-errors.in \
58                ${worksrcpath}/discoverers/nrg-discover-netdev.in
59
60        reinplace "s|\$args \$host \$comm_str|\$args -c \$comm_str \$host|g" \
61                ${worksrcpath}/discoverers/nrg-discover-errors.in \
62                ${worksrcpath}/discoverers/nrg-discover-snmpd.in \
63                ${worksrcpath}/discoverers/nrg-discover-netdev.in
64
65        reinplace "s|/usr/bin/snmpget|/usr/bin/snmpget -v1|g" \
66                ${worksrcpath}/discoverers/nrg-discover-netdev.in \
67                ${worksrcpath}/discoverers/nrg-discover-snmpd.in
68
69        reinplace "s|/usr/bin/snmpwalk|/usr/bin/snmpwalk -v1|g" \
70                ${worksrcpath}/discoverers/nrg-discover-snmpd.in
71
72        reinplace "s|\$snmp_args \$system -c \$passwd|\$snmp_args -c \$passwd \$system|g" \
73                "${worksrcpath}/etc/run-star-tail.pl.in"
74
75### Misc bugs ###
76
77        reinplace "s|-idx||g" \
78                "${worksrcpath}/examples/Site.mconf"
79
80        reinplace "s|/usr/local/nrg-test|@prefix@|g" \
81                "${worksrcpath}/examples/Default.conf.in"
82
83        reinplace "s|*ping-data|*ping-latency|g" \
84                "${worksrcpath}/examples/Default.conf.in"
85
86        reinplace "s|\$target-\$host-ping-data|\$target-\$host-ping-latency|g" \
87                "${worksrcpath}/templates/discover-pingd.tm"
88
89### roverpingd fix ###
90
91        reinplace "s|<malloc.h>|<stdlib.h>|g" \
92                ${worksrcpath}/roverpingd/send.c \
93                ${worksrcpath}/roverpingd/pingd.c \
94                ${worksrcpath}/roverpingd/read_list.c
95
96        reinplace "s|<values.h>|<limits.h>|g" \
97                "${worksrcpath}/roverpingd/write_stats.c"
98
99        reinplace "s|MAXINT|INT_MAX|g" \
100                "${worksrcpath}/roverpingd/write_stats.c"
101       
102#### Fix paths ####
103
104        reinplace "s|@prefix@/bin|@bindir@|g" \
105                ${worksrcpath}/etc/run-star-head.pl.in \
106                ${worksrcpath}/examples/NRG.mconf.in
107
108        eval reinplace "s|@prefix@/bin|@bindir@|g" \
109                [glob ${worksrcpath}/discoverers/*.in]
110
111        reinplace "s|@prefix@/etc|@sysconfdir@|g" \
112                ${worksrcpath}/discoverers/nrg-discover-pingd.in \
113                ${worksrcpath}/collectors/nrg-pingdstat.in \
114                ${worksrcpath}/roverpingd/pingd.h.in
115
116        eval reinplace "s|@prefix@|${prefix}|g" [glob ${worksrcpath}/templates/*.in]
117
118        reinplace "s|Somesite's NRG Home Page|NRG Home Page|g" \
119                "${worksrcpath}/examples/Makefile.ops.in"
120
121        reinplace "s|exec_prefix = @prefix@|exec_prefix = ${destroot}@prefix@|g" \
122                ${worksrcpath}/Makefile.in
123
124        reinplace "s|prefix = @prefix@|prefix = ${destroot}@prefix@|g" \
125                ${worksrcpath}/Makefile.in
126
127        reinplace "s|BIN_DIR = @bindir@|BIN_DIR = ${destroot}@bindir@|g" \
128                ${worksrcpath}/Makefile.in
129
130        reinplace "s|ETC_DIR = \${prefix}/etc|ETC_DIR = ${destroot}@sysconfdir@|g" \
131                ${worksrcpath}/Makefile.in
132
133        reinplace "s|TEMPLATE_DIR = \${prefix}/templates|TEMPLATE_DIR = ${destroot}@prefix@/templates|g" \
134                ${worksrcpath}/Makefile.in
135
136        reinplace "s|EXAMPLE_DIR = \${prefix}/examples|EXAMPLE_DIR = ${destroot}@datadir@/doc/nrg/examples|g" \
137                ${worksrcpath}/Makefile.in
138
139        reinplace "s|HTML_DIR = \${prefix}/html|HTML_DIR = ${destroot}@datadir@/doc/nrg/html|g" \
140                ${worksrcpath}/Makefile.in
141
142        reinplace "s|ARCHIVE_DIR = \${prefix}/archive|ARCHIVE_DIR = ${destroot}@prefix@/archive|g" \
143                ${worksrcpath}/Makefile.in
144
145        reinplace "s|CONTRIB_DIR = \${prefix}/contrib|CONTRIB_DIR = ${destroot}@datadir@/doc/nrg/contrib|g" \
146                ${worksrcpath}/Makefile.in
147
148}
149
150post-destroot {
151# Install images to \${prefix}/var/nrg/web/icons
152xinstall -d -m 755 ${destroot}${prefix}/var/${name}/web/icons
153eval xinstall -m 755 [glob ${worksrcpath}/images/*.*] ${destroot}${prefix}/var/${name}/web/icons
154
155# Copy roverpingd.init to contrib
156xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/contrib
157xinstall -m 755 ${worksrcpath}/contrib/roverpingd.init ${destroot}${prefix}/share/doc/${name}/contrib
158}
159
160post-activate {
161
162ui_msg "\n#### To complete the NRG installation ####
163
1641) Make a symlink in your Apache document root to the NRG data directory
165      (${prefix}/var/nrg/web):
166
167      sudo ln -s ${prefix}/var/nrg/web <Apache document root>/nrg
168
1692) Modify your httpd.conf file for NRG graph pages:
170
171Uncomment lines:   AddHandler cgi-script .cgi
172                   LoadModule expires_module   libexec/httpd/mod_expires.so
173                   AddModule mod_expires.c
174
175Add directives:    <Directory <Apache document root>/nrg>
176                      Options ExecCGI
177                   </Directory>
178                       
179                   <Files \"*.gif\">
180                      ExpiresActive On
181                      ExpiresDefault M5
182                   </Files>
183
184Change the Apache user and group to the NRG user and group so Apache will
185have permissions to create graphs when you click an RRD file link.
186
187                   User <nrg-user>
188                   Group <nrg-group>
189
1903) Change the web root variables at the top of files Makefile and Site.mconf
191   in directory ${prefix}/var/${name} to your Apache document root location.
192
193#### To use NRG ####
194
1951) Set meta-configuration definitions in the Site.mconf file for each
196   resource you want to graph by following the example meta-configuration
197   definitions in ${prefix}/share/doc/nrg/examples.
198
1992) Have NRG generate rrd files and html graph pages (and modify them after
200   Site.mconf changes):
201
202      cd ${prefix}/var/${name}
203      make rediscover
204      make notify
205
2063) Schedule the script ${prefix}/var/${name}/run-nrg to run via cron every five
207   minutes to poll your data sources and update the rrd files.
208
209Be sure to read the documentation in ${prefix}/share/doc/${name}/html for
210creating custom graphs or for more information.\n"
211
212}
213
Note: See TracBrowser for help on using the repository browser.