Ticket #37585: Portfile

File Portfile, 6.9 KB (added by markd@…, 11 years ago)

Update to smokeping 2.6.8 (not a diff)

Line 
1# $Id: Portfile 82553 2011-08-15 19:22:39Z jmr@macports.org $
2
3PortSystem 1.0
4
5PortGroup               perl5 1.0
6
7name                    smokeping
8version                 2.6.8
9categories              net perl
10maintainers             markd openmaintainer
11description             A deluxe latency logging and graphing system.
12long_description        SmokePing is a deluxe latency measurement tool. \
13                        It can measure, store, and display latency, latency \
14                        distribution, and packet loss. SmokePing uses RRDtool \
15                        to maintain a longterm data-store and to draw pretty \
16                        graphs, giving up to the minute information on the \
17                        state of each network connection.
18
19platforms               darwin
20homepage                http://oss.oetiker.ch/smokeping/
21master_sites            http://oss.oetiker.ch/smokeping/pub/
22checksums               md5 14a968daab2d17a27d41600077e3e967
23
24patchfiles              patch-etc-config.dist \
25                        patch-bin-smokeping \
26                        patch-bin-tSmoke \
27
28depends_lib-append      port:perl5.12 \
29                        port:mod_fastcgi \
30                        port:p5-fcgi \
31                        port:apache2 \
32                        port:rrdtool \
33                        port:p5.12-libwww-perl \
34                        port:p5.12-socket6 \
35                        port:p5.12-net-snmp \
36                        port:p5.12-net-telnet \
37                        port:p5.12-net-dns \
38                        port:p5.12-net-radius \
39                        port:p5.12-perl-ldap \
40                        port:p5.12-io-socket-ssl \
41                        port:p5.12-pathtools \
42                        port:p5.12-snmp_session \
43                        port:fping \
44                        port:curl
45
46set smokeroot ${prefix}/lib/smokeping
47set smokedata ${prefix}/var/smokeping
48set smokeetc ${prefix}/etc/smokeping
49set smokedoc ${prefix}/share/doc/smokeping
50set macports_apache_docroot ${prefix}/apache2/htdocs
51
52        startupitem.create      yes
53        startupitem.name        smokeping
54        startupitem.executable  ${prefix}/bin/smokeping --nodaemon
55
56
57post-patch {
58        reinplace "s|__PREFIX__|${prefix}|g" \
59                ${worksrcpath}/bin/smokeping \
60                ${worksrcpath}/bin/tSmoke \
61                ${worksrcpath}/etc/config.dist \
62                ${worksrcpath}/etc/smokemail.dist
63
64        reinplace "s|__PERL5__ARCHLIB__|${perl5.archlib}|g" \
65                ${worksrcpath}/bin/smokeping \
66                ${worksrcpath}/bin/tSmoke \
67
68#       eval reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|g" \
69#                [glob ${worksrcpath}/bin/*.dist] \
70#                [glob ${worksrcpath}/etc/*.dist] \
71
72        reinplace "s|/usr/bin/|${prefix}/bin/|g" \
73                ${worksrcpath}/lib/Smokeping.pm \
74                ${worksrcpath}/lib/Smokeping/Examples.pm \
75                ${worksrcpath}/lib/Smokeping/probes/Curl.pm \
76                ${worksrcpath}/lib/Smokeping/probes/RemoteFPing.pm \
77                ${worksrcpath}/lib/Smokeping/probes/SSH.pm \
78                ${worksrcpath}/lib/Smokeping/probes/FPing6.pm \
79                ${worksrcpath}/lib/Smokeping/probes/EchoPing.pm \
80                ${worksrcpath}/lib/Smokeping/probes/FPing.pm
81
82        reinplace "s|/usr/share/smokeping/etc|${smokeetc}|g" \
83                ${worksrcpath}/lib/Smokeping/probes/passwordchecker.pm
84}
85
86#destroot {
87# bin
88#       xinstall -m 755 -d ${destroot}${prefix}/bin
89#       xinstall -m 755 ${worksrcpath}/bin/smokeping.dist ${destroot}${prefix}/bin/smokeping
90#       xinstall -m 755 ${worksrcpath}/bin/tSmoke.dist ${destroot}${prefix}/bin/tSmoke
91
92# doc
93#       xinstall -m 755 -d ${destroot}${smokedoc}
94#       system "cp -R ${worksrcpath}/doc/ ${destroot}${smokedoc}"
95#       file copy ${worksrcpath}/README ${destroot}${smokedoc}
96#       file copy ${worksrcpath}/TODO ${destroot}${smokedoc}
97
98# etc
99# Leave the config.dist filename for users to remove so upgrades won't destroy the config file.
100#       xinstall -m 755 -d ${destroot}${smokeetc}
101#       eval xinstall -m 640 [glob ${worksrcpath}/etc/*.dist] ${destroot}${smokeetc}
102
103# lib
104#       system "cp -R ${worksrcpath}/lib/ ${destroot}${smokeroot}"
105
106# Smokeping data directory that needs to be symlinked to Apache docroot
107#       xinstall -m 755 -d ${destroot}${smokedata}
108
109# Smokeping log directory
110#       xinstall -m 755 -d ${destroot}${smokedata}/log
111
112# htdocs
113#        xinstall -m 755 ${worksrcpath}/htdocs/smokeping.cgi.dist \
114#                ${destroot}${smokedata}/smokeping.cgi
115#        xinstall -m 755 -d ${destroot}${smokedata}/cropper
116#        system "cp -R ${worksrcpath}/htdocs/cropper/ ${destroot}${smokedata}/cropper"
117
118# Retain these empty directories
119#       destroot.keepdirs ${destroot}${smokedata}/log
120#}
121
122post-activate {
123ui_msg "\n  #### To complete the Smokeping installation ####
124
1251) Enable mod_fastcgi (installed as a dependency of Smokeping) for MacPorts Apache 2.
126
127   -Rdd the line below to ${prefix}/apache2/conf/httpd.conf.
128
129        LoadModule fastcgi_module modules/mod_fastcgi.so
130
131
1322)  Changes to httpd.conf for Smokeping.
133
134   -Uncomment this line to enable the CGI script handler.
135
136        AddHandler cgi-script .cgi
137
138   -Add a directive for Smokeping's data directory and add
139    smokeping.cgi to DirectoryIndex for a simple /smokeping url.
140
141        Alias /smokeping \"${prefix}/var/smokeping\"
142        <Directory \"${prefix}/var/smokeping\">
143            Allow from all
144            Options ExecCGI
145        </Directory>
146
147        <IfModule dir_module>
148            DirectoryIndex index.html smokeping.cgi
149        </IfModule>
150
151
1523) Set Smokeping data directory permissions to the Apache user and group set
153   in httpd.conf.  The default Apache user and group for OS X is www.
154
155        sudo chown -R <smokeping-user>:<smokeping-group> ${smokedata}/
156
157
1584) Setup Smokeping logging.
159
160   -Add this statement to /etc/syslog.conf.
161
162   local1.*     ${smokedata}/log/smokeping.log
163
164   -Create a logfile to receive the log messages.
165
166        cd ${smokedata}/log
167        sudo touch smokeping.log
168        sudo chmod 600 smokeping.log
169        sudo chown root:admin smokeping.log
170
171   -Then restart the syslog facility.
172
173        sudo kill -HUP `cat /var/run/syslog.pid`
174
175
1765) Rename and edit the ${smokeetc}/config sample files, then test your config file.
177
178   -Remove the .dist extension from all files; do not change the filenames.
179
180        cd ${smokeetc}
181        sudo mv config.dist config
182
183   -Set the DNS names for the Smokeping config file url's \"imageurl\" and \"cgiurl\".
184    But you should leave all file paths alone -they are set by MacPorts.
185
186        imgurl   = http://myhost.mycompany.com/smokeping
187        cgiurl   = http://myhost.mycompany.com/smokeping/smokeping.cgi
188
189   -Customize variables.
190
191     * General * - owner, contact, and mailhost
192     * Alerts  * - to, from addresses
193
194   -Then clear the examples \(they have a leading '+'\) in the *** Targets ***
195    section and set your own.
196
197        + My Web Server
198           menu = MyWebServer
199           title = My Web Server
200           host = mywebserver.mydomain.com
201           alerts = bigloss,someloss,startloss
202
203    -See sample configurations and examples in ${prefix}/share/doc/smokeping/.
204
205    -Perform a config file test from a terminal window and correct any errors that
206     are reported.
207
208        smokeping --check
209
210
2116) Start Smokeping and verify it is running.  (Give it a minute to start)
212
213        sudo launchctl load -w /Library/LaunchDaemons/org.macports.smokeping.plist
214        ps -ax |grep smoke
215
216 1713  Ss 0:00.16 ${prefix}/bin/smokeping \[FPing\]
217 1753  Ss 0:00.18 ${prefix}/bin/speedy_backend -w ${prefix}/apache2/htdocs/smokeping/smokeping.cgi
218 1754  S  0:01.56 ${prefix}/bin/speedy_backend -w ${prefix}/apache2/htdocs/smokeping/smokeping.cgi
219
220
2217) Check the Smokeping graphs with a web browser.
222
223   Go to http://localhost/smokeping
224
225
2268) Add or remove targets from Smokeping.
227
228   After adding or removing targets from ${smokeetc}/config, you must reload
229   Smokeping from a terminal window.
230
231        sudo smokeping --reload
232\n"
233}