1 | # $Id: Portfile 71305 2010-09-08 01:38:10Z markd@macports.org $ |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | |
---|
5 | name zabbix |
---|
6 | version 1.8.6 |
---|
7 | categories net |
---|
8 | maintainers markd openmaintainer |
---|
9 | platforms darwin |
---|
10 | |
---|
11 | description An open source application and network monitor (Server or proxy module) |
---|
12 | |
---|
13 | long_description ${description} |
---|
14 | |
---|
15 | homepage http://www.zabbix.com/ |
---|
16 | master_sites sourceforge |
---|
17 | checksums md5 4642fd263167211a73a02fe7f3bcd998 |
---|
18 | patchfiles patch-src-zabbix_server-poller-checks_snmp.c.diff |
---|
19 | depends_lib port:fping \ |
---|
20 | port:curl \ |
---|
21 | port:openssl |
---|
22 | |
---|
23 | configure.args --enable-server \ |
---|
24 | --with-net-snmp \ |
---|
25 | --bindir=${prefix}/bin/zabbix \ |
---|
26 | --sbindir=${prefix}/sbin/zabbix \ |
---|
27 | --libexecdir=${prefix}/libexec/zabbix \ |
---|
28 | --datadir=${prefix}/share/zabbix \ |
---|
29 | --sysconfdir=${prefix}/etc/zabbix \ |
---|
30 | --localstatedir=${prefix}/var/zabbix |
---|
31 | |
---|
32 | configure.ldflags-append -lresolv |
---|
33 | |
---|
34 | if { [variant_isset proxy] } { |
---|
35 | startupitem.create yes |
---|
36 | startupitem.name zabbix_proxy |
---|
37 | startupitem.start "${prefix}/share/zabbix/zabbix_proxy.init start" |
---|
38 | startupitem.stop "${prefix}/share/zabbix/zabbix_proxy.init stop" |
---|
39 | } else { |
---|
40 | startupitem.create yes |
---|
41 | startupitem.name zabbix_server |
---|
42 | startupitem.start "${prefix}/share/zabbix/zabbix_server.init start" |
---|
43 | startupitem.stop "${prefix}/share/zabbix/zabbix_server.init stop" |
---|
44 | } |
---|
45 | |
---|
46 | variant mysql5 conflicts pgsql81 pgsql82 pgsql83 pgsql84 sqlite3 \ |
---|
47 | description {Use MySQL 5.x for server database} { |
---|
48 | depends_lib-append path:bin/mysql_config5:mysql5 |
---|
49 | configure.args-append --with-mysql=${prefix}/lib/mysql5/bin/mysql_config |
---|
50 | } |
---|
51 | |
---|
52 | variant pgsql81 conflicts mysql5 pgsql82 pgsql83 pgsql84 sqlite3 \ |
---|
53 | description {Use PostgreSQL 8.1.x for server database} { |
---|
54 | depends_lib-append port:postgresql81 |
---|
55 | configure.args-append --with-pgsql=${prefix}/lib/postgresql81/bin/pg_config |
---|
56 | } |
---|
57 | |
---|
58 | variant pgsql82 conflicts mysql5 pgsql81 pgsql83 pgsql84 sqlite3 \ |
---|
59 | description {Use PostgreSQL 8.2.x for server database} { |
---|
60 | depends_lib-append port:postgresql82 |
---|
61 | configure.args-append --with-pgsql=${prefix}/lib/postgresql82/bin/pg_config |
---|
62 | } |
---|
63 | |
---|
64 | variant pgsql83 conflicts mysql5 pgsql81 pgsql82 pgsql84 sqlite3 \ |
---|
65 | description {Use PostgreSQL 8.3.x for server database} { |
---|
66 | depends_lib-append port:postgresql83 |
---|
67 | configure.args-append --with-pgsql=${prefix}/lib/postgresql83/bin/pg_config |
---|
68 | } |
---|
69 | |
---|
70 | variant pgsql84 conflicts mysql5 pgsql81 pgsql82 pgsql83 sqlite3 \ |
---|
71 | description {Use PostgreSQL 8.4.x for server database} { |
---|
72 | depends_lib-append port:postgresql84 |
---|
73 | configure.args-append --with-pgsql=${prefix}/lib/postgresql84/bin/pg_config |
---|
74 | } |
---|
75 | |
---|
76 | variant sqlite3 conflicts mysql5 pgsql81 pgsql82 pgsql83 pgsql84 \ |
---|
77 | description {Use SQLite 3.x for server database} { |
---|
78 | depends_lib-append port:sqlite3 |
---|
79 | configure.args-append --with-sqlite3=${prefix} |
---|
80 | } |
---|
81 | |
---|
82 | variant proxy \ |
---|
83 | description {Do not install the Zabbix server but install the proxy} { |
---|
84 | configure.args-delete --enable-server |
---|
85 | configure.args-append --enable-proxy |
---|
86 | } |
---|
87 | |
---|
88 | if {![variant_isset pgsql81] && ![variant_isset pgsql82] && ![variant_isset pgsql83] && ![variant_isset pgsql84] && ![variant_isset sqlite3]} { |
---|
89 | default_variants +mysql5 |
---|
90 | } |
---|
91 | |
---|
92 | post-patch { |
---|
93 | if { [variant_isset proxy] } { |
---|
94 | if {![variant_isset pgsql81] && ![variant_isset pgsql82] && ![variant_isset pgsql83] && ![variant_isset pgsql84] && ![variant_isset sqlite3]} { |
---|
95 | |
---|
96 | reinplace "s|# DBSocket=/tmp/mysql.sock|DBSocket=${prefix}/var/run/mysql5/mysqld.sock|g" \ |
---|
97 | ${worksrcpath}/misc/conf/zabbix_proxy.conf |
---|
98 | } |
---|
99 | |
---|
100 | reinplace "s|# FpingLocation=/usr/sbin/fping|FpingLocation=${prefix}/sbin/fping|g" \ |
---|
101 | ${worksrcpath}/misc/conf/zabbix_proxy.conf |
---|
102 | reinplace "s|# PidFile=/tmp/zabbix_proxy.pid|PidFile=/var/tmp/zabbix_proxy.pid|g" \ |
---|
103 | ${worksrcpath}/misc/conf/zabbix_proxy.conf |
---|
104 | } else { |
---|
105 | if {![variant_isset pgsql81] && ![variant_isset pgsql82] && ![variant_isset pgsql83] && ![variant_isset pgsql84] && ![variant_isset sqlite3]} { |
---|
106 | reinplace "s|# DBSocket=/tmp/mysql.sock|DBSocket=${prefix}/var/run/mysql5/mysqld.sock|g" \ |
---|
107 | ${worksrcpath}/misc/conf/zabbix_server.conf |
---|
108 | } |
---|
109 | |
---|
110 | reinplace "s|# FpingLocation=/usr/sbin/fping|FpingLocation=${prefix}/sbin/fping|g" \ |
---|
111 | ${worksrcpath}/misc/conf/zabbix_server.conf |
---|
112 | reinplace "s|# PidFile=/tmp/zabbix_server.pid|PidFile=/var/tmp/zabbix_server.pid|g" \ |
---|
113 | ${worksrcpath}/misc/conf/zabbix_server.conf |
---|
114 | } |
---|
115 | } |
---|
116 | |
---|
117 | pre-destroot { |
---|
118 | adduser zabbix |
---|
119 | addgroup zabbix |
---|
120 | } |
---|
121 | |
---|
122 | post-destroot { |
---|
123 | |
---|
124 | if { [variant_isset proxy] } { |
---|
125 | # Copy sample server .conf files |
---|
126 | xinstall -d -m 755 -d ${destroot}${prefix}/etc/zabbix |
---|
127 | xinstall -m 755 ${worksrcpath}/misc/conf/zabbix_proxy.conf \ |
---|
128 | ${destroot}${prefix}/etc/zabbix/zabbix_proxy.conf.sample |
---|
129 | |
---|
130 | # Copy database data and schemas |
---|
131 | xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/data |
---|
132 | xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/schema |
---|
133 | |
---|
134 | eval xinstall -m 755 [glob ${worksrcpath}/create/data/*.*] \ |
---|
135 | ${destroot}${prefix}/share/zabbix/data |
---|
136 | eval xinstall -m 755 [glob ${worksrcpath}/create/schema/*] \ |
---|
137 | ${destroot}${prefix}/share/zabbix/schema |
---|
138 | |
---|
139 | # Create a startup script for the proxy |
---|
140 | xinstall -m 755 ${portpath}/${filesdir}/zabbix_proxy.init \ |
---|
141 | ${destroot}${prefix}/share/zabbix |
---|
142 | reinplace "s|__PREFIX__|${prefix}|g" \ |
---|
143 | ${destroot}${prefix}/share/zabbix/zabbix_proxy.init |
---|
144 | |
---|
145 | # Set permissions for etc (protect passwords) |
---|
146 | system "chmod 660 ${destroot}${prefix}/etc/zabbix/*" |
---|
147 | system "chown zabbix:zabbix ${destroot}${prefix}/etc/zabbix/*" |
---|
148 | |
---|
149 | } else { |
---|
150 | |
---|
151 | # Copy sample server .conf files |
---|
152 | xinstall -d -m 755 -d ${destroot}${prefix}/etc/zabbix |
---|
153 | xinstall -m 755 ${worksrcpath}/misc/conf/zabbix_server.conf \ |
---|
154 | ${destroot}${prefix}/etc/zabbix/zabbix_server.conf.sample |
---|
155 | |
---|
156 | # Copy database data and schemas |
---|
157 | xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/data |
---|
158 | xinstall -d -m 755 -d ${destroot}${prefix}/share/zabbix/schema |
---|
159 | |
---|
160 | eval xinstall -m 755 [glob ${worksrcpath}/create/data/*.*] \ |
---|
161 | ${destroot}${prefix}/share/zabbix/data |
---|
162 | eval xinstall -m 755 [glob ${worksrcpath}/create/schema/*] \ |
---|
163 | ${destroot}${prefix}/share/zabbix/schema |
---|
164 | |
---|
165 | # Copy the front end files |
---|
166 | file mkdir ${destroot}${prefix}/share/zabbix/frontends/ |
---|
167 | file copy ${worksrcpath}/frontends/php/ \ |
---|
168 | ${destroot}${prefix}/share/zabbix/frontends/ |
---|
169 | |
---|
170 | # Create a startup script for the server |
---|
171 | xinstall -m 755 ${portpath}/${filesdir}/zabbix_server.init \ |
---|
172 | ${destroot}${prefix}/share/zabbix |
---|
173 | reinplace "s|__PREFIX__|${prefix}|g" \ |
---|
174 | ${destroot}${prefix}/share/zabbix/zabbix_server.init |
---|
175 | |
---|
176 | # Set permissions for etc (protect passwords) and the frontend |
---|
177 | system "chmod 660 ${destroot}${prefix}/etc/zabbix/*" |
---|
178 | system "chown zabbix:zabbix ${destroot}${prefix}/etc/zabbix/*" |
---|
179 | system "chown -R www:www ${destroot}${prefix}/share/zabbix/frontends/*" |
---|
180 | |
---|
181 | # End else clause - Done with server stuff |
---|
182 | } |
---|
183 | |
---|
184 | } |
---|
185 | |
---|
186 | |
---|
187 | if { [variant_isset proxy] } { |
---|
188 | notes \ |
---|
189 | "#### #### |
---|
190 | #### Begin ZABBIX proxy installation section #### |
---|
191 | |
---|
192 | |
---|
193 | 1) Setup MySQL, i.e. via MacPorts: |
---|
194 | |
---|
195 | sudo port install mysql5-server |
---|
196 | |
---|
197 | |
---|
198 | 2) Setup the ZABBIX MySQL database |
---|
199 | |
---|
200 | -Create the ZABBIX database |
---|
201 | mysql5 -u root -p (enter password at prompt) |
---|
202 | mysql> create database zabbix character set utf8; |
---|
203 | mysql> quit; |
---|
204 | |
---|
205 | -Import the ZABBIX Schema |
---|
206 | cd ${prefix}/share/zabbix/schema |
---|
207 | cat mysql.sql | mysql5 -u root -p zabbix |
---|
208 | cd ${prefix}/share/zabbix/data |
---|
209 | cat data.sql | mysql5 -u root -p zabbix |
---|
210 | cat images_mysql.sql | mysql5 -u root -p zabbix |
---|
211 | |
---|
212 | -Create a MySQL 'zabbix' user and password |
---|
213 | mysql5 -u root -p |
---|
214 | mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<zabbix-mysql-password>'; |
---|
215 | mysql> grant all privileges on zabbix.* to zabbix identified by '<zabbix-mysql-password>'; |
---|
216 | mysql> quit; |
---|
217 | |
---|
218 | |
---|
219 | 3) Edit the sample .conf file ${prefix}/etc/zabbix/zabbix_proxy.conf (rename & omit .sample) |
---|
220 | |
---|
221 | Modify these variables at the very least: |
---|
222 | |
---|
223 | DBName=zabbix |
---|
224 | DBUser=zabbix |
---|
225 | DBPassword=<zabbix-mysql-password> |
---|
226 | |
---|
227 | |
---|
228 | 4) Set zabbix_proxy to run at system boot, then start it |
---|
229 | |
---|
230 | sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix_proxy.plist |
---|
231 | |
---|
232 | To start Zabbix manually, use: ${prefix}/share/zabbix/zabbix_proxy.init start (stop|status) |
---|
233 | |
---|
234 | Note: Eventually your shared memory has to be increased (see http://www.zabbix.org/forum/showthread.php?p=64232)! |
---|
235 | |
---|
236 | |
---|
237 | 5) Install zabbix_agent via MacPorts: |
---|
238 | |
---|
239 | sudo port install zabbix_agentd |
---|
240 | |
---|
241 | |
---|
242 | 6) Open http://localhost/zabbix/ in your browser and walk through the setup, then login with default user 'Admin' and password 'zabbix'. |
---|
243 | |
---|
244 | |
---|
245 | 7) Read the fine manual at http://www.zabbix.com/documentation/ |
---|
246 | #### End ZABBIX proxy installation section #### |
---|
247 | #### ####" |
---|
248 | |
---|
249 | } else { |
---|
250 | notes \ |
---|
251 | "#### #### |
---|
252 | #### Begin ZABBIX server installation section #### |
---|
253 | |
---|
254 | |
---|
255 | 1) Setup MySQL, i.e. via MacPorts: |
---|
256 | |
---|
257 | sudo port install mysql5-server |
---|
258 | |
---|
259 | |
---|
260 | 2) Setup the ZABBIX MySQL database |
---|
261 | |
---|
262 | -Create the ZABBIX database |
---|
263 | mysql5 -u root -p (enter password at prompt) |
---|
264 | mysql> create database zabbix character set utf8; |
---|
265 | mysql> quit; |
---|
266 | |
---|
267 | -Import the ZABBIX Schema |
---|
268 | cd ${prefix}/share/zabbix/schema |
---|
269 | cat mysql.sql | mysql5 -u root -p zabbix |
---|
270 | cd ${prefix}/share/zabbix/data |
---|
271 | cat data.sql | mysql5 -u root -p zabbix |
---|
272 | cat images_mysql.sql | mysql5 -u root -p zabbix |
---|
273 | |
---|
274 | -Create a MySQL 'zabbix' user and password |
---|
275 | mysql5 -u root -p |
---|
276 | mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<zabbix-mysql-password>'; |
---|
277 | mysql> grant all privileges on zabbix.* to zabbix identified by '<zabbix-mysql-password>'; |
---|
278 | mysql> quit; |
---|
279 | |
---|
280 | |
---|
281 | 3) Edit the sample .conf file ${prefix}/etc/zabbix/zabbix_server.conf (rename & omit .sample) |
---|
282 | |
---|
283 | Modify these variables at the very least: |
---|
284 | |
---|
285 | DBName=zabbix |
---|
286 | DBUser=zabbix |
---|
287 | DBPassword=<zabbix-mysql-password> |
---|
288 | |
---|
289 | |
---|
290 | 4) Install PHP 5, i.e. via MacPorts: |
---|
291 | |
---|
292 | sudo port install php5 php5-gd php5-mbstring php5-mysql php5-sockets |
---|
293 | |
---|
294 | |
---|
295 | 5) Set a symbolic link in your Apache document root pointing to the PHP frontend files |
---|
296 | |
---|
297 | sudo ln -s ${prefix}/share/zabbix/frontends/php <Apache-docroot>/zabbix |
---|
298 | |
---|
299 | |
---|
300 | 6) Set zabbix_server to run at system boot, then start it |
---|
301 | |
---|
302 | sudo launchctl load -w /Library/LaunchDaemons/org.macports.zabbix_server.plist |
---|
303 | |
---|
304 | To start Zabbix manually, use: ${prefix}/share/zabbix/zabbix_server.init start (stop|status) |
---|
305 | |
---|
306 | Note: Eventually your shared memory has to be increased (see http://www.zabbix.org/forum/showthread.php?p=64232)! |
---|
307 | |
---|
308 | |
---|
309 | 7) Install zabbix_agent via MacPorts: |
---|
310 | |
---|
311 | sudo port install zabbix_agentd |
---|
312 | |
---|
313 | |
---|
314 | 8) Open http://localhost/zabbix/ in your browser and walk through the setup, then login with default user 'Admin' and password 'zabbix'. |
---|
315 | |
---|
316 | |
---|
317 | 9) Read the fine manual at http://www.zabbix.com/documentation/ |
---|
318 | |
---|
319 | |
---|
320 | #### End ZABBIX server installation section #### |
---|
321 | #### ####" |
---|
322 | } |
---|