source: trunk/dports/net/zabbix/Portfile

Last change on this file was 146517, checked in by raimue@…, 21 months ago

Mass rev-bump dependents of port openssl due to ABI change

Disabling SSLv2 in r146162 changed the ABI of the library, leading to loading
errors for binaries with references to SSLv2 symbols.

https://lists.macosforge.org/pipermail/macports-dev/2016-March/032531.html

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.2 KB
Line 
1# $Id: Portfile 146517 2016-03-10 17:49:28Z ryandesign@macports.org $
2
3PortSystem      1.0
4
5name                    zabbix
6version                 1.8.2
7revision  1
8categories              net
9license                 GPL-2+
10maintainers             nomaintainer
11platforms               darwin
12
13description             An open source application and network monitor
14
15long_description        ${description}
16
17homepage                http://www.zabbix.com/
18master_sites            sourceforge
19checksums               md5 fa4be4fa7ac20a33cc0aa5c27b827746
20patchfiles      patch-src-zabbix_server-poller-checks_snmp.c.diff
21depends_lib             port:fping \
22                        port:curl \
23                        path:lib/libssl.dylib:openssl
24
25configure.args          --enable-server \
26                        --enable-agent \
27                        --with-net-snmp \
28                        --bindir=${prefix}/bin/zabbix \
29                        --sbindir=${prefix}/sbin/zabbix \
30                        --libexecdir=${prefix}/libexec/zabbix \
31                        --datadir=${prefix}/share/zabbix \
32                        --sysconfdir=${prefix}/etc/zabbix \
33                        --localstatedir=${prefix}/var/zabbix
34
35configure.ldflags-append        -lresolv
36
37if { [variant_isset agent_only] } {
38        startupitem.create      yes
39        startupitem.start       "${prefix}/share/zabbix/zabbix_agentd.init start"
40        startupitem.stop        "${prefix}/share/zabbix/zabbix_agentd.init stop"
41} else {
42        startupitem.create      yes
43        startupitem.start       "${prefix}/share/zabbix/zabbix_server.init start"
44        startupitem.stop        "${prefix}/share/zabbix/zabbix_server.init stop"
45}
46
47variant mysql5 conflicts pgsql81 pgsql82 pgsql83 pgsql84 sqlite3 \
48        description {Use MySQL 5.x for server database} {
49        depends_lib-append      path:bin/mysql_config5:mysql5
50        configure.args-append   --with-mysql=${prefix}/lib/mysql5/bin/mysql_config
51}
52
53variant pgsql81 conflicts mysql5 pgsql82 pgsql83 pgsql84 sqlite3 \
54        description {Use PostgreSQL 8.1.x for server database} {
55        depends_lib-append      port:postgresql81
56        configure.args-append   --with-pgsql=${prefix}/lib/postgresql81/bin/pg_config
57}
58
59variant pgsql82 conflicts mysql5 pgsql81 pgsql83 pgsql84 sqlite3 \
60        description {Use PostgreSQL 8.2.x for server database} {
61        depends_lib-append      port:postgresql82
62        configure.args-append   --with-pgsql=${prefix}/lib/postgresql82/bin/pg_config
63}
64
65variant pgsql83 conflicts mysql5 pgsql81 pgsql82 pgsql84 sqlite3 \
66        description {Use PostgreSQL 8.3.x for server database} {
67        depends_lib-append      port:postgresql83
68        configure.args-append   --with-pgsql=${prefix}/lib/postgresql83/bin/pg_config
69}
70
71variant pgsql84 conflicts mysql5 pgsql81 pgsql82 pgsql83 sqlite3 \
72        description {Use PostgreSQL 8.4.x for server database} {
73        depends_lib-append      port:postgresql84
74        configure.args-append   --with-pgsql=${prefix}/lib/postgresql84/bin/pg_config
75}
76
77variant sqlite3 conflicts mysql5 pgsql81 pgsql82 pgsql83 pgsql84 \
78        description {Use SQLite 3.x for server database} {
79        depends_lib-append      port:sqlite3
80        configure.args-append   --with-sqlite3=${prefix}
81}
82
83variant agent_only conflicts mysql5 pgsql81 pgsql82 pgsql83 pgsql84 sqlite3 \
84        description {Do not install the Zabbix server} {
85        depends_lib-delete      port:fping \
86                                port:curl \
87                                path:lib/libssl.dylib:openssl
88
89        configure.args-delete   --enable-server \
90                                --with-net-snmp
91}
92
93if {![variant_isset pgsql81] && ![variant_isset pgsql82] && ![variant_isset pgsql83] && ![variant_isset pgsql84] && ![variant_isset sqlite3] && ![variant_isset agent_only]} {
94        default_variants +mysql5
95}
96
97post-patch {
98        reinplace "s|#DBSocket=/tmp/mysql.sock|DBSocket=${prefix}/var/run/mysql5/mysqld.sock|g" \
99                ${worksrcpath}/misc/conf/zabbix_server.conf
100
101        reinplace "s|#FpingLocation=/usr/sbin/fping|FpingLocation=${prefix}/sbin/fping|g" \
102                ${worksrcpath}/misc/conf/zabbix_server.conf
103}
104
105pre-destroot {
106        adduser zabbix
107        addgroup zabbix
108}
109
110post-destroot {
111
112if { [variant_isset agent_only] } {
113# Don't install MySQL data and frontend stuff for agent_only
114
115# Copy sample agent .conf files
116        xinstall -d -m 755 -d ${destroot}${prefix}/etc/zabbix
117        xinstall -m 755  ${worksrcpath}/misc/conf/zabbix_agent.conf \
118                ${destroot}${prefix}/etc/zabbix/zabbix_agent.conf.sample
119        xinstall -m 755  ${worksrcpath}/misc/conf/zabbix_agentd.conf \
120                ${destroot}${prefix}/etc/zabbix/zabbix_agentd.conf.sample
121
122# Copy a startup script for the agent
123                xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix
124                xinstall -m 755 ${portpath}/${filesdir}/zabbix_agentd.init \
125                        ${destroot}${prefix}/share/zabbix
126                reinplace "s|__PREFIX__|${prefix}|g" \
127                ${destroot}${prefix}/share/zabbix/zabbix_agentd.init
128} else {
129
130# Copy sample server and agent .conf files
131        xinstall -d -m 755 -d ${destroot}${prefix}/etc/zabbix
132        xinstall -m 755 ${worksrcpath}/misc/conf/zabbix_agent.conf \
133                ${destroot}${prefix}/etc/zabbix/zabbix_agent.conf.sample
134        xinstall -m 755 ${worksrcpath}/misc/conf/zabbix_agentd.conf \
135                ${destroot}${prefix}/etc/zabbix/zabbix_agentd.conf.sample
136        xinstall -m 755 ${worksrcpath}/misc/conf/zabbix_server.conf \
137                ${destroot}${prefix}/etc/zabbix/zabbix_server.conf.sample
138
139# Copy database data and schemas
140        xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/data
141        xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/schema
142
143        xinstall -m 755 {*}[glob ${worksrcpath}/create/data/*.*] \
144                ${destroot}${prefix}/share/zabbix/data
145        xinstall -m 755 {*}[glob ${worksrcpath}/create/schema/*] \
146                ${destroot}${prefix}/share/zabbix/schema
147
148# Copy the front end files
149
150        file mkdir ${destroot}${prefix}/share/zabbix/frontends/
151        file copy ${worksrcpath}/frontends/php/ \
152                ${destroot}${prefix}/share/zabbix/frontends/
153
154# Create a startup script for the server
155                xinstall -m 755 ${portpath}/${filesdir}/zabbix_server.init \
156                        ${destroot}${prefix}/share/zabbix
157                reinplace "s|__PREFIX__|${prefix}|g" \
158                ${destroot}${prefix}/share/zabbix/zabbix_server.init
159
160# Create a startup script for the agent
161                xinstall -m 755 ${portpath}/${filesdir}/zabbix_agentd.init \
162                        ${destroot}${prefix}/share/zabbix
163                reinplace "s|__PREFIX__|${prefix}|g" \
164            ${destroot}${prefix}/share/zabbix/zabbix_agentd.init
165
166# Set permissions for etc (protect passwords) and the frontend
167                system "chmod 660 ${destroot}${prefix}/etc/zabbix/*"
168                system "chown zabbix:zabbix ${destroot}${prefix}/etc/zabbix/*"
169                system "chown -R www:www ${destroot}${prefix}/share/zabbix/frontends/*"
170
171# End else clause - Done with server stuff
172}
173
174# Copy Win32 agent for normal and agent_only installs
175                xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/zabbix_agent_win32
176                xinstall -m 755 ${worksrcpath}/bin/win32/zabbix_agentd.exe \
177                        ${destroot}${prefix}/share/zabbix/zabbix_agent_win32
178}
179
180
181notes "
182#### ZABBIX agent installation section (steps 1 - 3 only) ####
183
1841) Edit the sample .conf file ${prefix}/etc/zabbix/zabbix_agentd.conf (rename & omit .sample)
185
186   Set the following variable to the ip address of your ZABBIX server to\
187   allow it access to the agent.
188
189        Server=x.x.x.x
190
191
1922) Set zabbix_agentd to run at system boot
193
194        sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix.plist
195
196   To start Zabbix manually, use: ${prefix}/share/zabbix/zabbix_agentd.init start (stop|status)
197
198
1993) A Win32 agent is in ${prefix}/share/zabbix/zabbix_agent_win32 for\
200   installation on Windows NT 4.0, Windows 2000, and Windows XP.
201
202
203#### End ZABBIX agent installation section ####
204####                                       ####
205
206
207####                                          ####
208#### Begin ZABBIX server installation section ####
209
210
2111) Setup MySQL, i.e. via MacPorts:
212
213        sudo port install mysql5-server
214
215
2162) Setup the ZABBIX MySQL database
217
218-Create the ZABBIX database
219        mysql5 -u root -p (enter password at prompt)
220        mysql> create database zabbix character set utf8;
221        mysql> quit;
222
223-Import the ZABBIX Schema
224        cd ${prefix}/share/zabbix/schema
225        cat mysql.sql | mysql5 -u root -p zabbix
226        cd ${prefix}/share/zabbix/data
227        cat data.sql | mysql5 -u root -p zabbix
228        cat images_mysql.sql | mysql5 -u root -p zabbix
229
230-Create a MySQL 'zabbix' user and password
231        mysql5 -u root -p
232        mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<zabbix-mysql-password>';
233        mysql> grant all privileges on zabbix.* to zabbix identified by '<zabbix-mysql-password>';
234        mysql> quit;
235
236
2373) Edit the sample .conf file ${prefix}/etc/zabbix/zabbix_server.conf (rename & omit .sample)
238
239   Modify these variables at the very least:
240
241        DBName=zabbix
242        DBUser=zabbix
243        DBPassword=<zabbix-mysql-password>
244
245
2464) Install PHP 5, i.e. via MacPorts:
247
248        sudo port install php5 php5-gd php5-mbstring php5-mysql php5-sockets
249
250
2515) Set a symbolic link in your Apache document root pointing to the PHP frontend files
252
253        sudo ln -s ${prefix}/share/zabbix/frontends/php <Apache-docroot>/zabbix
254
255
2566) Set zabbix_server to run at system boot, then start it
257
258        sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix.plist
259
260   To start Zabbix manually, use: ${prefix}/share/zabbix/zabbix_server.init start (stop|status)
261
262        Note: Eventually your shared memory has to be increased (see http://www.zabbix.org/forum/showthread.php?p=64232)!
263
264
2657) A Win32 agent is in ${prefix}/share/zabbix/zabbix_agent_win32 for\
266   installation on Windows NT 4.0, Windows 2000, and Windows XP.  See\
267   the ReadMe.txt for instructions.
268
269
2708) Open http://localhost/zabbix/ in your browser and walk through the setup, then login with default user 'Admin' and password 'zabbix'.
271
272
2739) Read the fine manual at http://www.zabbix.com/documentation/
274"
Note: See TracBrowser for help on using the repository browser.