Setting tag Monitor-3.0-30
[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 Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
299 - * fix paths for automate script
300
301 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
302 - - separate pcucontrol as an svn module
303 - - restore easy_instal back into post install stage of server-deps
304 - - template imporovements for web interface
305
306 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
307 - do not need buildrequires. a new tag to fix centos builds
308
309 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
310 - fix rpm build issues
311
312 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
313 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
314
315 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
316 - add option for site status to include both node & pcu status
317 - improve ticket handling
318 - template gadget.xml for a site-specific google-gadget summary
319
320 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
321 - - add install_date
322
323 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
324 - - remove monitor-client.cron
325 - - remove unused monitor-client init script
326 - - fix UP/DOWN summary on nodes page.
327 - - make node page display all nodes by default
328 - - add boot_server field
329 - - add myops_ssh_key to the keychain
330 - - use ext_consortium_id to distinguish pending sites.
331
332 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
333 - show/hide advance query form.
334
335 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
336 - fixed pause_penalty bug.
337 - fixed IPAL pcucontrol bug
338 - fixed bootman tunnel setup bug (occurred in rare cases)
339 - deprecated pcuview
340 - added BootmanSequenceRecords to separate config data from source code
341 - added get/setBootmanSequence(s) to xmlrpc API
342
343 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
344 - Major Features:
345 - added bm log collection and optional integration with BootManager's log Upload()
346 - added iptables_status
347 - expanded advanced query
348 - added differentiated bootmanager_restore actions so that actionsummary displays
349 - counts for each kind of bootmanager action
350 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
351 - added plain-text options for query page by adding tg_format=plain to URL
352 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
353 - fixed a bug in determining whether comon's dir was running on a node
354
355 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
356 - Major increment -
357 - adds multiple features and web changes
358 - adds new fields to db
359 - improved layout
360 - general improvements otherwise
361
362 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
363 - bug fixes.
364 - improved templates and views
365 - cleaned controller code for web
366 - added IPMI requirement to pcucontrol package.
367
368 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
369 - added bootmanager log links
370 - addressed root cause of IntegrityErrors ; big deal
371 - adjusted templates to accomodate fix for IntegrityErrors
372 - added session.flush() to bootman.py to write out ActionsRecords
373 - fixed policy to either pause penalties or apply them ; not both.
374
375 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
376 - Added Rpyc from 1.0 branch.
377 - add pcuhistory
378 - add setup-agent for password protected keys.
379 - other minor improvements.
380
381 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
382 - automate install
383 - auto-close tickets
384
385 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
386 - update web
387 - update policy
388 - added statistics dir
389
390 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
391 - remove plccache from controllers, all lookups from db.
392 - reformat emailTxt messags
393 - updated bootstates in bootman.py
394
395 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
396 - tag of latest changes.
397 - need to test end to end.
398
399 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
400 - big merge from the 2.0 branch
401
402 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
403 - minor improvements in rendering with sortable tables
404
405 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
406
407 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
408 - first draft with sortable tables + checkpoint
409
410 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
411 - make docs a noop
412 - fix for package name dependency
413 - correct docs
414
415 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
416 - add improved docs to the latest build and tag.
417
418 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
419 - add documentation hooks for adding in-line docs like NM and PLCAPI
420
421 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
422 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
423 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
424 - 'safeboot', 'failboot', 'reinstall', etc.
425
426 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
427 - same as 2.0-12 tag.
428
429 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
430 - merge from 2.0, remove more zabbix code, simplify install, etc.
431
432 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
433 - major merge from 2.0 branch.
434 - ready to be updated with 4.3 and web changes.
435
436 * Fri Apr 03 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-9
437 - added new models to db.
438 - major updates throughout.
439 - better unification. needs an install test.
440
441 * Wed Apr 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-8
442 - removed old pkl database references.
443 - added blacklist to db model
444 - added fix to IntelAMT remoteControl to start an power-down node
445 - added policy.py
446 - added global error count before bailing entirely.
447
448 * Fri Mar 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-7
449 - improved db model
450 - updated files that use db model
451 - updated web view based on node, site, and pcu states.
452 - added local mirror to zabbix Make file.
453
454 * Tue Mar 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-6
455 - added action view to gui
456 - added penalty_applied bit to db model.
457
458 * Fri Mar 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-5
459 - tag for updates to 2.0 db model
460
461 * Fri Mar 13 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-4
462 - splits reboot.py across pcucontrol and monitor modules
463 - moves command.py from monitor/util to pcucontrol/util
464
465 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-3
466 - add email exceptions
467 - other bug fixes.
468
469 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-2
470 - getting the pcucontrol and findall.py scripts to work in an integrated
471 - fashion.
472
473 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
474 - preparing to make a 2.0 branch for monitor.
475
476 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
477 - new changes are significantly different, that I'm upping the number for clarity.
478
479 * Tue Nov 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu>
480 - 1.6.1
481 - initial re-packaging
482
483 * Thu Dec 01 2005 Eugene Grigorjev <eugene.grigorjev@zabbix.com>
484 - 1.1beta2
485 - initial packaging
486
487
488 %define module_current_branch 2.0
489
490 %define taglevel 30
491
492 %define version 3.0