Branch 3.0 for module Monitor created (as new trunk) from tag Monitor-3.0-35
[monitor.git] / zabbix.spec
1 %define debug_package %{nil}
2
3 %define _prefix         /usr/local/zabbix
4
5 Name:           zabbix
6 Version:        1.6.5
7 Release:        1
8 Group:          System Environment/Daemons
9 License:        GPL
10 Summary:        ZABBIX network monitor server
11 Vendor:         ZABBIX SIA
12 URL:            http://www.zabbix.org
13 Packager:       Eugene Grigorjev <eugene.grigorjev@zabbix.com>
14 Source:         zabbix-%{version}.tar.gz
15
16 Autoreq:        no
17 Buildroot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
18
19
20 #Prefix:                %{_prefix}
21
22 %define zabbix_bindir   %{_prefix}/bin
23 %define zabbix_datadir  %{_prefix}/misc
24 %define zabbix_confdir  %{_prefix}/conf
25 %define zabbix_initdir  %{_prefix}/init.d
26 %define zabbix_docdir   %{_prefix}/doc
27 %define zabbix_webdir   /var/www/html/zabbix
28 #%define zabbix_piddir  %{_tmppath}
29 #%define zabbix_logdir  %{_tmppath}
30
31 %define zabbix_piddir   /var/tmp
32 %define zabbix_logdir   /var/tmp
33
34 %description
35 The ZABBIX server is a network monitor
36
37 %package client
38 Summary:        ZABBIX network monitor agent daemon
39 Group:          System Environment/Daemons
40 %description client
41 The ZABBIX client is a network monitor
42
43 %package server
44 Summary:        ZABBIX network monitor server daemon
45 Group:          System Environment/Daemons
46 BuildPrereq: postgresql-devel
47 BuildPrereq: net-snmp-devel
48 #BuildPrereq: gnutls-devel
49 #BuildPrereq: libtasn1-devel
50
51 Requires: gnutls
52 Requires: postgresql-server
53 Requires: net-snmp
54
55 %description server
56 The ZABBIX server is a network monitor
57
58 %package gui
59 Summary:        ZABBIX network monitor server frontend
60 Group:          Productivity/Networking/Web/Frontends
61 Requires: php
62 Requires: php-bcmath
63 Requires: postgresql-server
64
65 %description gui
66 The ZABBIX gui frontend
67
68 %prep
69 %setup -n zabbix-%{version}
70
71 %build
72
73 # TODO: there must be a better way.  unfortunately, this package doesn't build
74 # after running ./configure from a subdir, i.e. mkdir client; cd client; ../configure... ; make-> fails.
75 mkdir client
76 cp -r * client || :
77 mkdir server
78 cp -r client/* server
79
80 pushd client
81 # quick and dirty fix for f12; loader would fail b/c of the lack of /lib/libm.a
82 %if "%{distro}" == "Fedora" && %{distrorelease} >= 12
83 ./configure --enable-agent
84 %else
85 ./configure --enable-static --enable-agent
86 %endif
87 make
88 popd
89
90 pushd server
91 ./configure --enable-server --with-pgsql --with-net-snmp --with-libcurl
92 make
93 popd
94
95 %clean
96 rm -fr $RPM_BUILD_ROOT
97
98 %install
99 rm -fr $RPM_BUILD_ROOT
100
101 ################# SERVER
102
103 # copy documentation
104 install -d %{buildroot}%{zabbix_docdir}
105 install -m 644 server/AUTHORS %{buildroot}%{zabbix_docdir}/AUTHORS
106 install -m 644 server/COPYING %{buildroot}%{zabbix_docdir}/COPYING
107 install -m 644 server/NEWS %{buildroot}%{zabbix_docdir}/NEWS
108 install -m 644 server/README %{buildroot}%{zabbix_docdir}/README
109
110 # copy binaries
111 install -d %{buildroot}%{zabbix_bindir}
112 install -s -m 755 server/src/zabbix_server/zabbix_server %{buildroot}%{zabbix_bindir}/zabbix_server
113
114 # copy config files
115 install -d %{buildroot}%{zabbix_confdir}
116 install -m 755 server/misc/conf/zabbix_server.conf %{buildroot}%{zabbix_confdir}/zabbix_server.conf
117 install -d %{buildroot}/etc/zabbix
118 install -m 755 server/misc/conf/zabbix_server.conf %{buildroot}/etc/zabbix
119
120 # copy startup script
121 install -d %{buildroot}%{zabbix_initdir}
122 install -m 755 server/misc/init.d/fedora/core/zabbix_server %{buildroot}%{zabbix_initdir}/zabbix_server
123
124 install -d %{buildroot}%{zabbix_datadir}
125 cp -r server/create %{buildroot}%{zabbix_datadir}
126
127 ################# CLIENT 
128 # copy binaries
129 install -d %{buildroot}%{zabbix_bindir}
130 install -s -m 755 client/src/zabbix_agent/zabbix_agentd %{buildroot}%{zabbix_bindir}/zabbix_agentd
131
132 # copy config files
133 install -d %{buildroot}%{zabbix_confdir}
134 install -m 755 client/misc/conf/zabbix_agentd.conf %{buildroot}%{zabbix_confdir}/zabbix_agentd.conf
135 install -d %{buildroot}/etc/zabbix
136 install -m 755 client/misc/conf/zabbix_agentd.conf %{buildroot}/etc/zabbix
137
138 # copy startup script
139 install -d %{buildroot}%{zabbix_initdir}
140 install -m 755 client/misc/init.d/fedora/core/zabbix_agentd %{buildroot}%{zabbix_initdir}/zabbix_agentd
141
142 ################# GUI
143 # copy php frontend
144 install -d %{buildroot}%{zabbix_webdir}
145 cp -r frontends/php/* %{buildroot}%{zabbix_webdir}
146
147 %post client
148 # create ZABBIX group
149 if [ -z "`grep zabbix /etc/group`" ]; then
150   /usr/sbin/groupadd zabbix >/dev/null 2>&1
151 fi
152
153 # create ZABBIX uzer
154 if [ -z "`grep zabbix /etc/passwd`" ]; then
155   /usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
156 fi
157
158 # configure ZABBIX agentd daemon
159 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
160
161 # TODO: setup Server=, Hostname=,
162 SERVER=`grep PLC_MONITOR_HOST /etc/planetlab/plc_config | tr "'" ' ' | awk '{print $2}'`
163 if [ -z "$SERVER" ] ; then
164         SERVER=128.112.139.116
165 fi
166 HOST=`hostname`
167 sed     -e "s#Hostname=.*#Hostname=$HOST#g" \
168         -e "s#Server=.*#Server=$SERVER#g" \
169         -e "s#PidFile=/var/tmp/zabbix_agentd.pid#PidFile=%{zabbix_piddir}/zabbix_agentd.pid#g" \
170         -e "s#LogFile=/tmp/zabbix_agentd.log#LogFile=%{zabbix_logdir}/zabbix_agentd.log#g" \
171         %{zabbix_confdir}/zabbix_agentd.conf > $TMP_FILE
172 cat $TMP_FILE > %{zabbix_confdir}/zabbix_agentd.conf
173 mkdir -p /etc/zabbix
174 cp %{zabbix_confdir}/zabbix_agentd.conf /etc/zabbix/
175 # TODO: copy to /etc/zabbix/
176
177 sed     -e "s#BASEDIR=/opt/zabbix#BASEDIR=%{_prefix}#g" \
178         -e "s#PIDFILE=/var/tmp/zabbix_agentd.pid#PIDFILE=%{zabbix_piddir}/zabbix_agentd.pid#g" \
179         %{zabbix_initdir}/zabbix_agentd > $TMP_FILE
180 cat $TMP_FILE > %{zabbix_initdir}/zabbix_agentd
181
182 # NOTE: Run every runlevel as soon as possible, and stop as late as possible
183 cp %{zabbix_initdir}/zabbix_agentd %{_initrddir}
184 sed     -i -e "s#chkconfig: - 90 10#chkconfig: 2345 12 90#g" \
185         %{_initrddir}/zabbix_agentd
186
187 rm -f $TMP_FILE
188
189 chkconfig --add zabbix_agentd 
190 chkconfig zabbix_agentd on
191 service zabbix_agentd start
192
193 %post server
194
195 # create ZABBIX group
196 if [ -z "`grep zabbix /etc/group`" ]; then
197   /usr/sbin/groupadd zabbix >/dev/null 2>&1
198 fi
199
200 # create ZABBIX uzer
201 if [ -z "`grep zabbix /etc/passwd`" ]; then
202   /usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
203 fi
204
205 # configure ZABBIX server daemon
206 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
207
208 sed     -e "s#AlertScriptsPath=/home/zabbix/bin/#AlertScriptsPath=%{zabbix_bindir}/#g" \
209         -e "s#PidFile=/var/tmp/zabbix_server.pid#PidFile=%{zabbix_piddir}/zabbix_server.pid#g" \
210         -e "s#LogFile=/tmp/zabbix_server.log#LogFile=%{zabbix_logdir}/zabbix_server.log#g" \
211         -e "s|#DBPassword|DBPassword|g" \
212         %{zabbix_confdir}/zabbix_server.conf > $TMP_FILE
213 cat $TMP_FILE > %{zabbix_confdir}/zabbix_server.conf
214 mkdir -p %{_sysconfdir}/zabbix
215 cp %{zabbix_confdir}/zabbix_server.conf %{_sysconfdir}/zabbix/
216
217 sed     -e "s#BASEDIR=/opt/zabbix#BASEDIR=%{_prefix}#g" \
218         -e "s#PIDFILE=/var/tmp/zabbix_server.pid#PIDFILE=%{zabbix_piddir}/zabbix_server.pid#g" \
219         %{zabbix_initdir}/zabbix_server > $TMP_FILE
220 cat $TMP_FILE > %{zabbix_initdir}/zabbix_server
221 rm -f $TMP_FILE
222
223 # NOTE: Run every runlevel as soon as possible, and stop as late as possible
224 cp %{zabbix_initdir}/zabbix_server %{_initrddir}
225 sed     -i -e "s#chkconfig: - 90 10#chkconfig: 2345 12 90#g" \
226         %{_initrddir}/zabbix_server 
227
228 chkconfig --add zabbix_server
229 chkconfig zabbix_server on
230
231 %post gui
232 # Setup the necessary values in /etc/php.ini
233 # NOTE:  Zabbix requires max_execution_time to be 300 seconds
234 # NOTE:  Zabbix requires a default date.timezone 
235
236 # also edit  /var/www/html/zabbix/conf/zabbix.conf.php
237 #       touch  /var/www/html/zabbix/conf/zabbix.conf.php
238 #       chmod 644  /var/www/html/zabbix/conf/zabbix.conf.php
239
240
241 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
242 sed     -e "s#;date.timezone =#date.timezone = UTC#g" \
243         -e "s#max_execution_time = 30 #max_execution_time = 300 #g" \
244         %{_sysconfdir}/php.ini > $TMP_FILE
245 cat $TMP_FILE > %{_sysconfdir}/php.ini
246
247
248 %postun 
249 rm -f %{zabbix_piddir}/zabbix_server.pid
250 rm -f %{zabbix_logdir}/zabbix_server.log
251
252 rm -f %{zabbix_piddir}/zabbix_agentd.pid
253 rm -f %{zabbix_logdir}/zabbix_agentd.log
254
255 %files client
256 %defattr(-,root,root)
257
258 %dir %attr(0755,root,root) %{zabbix_confdir}
259 %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agentd.conf
260
261 %dir %attr(0755,root,root) %{zabbix_bindir}
262 %attr(0755,root,root) %{zabbix_bindir}/zabbix_agentd
263
264 %dir %attr(0755,root,root) %{zabbix_initdir}
265 %attr(0755,root,root) %{zabbix_initdir}/zabbix_agentd
266
267 %config /etc/zabbix/zabbix_agentd.conf
268
269 %files server
270 %defattr(-,root,root)
271
272 %dir %attr(0755,root,root) %{zabbix_docdir}
273 %attr(0644,root,root) %{zabbix_docdir}/AUTHORS
274 %attr(0644,root,root) %{zabbix_docdir}/COPYING
275 %attr(0644,root,root) %{zabbix_docdir}/NEWS
276 %attr(0644,root,root) %{zabbix_docdir}/README
277
278 %dir %attr(0755,root,root) %{zabbix_confdir}
279 %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_server.conf
280
281 %dir %attr(0755,root,root) %{zabbix_bindir}
282 %attr(0755,root,root) %{zabbix_bindir}/zabbix_server
283
284 %dir %attr(0755,root,root) %{zabbix_initdir}
285 %attr(0755,root,root) %{zabbix_initdir}/zabbix_server
286
287 %dir %attr(0755,root,root) %{zabbix_datadir}
288 %attr(0755,root,root) %{zabbix_datadir}/create/
289
290 %config /etc/zabbix/zabbix_server.conf
291
292 %files gui
293 %defattr(-,root,root)
294 %dir %{zabbix_webdir}
295 %{zabbix_webdir}
296
297 %changelog
298 * Thu May 20 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-35
299 - Add CSV link on Advanced query
300 - Preparing to branch
301
302 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-34
303 - * copy selections to clipbord on Advanced Query page
304 - * RPM Pattern as regexp
305 - * scan ipmi port
306
307 * Tue Apr 27 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-33
308 - handle hostname changes
309
310 * Tue Apr 20 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-32
311 - from this version, suitable for 5.0
312 - requires bootcd with the new 5.0 naming style 3-part nodefamily
313
314 * Mon Apr 12 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-31
315 - added fix for node delete/add causing conflicts in MyOps db.
316 - added statistics scripts
317
318 * Thu Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
319 - * fix paths for automate script
320
321 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
322 - - separate pcucontrol as an svn module
323 - - restore easy_instal back into post install stage of server-deps
324 - - template imporovements for web interface
325
326 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
327 - do not need buildrequires. a new tag to fix centos builds
328
329 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
330 - fix rpm build issues
331
332 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
333 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
334
335 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
336 - add option for site status to include both node & pcu status
337 - improve ticket handling
338 - template gadget.xml for a site-specific google-gadget summary
339
340 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
341 - - add install_date
342
343 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
344 - - remove monitor-client.cron
345 - - remove unused monitor-client init script
346 - - fix UP/DOWN summary on nodes page.
347 - - make node page display all nodes by default
348 - - add boot_server field
349 - - add myops_ssh_key to the keychain
350 - - use ext_consortium_id to distinguish pending sites.
351
352 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
353 - show/hide advance query form.
354
355 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
356 - fixed pause_penalty bug.
357 - fixed IPAL pcucontrol bug
358 - fixed bootman tunnel setup bug (occurred in rare cases)
359 - deprecated pcuview
360 - added BootmanSequenceRecords to separate config data from source code
361 - added get/setBootmanSequence(s) to xmlrpc API
362
363 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
364 - Major Features:
365 - added bm log collection and optional integration with BootManager's log Upload()
366 - added iptables_status
367 - expanded advanced query
368 - added differentiated bootmanager_restore actions so that actionsummary displays
369 - counts for each kind of bootmanager action
370 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
371 - added plain-text options for query page by adding tg_format=plain to URL
372 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
373 - fixed a bug in determining whether comon's dir was running on a node
374
375 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
376 - Major increment -
377 - adds multiple features and web changes
378 - adds new fields to db
379 - improved layout
380 - general improvements otherwise
381
382 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
383 - bug fixes.
384 - improved templates and views
385 - cleaned controller code for web
386 - added IPMI requirement to pcucontrol package.
387
388 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
389 - added bootmanager log links
390 - addressed root cause of IntegrityErrors ; big deal
391 - adjusted templates to accomodate fix for IntegrityErrors
392 - added session.flush() to bootman.py to write out ActionsRecords
393 - fixed policy to either pause penalties or apply them ; not both.
394
395 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
396 - Added Rpyc from 1.0 branch.
397 - add pcuhistory
398 - add setup-agent for password protected keys.
399 - other minor improvements.
400
401 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
402 - automate install
403 - auto-close tickets
404
405 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
406 - update web
407 - update policy
408 - added statistics dir
409
410 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
411 - remove plccache from controllers, all lookups from db.
412 - reformat emailTxt messags
413 - updated bootstates in bootman.py
414
415 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
416 - tag of latest changes.
417 - need to test end to end.
418
419 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
420 - big merge from the 2.0 branch
421
422 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
423 - minor improvements in rendering with sortable tables
424
425 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
426
427 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
428 - first draft with sortable tables + checkpoint
429
430 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
431 - make docs a noop
432 - fix for package name dependency
433 - correct docs
434
435 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
436 - add improved docs to the latest build and tag.
437
438 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
439 - add documentation hooks for adding in-line docs like NM and PLCAPI
440
441 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
442 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
443 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
444 - 'safeboot', 'failboot', 'reinstall', etc.
445
446 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
447 - same as 2.0-12 tag.
448
449 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
450 - merge from 2.0, remove more zabbix code, simplify install, etc.
451
452 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
453 - major merge from 2.0 branch.
454 - ready to be updated with 4.3 and web changes.
455
456 * Fri Apr 03 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-9
457 - added new models to db.
458 - major updates throughout.
459 - better unification. needs an install test.
460
461 * Wed Apr 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-8
462 - removed old pkl database references.
463 - added blacklist to db model
464 - added fix to IntelAMT remoteControl to start an power-down node
465 - added policy.py
466 - added global error count before bailing entirely.
467
468 * Fri Mar 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-7
469 - improved db model
470 - updated files that use db model
471 - updated web view based on node, site, and pcu states.
472 - added local mirror to zabbix Make file.
473
474 * Tue Mar 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-6
475 - added action view to gui
476 - added penalty_applied bit to db model.
477
478 * Fri Mar 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-5
479 - tag for updates to 2.0 db model
480
481 * Fri Mar 13 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-4
482 - splits reboot.py across pcucontrol and monitor modules
483 - moves command.py from monitor/util to pcucontrol/util
484
485 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-3
486 - add email exceptions
487 - other bug fixes.
488
489 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-2
490 - getting the pcucontrol and findall.py scripts to work in an integrated
491 - fashion.
492
493 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
494 - preparing to make a 2.0 branch for monitor.
495
496 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
497 - new changes are significantly different, that I'm upping the number for clarity.
498
499 * Tue Nov 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu>
500 - 1.6.1
501 - initial re-packaging
502
503 * Thu Dec 01 2005 Eugene Grigorjev <eugene.grigorjev@zabbix.com>
504 - 1.1beta2
505 - initial packaging
506
507
508 %define module_current_branch 3.0
509
510 %define taglevel 0
511
512 %define version 3.1