Ticket #26040: Portfile

File Portfile, 12.0 KB (added by fclaire@…, 14 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id$
3
4PortSystem              1.0
5
6name                    xymon
7version                 4.3.0-beta2
8revision                1
9categories              net
10platforms               darwin
11maintainers             free.fr:fclaire
12
13description             Xymon network monitor
14
15long_description        Xymon is a system for monitoring of hosts and networks, \
16                        inspired by the Big Brother system. It provides real-time \
17                        monitoring, an easy web-interface, historical data, \
18                        availability reports and performance graphs. \
19                        Xymon was previously known as \"Hobbit\".
20
21homepage                http://www.xymon.com/
22master_sites            sourceforge:xymon
23
24checksums               md5 e3485d2b2b3680e45a941d911029a1a8 \
25                        sha1 484ab668358856c7bbc7ba85bfe2afa7c0fa2f10 \
26                        rmd160 ab8db88d1e2cb7363c8a9b35396094ea921cc5b5
27
28depends_lib             port:rrdtool \
29                        port:fping \
30                        port:pcre \
31                        port:libpng \
32                        port:openssl \
33                        port:openldap
34
35patchfiles              patch-build-Makefile.rules.diff \
36                        patch-lib-Makefile.diff \
37                        patch-client-hobbitclient-darwin.sh.diff
38
39if {"darwin" == ${os.platform} && ${os.major} > 8} {
40    set xymonuser       _xymon
41} else {
42    set xymonuser       xymon
43}
44set xymongroup          ${xymonuser}
45set xytopdir            ${prefix}/lib/${name}
46set xylogdir            ${prefix}/var/log/${name}
47set xytmpdir            ${xytopdir}/tmp
48set bbvardir            ${xytopdir}/data
49set xywebdir            ${xytopdir}/web
50set xywwwdir            ${xytopdir}/www
51
52addgroup ${xymongroup}
53adduser ${xymonuser} gid=[existsgroup ${xymongroup}] realname=Xymon\ User home=${xytopdir} shell=/bin/bash
54
55file mkdir ${destroot}${xytopdir}
56file mkdir ${destroot}${xylogdir}
57file mkdir ${destroot}${xytmpdir}
58
59default_variants +client
60
61variant server description {Xymon server} {
62    configure.cmd           ./configure.server
63    configure.args-append   --rrdinclude ${prefix}/include \
64                            --rrdlib ${prefix}/lib \
65                            --pcreinclude ${prefix}/include \
66                            --pcrelib ${prefix}/lib \
67                            --sslinclude ${prefix}/include \
68                            --ssllib ${prefix}/lib \
69                            --ldapinclude ${prefix}/include \
70                            --ldaplib ${prefix}/lib \
71                            --fping ${prefix}/sbin/fping
72    configure.env-append    ENABLESSL=y \
73                            ENABLELDAP=y \
74                            ENABLELDAPSSL=y \
75                            BBUSER=${xymonuser} \
76                            USEHOBBITPING=n \
77                            BBTOPDIR=${xytopdir} \
78                            BBHOSTURL=/${name} \
79                            CGIDIR=${xytopdir}/cgi-bin \
80                            BBCGIURL=/${name}-cgi \
81                            SECURECGIDIR=${xytopdir}/cgi-secure \
82                            SECUREBBCGIURL=/${name}-secgci \
83                            HTTPDGID=_www \
84                            BBLOGDIR=${xylogdir} \
85                            BBHOSTNAME=localhost \
86                            BBHOSTIP=127.0.0.1 \
87                            BBHOSTOS=${os.platform} \
88                            MANROOT=${prefix}/share/man \
89                            INSTALLBINDIR=${xytopdir}/server/bin \
90                            INSTALLETCDIR=${xytopdir}/etc \
91                            INSTALLEXTDIR=${xytopdir}/server/ext \
92                            INSTALLTMPDIR=${xytmpdir} \
93                            INSTALLWEBDIR=${xywebdir} \
94                            INSTALLWWWDIR=${xywwwdir} \
95                            BBVAR=${bbvardir}
96
97    destroot.env-append     INSTALLROOT=${destroot}
98    destroot.keepdirs       ${destroot}${xytopdir} \
99                            ${destroot}${xylogdir} \
100                            ${destroot}${xytmpdir} \
101                            ${destroot}${bbvardir}/acks \
102                            ${destroot}${bbvardir}/data \
103                            ${destroot}${bbvardir}/disabled \
104                            ${destroot}${bbvardir}/hist \
105                            ${destroot}${bbvardir}/histlogs \
106                            ${destroot}${bbvardir}/hostdata \
107                            ${destroot}${bbvardir}/logs \
108                            ${destroot}${bbvardir}/rrd \
109                            ${destroot}${bbvardir} \
110                            ${destroot}${xywebdir} \
111                            ${destroot}${xywwwdir}/html \
112                            ${destroot}${xywwwdir}/rep \
113                            ${destroot}${xywwwdir}/snap \
114                            ${destroot}${xywwwdir}/notes \
115                            ${destroot}${xywwwdir}/wml
116
117    post-destroot {
118        # Adding own startupitem - xymon needs to be run under _xymon user
119        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
120        xinstall -m 644 ${filespath}/org.macports.${name}.server.plist ${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}/
121        xinstall -m 644 ${filespath}/INSTALL.macports.xymon.server ${destroot}${xytopdir}
122    }
123
124    post-activate {
125        # Creation of a symbolic link towards startupitem
126        #file link -symbolic ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist /Library/LaunchDaemons/org.macports.${name}.plist
127        #file link -symbolic ${xytopdir}/tmp ${xytopdir}/client/tmp
128        system "/bin/ln -sf ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist /Library/LaunchDaemons/org.macports.${name}.server.plist"
129        system "/bin/ln -sf ${xytmpdir} ${xytopdir}/client/tmp"
130
131        # Couldn't find how to display the content of a file with a cat command
132        # So I include it inside this Portfile
133        # Reminder: awk '/^### INSTALL Server ###$/ {print; while ((getline < "files/INSTALL.macports.xymon.server") > 0) print; next} {print}' Portfile.work > Portfile
134### INSTALL Server ###
135ui_msg "  *** To complete the Xymon install ***
136
137
1381) Tune the number of shared message queues
139----------------------------------------------
140
141Xymon server needs at least 9 IPC message queues to run.
142Unfortunately Mac OS X ships with a default max of 8.
143
144Check how much shared segments a process can use on
145your system:
146    $ sysctl kern.sysv.shmseg
147And the max number of shared segments system-wide:
148    $ sysctl kern.sysv.shmmni
149
150If the first number is < 9, you need to tune your system
151before trying to start xymon server (doing so will make
152the whole system to crash).
153
154Run the following commands to increase your shared
155segments:
156    $ sudo echo \"kern.sysv.shmmni=64\" >> /etc/sysctl.conf
157    $ sudo echo \"kern.sysv.shmseg=12\" >> /etc/sysctl.conf
158
159Reboot your system to activate the change. After reboot you can
160read these instructions with:
161    $ cat /opt/local/lib/xymon/INSTALL.macports.xymon.server
162
163More information about shared memory segments on Mac OS X
164can be found here: http://support.apple.com/kb/HT4022
165
166
167
1682) Configure your apache web server
169----------------------------------------------
170
171Xymon \"make install\" ends with:
172You must configure your webserver for the Hobbit webpages and CGI-scripts.
173A sample Apache configuration is in /opt/local/lib/xymon/server/etc/hobbit-apache.conf
174If you have your Administration CGI scripts in a separate directory,
175then you must also setup the password-file with the htpasswd command.
176
177So the following commands should do it:
178    $ sudo mv /opt/local/lib/xymon/server/etc/hobbit-apache.conf /etc/apache2/sites/
179    $ sudo /usr/sbin/apachectl restart
180
181
182
1833) Make user _xymon part of the admin group:
184----------------------------------------------
185
186We achieve this with the Directory Service command line utility:
187    $ sudo dscl . -append /Groups/admin GroupMembership _xymon
188
189
190
191
1924) Start Xymon server
193----------------------------------------------
194
195A startup item has been generated that will aid in
196starting xymon with launchd. It is disabled
197by default. Execute the following command to start it,
198and to cause it to launch at startup:
199
200    $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.xymon.plist
201
202If your Mac OSX firewall is enabled, you'll be asked to allow
203xymon -> accept
204On Mac OSX Server, make sure your ipfw rules will allow
205incoming TCP conections to port 1984
206
207
2085) check the status of your Xymon server
209----------------------------------------------
210
211To view the Xymon webpages, go to http://localhost/xymon
212
213----------------------------------------------
214
215
216
217
218  *** Quick start for the impatient ***
219
220Run the following commands in your terminal:
221    $ sudo echo \"kern.sysv.shmmni=64\" >> /etc/sysctl.conf
222    $ sudo echo \"kern.sysv.shmseg=12\" >> /etc/sysctl.conf
223    $ sudo mv /opt/local/lib/xymon/server/etc/hobbit-apache.conf /etc/apache2/sites/
224    $ sudo /usr/sbin/apachectl restart
225    $ sudo dscl . -append /Groups/admin GroupMembership _xymon
226Reboot your system
227    $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.xymon.plist
228Open http://localhost/xymon in your server's browser
229
230"
231    }
232}
233
234variant client description {Xymon client} {
235    configure.cmd           ./configure.client
236    configure.args-append   --rrdinclude ${prefix}/include \
237                            --rrdlib ${prefix}/lib \
238                            --pcreinclude ${prefix}/include \
239                            --pcrelib ${prefix}/lib \
240                            --sslinclude ${prefix}/include \
241                            --ssllib ${prefix}/lib \
242                            --ldapinclude ${prefix}/include \
243                            --ldaplib ${prefix}/lib \
244                            --fping ${prefix}/sbin/fping
245    configure.env-append    ENABLESSL=y \
246                            BBUSER=${xymonuser} \
247                            BBTOPDIR=${xytopdir} \
248                            BBHOSTIP=127.0.0.1 \
249                            BBHOSTOS=${os.platform} \
250                            MANROOT=${prefix}/share/man \
251                            INSTALLBINDIR=${xytopdir}/client/bin \
252                            INSTALLETCDIR=${xytopdir}/etc \
253                            INSTALLEXTDIR=${xytopdir}/client/ext \
254                            INSTALLTMPDIR=${xytmpdir} \
255                            INSTALLWEBDIR=${xywebdir} \
256                            INSTALLWWWDIR=${xywwwdir} \
257                            BBVAR=${bbvardir}
258
259    destroot.env-append     INSTALLROOT=${destroot}
260    destroot.keepdirs       ${destroot}${xytopdir} \
261                            ${destroot}${xylogdir} \
262                            ${destroot}${xytmpdir} \
263                            ${destroot}${bbvardir}/logs \
264                            ${destroot}${bbvardir} \
265                            ${destroot}${xywebdir}
266
267    startupitem.create      yes
268    startupitem.start       "sudo su ${xymonuser} -c \"${xytopdir}/client/runclient.sh start\""
269    startupitem.stop        "sudo su ${xymonuser} -c \"${xytopdir}/client/runclient.sh stop\""
270    startupitem.restart     "sudo su ${xymonuser} -c \"${xytopdir}/client/runclient.sh restart\""
271    #startupitem.pidfile     auto ${xylogdir}/clientlaunch.*.pid
272    startupitem.pidfile     none
273
274    post-destroot {
275        xinstall -d -o ${xymonuser} -g ${xymongroup} ${destroot}${xylogdir}
276        xinstall -d -o ${xymonuser} -g ${xymongroup} ${destroot}${xytmpdir}
277    }
278
279    post-activate {
280        system "/bin/ln -sf ${xytmpdir} ${xytopdir}/client/tmp"
281        system "/bin/ln -sf ${xylogdir} ${xytopdir}/client/logs"
282
283        ui_msg "\nSet your Xymon server's IP address with the following command:
284    $ sudo vi ${xytopdir}/client/etc/hobbitclient.cfg
285
286If you wish to have your xymon client report logfiles to your xymon server
287you need to add the user _xymon to the admin group like this:
288    $ sudo dscl . -append /Groups/admin GroupMembership _xymon
289"
290    }
291}
292
293use_parallel_build  no
294