- add install_date
[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 ./configure --enable-static --enable-agent
82 make
83 popd
84
85 pushd server
86 ./configure --enable-server --with-pgsql --with-net-snmp --with-libcurl
87 make
88 popd
89
90 %clean
91 rm -fr $RPM_BUILD_ROOT
92
93 %install
94 rm -fr $RPM_BUILD_ROOT
95
96 ################# SERVER
97
98 # copy documentation
99 install -d %{buildroot}%{zabbix_docdir}
100 install -m 644 server/AUTHORS %{buildroot}%{zabbix_docdir}/AUTHORS
101 install -m 644 server/COPYING %{buildroot}%{zabbix_docdir}/COPYING
102 install -m 644 server/NEWS %{buildroot}%{zabbix_docdir}/NEWS
103 install -m 644 server/README %{buildroot}%{zabbix_docdir}/README
104
105 # copy binaries
106 install -d %{buildroot}%{zabbix_bindir}
107 install -s -m 755 server/src/zabbix_server/zabbix_server %{buildroot}%{zabbix_bindir}/zabbix_server
108
109 # copy config files
110 install -d %{buildroot}%{zabbix_confdir}
111 install -m 755 server/misc/conf/zabbix_server.conf %{buildroot}%{zabbix_confdir}/zabbix_server.conf
112 install -d %{buildroot}/etc/zabbix
113 install -m 755 server/misc/conf/zabbix_server.conf %{buildroot}/etc/zabbix
114
115 # copy startup script
116 install -d %{buildroot}%{zabbix_initdir}
117 install -m 755 server/misc/init.d/fedora/core/zabbix_server %{buildroot}%{zabbix_initdir}/zabbix_server
118
119 install -d %{buildroot}%{zabbix_datadir}
120 cp -r server/create %{buildroot}%{zabbix_datadir}
121
122 ################# CLIENT 
123 # copy binaries
124 install -d %{buildroot}%{zabbix_bindir}
125 install -s -m 755 client/src/zabbix_agent/zabbix_agentd %{buildroot}%{zabbix_bindir}/zabbix_agentd
126
127 # copy config files
128 install -d %{buildroot}%{zabbix_confdir}
129 install -m 755 client/misc/conf/zabbix_agentd.conf %{buildroot}%{zabbix_confdir}/zabbix_agentd.conf
130 install -d %{buildroot}/etc/zabbix
131 install -m 755 client/misc/conf/zabbix_agentd.conf %{buildroot}/etc/zabbix
132
133 # copy startup script
134 install -d %{buildroot}%{zabbix_initdir}
135 install -m 755 client/misc/init.d/fedora/core/zabbix_agentd %{buildroot}%{zabbix_initdir}/zabbix_agentd
136
137 ################# GUI
138 # copy php frontend
139 install -d %{buildroot}%{zabbix_webdir}
140 cp -r frontends/php/* %{buildroot}%{zabbix_webdir}
141
142 %post client
143 # create ZABBIX group
144 if [ -z "`grep zabbix /etc/group`" ]; then
145   /usr/sbin/groupadd zabbix >/dev/null 2>&1
146 fi
147
148 # create ZABBIX uzer
149 if [ -z "`grep zabbix /etc/passwd`" ]; then
150   /usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
151 fi
152
153 # configure ZABBIX agentd daemon
154 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
155
156 # TODO: setup Server=, Hostname=,
157 SERVER=`grep PLC_MONITOR_HOST /etc/planetlab/plc_config | tr "'" ' ' | awk '{print $2}'`
158 if [ -z "$SERVER" ] ; then
159         SERVER=128.112.139.116
160 fi
161 HOST=`hostname`
162 sed     -e "s#Hostname=.*#Hostname=$HOST#g" \
163         -e "s#Server=.*#Server=$SERVER#g" \
164         -e "s#PidFile=/var/tmp/zabbix_agentd.pid#PidFile=%{zabbix_piddir}/zabbix_agentd.pid#g" \
165         -e "s#LogFile=/tmp/zabbix_agentd.log#LogFile=%{zabbix_logdir}/zabbix_agentd.log#g" \
166         %{zabbix_confdir}/zabbix_agentd.conf > $TMP_FILE
167 cat $TMP_FILE > %{zabbix_confdir}/zabbix_agentd.conf
168 mkdir -p /etc/zabbix
169 cp %{zabbix_confdir}/zabbix_agentd.conf /etc/zabbix/
170 # TODO: copy to /etc/zabbix/
171
172 sed     -e "s#BASEDIR=/opt/zabbix#BASEDIR=%{_prefix}#g" \
173         -e "s#PIDFILE=/var/tmp/zabbix_agentd.pid#PIDFILE=%{zabbix_piddir}/zabbix_agentd.pid#g" \
174         %{zabbix_initdir}/zabbix_agentd > $TMP_FILE
175 cat $TMP_FILE > %{zabbix_initdir}/zabbix_agentd
176
177 # NOTE: Run every runlevel as soon as possible, and stop as late as possible
178 cp %{zabbix_initdir}/zabbix_agentd %{_initrddir}
179 sed     -i -e "s#chkconfig: - 90 10#chkconfig: 2345 12 90#g" \
180         %{_initrddir}/zabbix_agentd
181
182 rm -f $TMP_FILE
183
184 chkconfig --add zabbix_agentd 
185 chkconfig zabbix_agentd on
186 service zabbix_agentd start
187
188 %post server
189
190 # create ZABBIX group
191 if [ -z "`grep zabbix /etc/group`" ]; then
192   /usr/sbin/groupadd zabbix >/dev/null 2>&1
193 fi
194
195 # create ZABBIX uzer
196 if [ -z "`grep zabbix /etc/passwd`" ]; then
197   /usr/sbin/useradd -g zabbix zabbix >/dev/null 2>&1
198 fi
199
200 # configure ZABBIX server daemon
201 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
202
203 sed     -e "s#AlertScriptsPath=/home/zabbix/bin/#AlertScriptsPath=%{zabbix_bindir}/#g" \
204         -e "s#PidFile=/var/tmp/zabbix_server.pid#PidFile=%{zabbix_piddir}/zabbix_server.pid#g" \
205         -e "s#LogFile=/tmp/zabbix_server.log#LogFile=%{zabbix_logdir}/zabbix_server.log#g" \
206         -e "s|#DBPassword|DBPassword|g" \
207         %{zabbix_confdir}/zabbix_server.conf > $TMP_FILE
208 cat $TMP_FILE > %{zabbix_confdir}/zabbix_server.conf
209 mkdir -p %{_sysconfdir}/zabbix
210 cp %{zabbix_confdir}/zabbix_server.conf %{_sysconfdir}/zabbix/
211
212 sed     -e "s#BASEDIR=/opt/zabbix#BASEDIR=%{_prefix}#g" \
213         -e "s#PIDFILE=/var/tmp/zabbix_server.pid#PIDFILE=%{zabbix_piddir}/zabbix_server.pid#g" \
214         %{zabbix_initdir}/zabbix_server > $TMP_FILE
215 cat $TMP_FILE > %{zabbix_initdir}/zabbix_server
216 rm -f $TMP_FILE
217
218 # NOTE: Run every runlevel as soon as possible, and stop as late as possible
219 cp %{zabbix_initdir}/zabbix_server %{_initrddir}
220 sed     -i -e "s#chkconfig: - 90 10#chkconfig: 2345 12 90#g" \
221         %{_initrddir}/zabbix_server 
222
223 chkconfig --add zabbix_server
224 chkconfig zabbix_server on
225
226 %post gui
227 # Setup the necessary values in /etc/php.ini
228 # NOTE:  Zabbix requires max_execution_time to be 300 seconds
229 # NOTE:  Zabbix requires a default date.timezone 
230
231 # also edit  /var/www/html/zabbix/conf/zabbix.conf.php
232 #       touch  /var/www/html/zabbix/conf/zabbix.conf.php
233 #       chmod 644  /var/www/html/zabbix/conf/zabbix.conf.php
234
235
236 TMP_FILE=`mktemp $TMPDIR/zbxtmpXXXXXX`
237 sed     -e "s#;date.timezone =#date.timezone = UTC#g" \
238         -e "s#max_execution_time = 30 #max_execution_time = 300 #g" \
239         %{_sysconfdir}/php.ini > $TMP_FILE
240 cat $TMP_FILE > %{_sysconfdir}/php.ini
241
242
243 %postun 
244 rm -f %{zabbix_piddir}/zabbix_server.pid
245 rm -f %{zabbix_logdir}/zabbix_server.log
246
247 rm -f %{zabbix_piddir}/zabbix_agentd.pid
248 rm -f %{zabbix_logdir}/zabbix_agentd.log
249
250 %files client
251 %defattr(-,root,root)
252
253 %dir %attr(0755,root,root) %{zabbix_confdir}
254 %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_agentd.conf
255
256 %dir %attr(0755,root,root) %{zabbix_bindir}
257 %attr(0755,root,root) %{zabbix_bindir}/zabbix_agentd
258
259 %dir %attr(0755,root,root) %{zabbix_initdir}
260 %attr(0755,root,root) %{zabbix_initdir}/zabbix_agentd
261
262 %config /etc/zabbix/zabbix_agentd.conf
263
264 %files server
265 %defattr(-,root,root)
266
267 %dir %attr(0755,root,root) %{zabbix_docdir}
268 %attr(0644,root,root) %{zabbix_docdir}/AUTHORS
269 %attr(0644,root,root) %{zabbix_docdir}/COPYING
270 %attr(0644,root,root) %{zabbix_docdir}/NEWS
271 %attr(0644,root,root) %{zabbix_docdir}/README
272
273 %dir %attr(0755,root,root) %{zabbix_confdir}
274 %attr(0644,root,root) %config(noreplace) %{zabbix_confdir}/zabbix_server.conf
275
276 %dir %attr(0755,root,root) %{zabbix_bindir}
277 %attr(0755,root,root) %{zabbix_bindir}/zabbix_server
278
279 %dir %attr(0755,root,root) %{zabbix_initdir}
280 %attr(0755,root,root) %{zabbix_initdir}/zabbix_server
281
282 %dir %attr(0755,root,root) %{zabbix_datadir}
283 %attr(0755,root,root) %{zabbix_datadir}/create/
284
285 %config /etc/zabbix/zabbix_server.conf
286
287 %files gui
288 %defattr(-,root,root)
289 %dir %{zabbix_webdir}
290 %{zabbix_webdir}
291
292 %changelog
293 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
294 - - add install_date
295
296 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
297 - - remove monitor-client.cron
298 - - remove unused monitor-client init script
299 - - fix UP/DOWN summary on nodes page.
300 - - make node page display all nodes by default
301 - - add boot_server field
302 - - add myops_ssh_key to the keychain
303 - - use ext_consortium_id to distinguish pending sites.
304
305 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
306 - show/hide advance query form.
307
308 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
309 - fixed pause_penalty bug.
310 - fixed IPAL pcucontrol bug
311 - fixed bootman tunnel setup bug (occurred in rare cases)
312 - deprecated pcuview
313 - added BootmanSequenceRecords to separate config data from source code
314 - added get/setBootmanSequence(s) to xmlrpc API
315
316 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
317 - Major Features:
318 - added bm log collection and optional integration with BootManager's log Upload()
319 - added iptables_status
320 - expanded advanced query
321 - added differentiated bootmanager_restore actions so that actionsummary displays
322 - counts for each kind of bootmanager action
323 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
324 - added plain-text options for query page by adding tg_format=plain to URL
325 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
326 - fixed a bug in determining whether comon's dir was running on a node
327
328 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
329 - Major increment -
330 - adds multiple features and web changes
331 - adds new fields to db
332 - improved layout
333 - general improvements otherwise
334
335 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
336 - bug fixes.
337 - improved templates and views
338 - cleaned controller code for web
339 - added IPMI requirement to pcucontrol package.
340
341 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
342 - added bootmanager log links
343 - addressed root cause of IntegrityErrors ; big deal
344 - adjusted templates to accomodate fix for IntegrityErrors
345 - added session.flush() to bootman.py to write out ActionsRecords
346 - fixed policy to either pause penalties or apply them ; not both.
347
348 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
349 - Added Rpyc from 1.0 branch.
350 - add pcuhistory
351 - add setup-agent for password protected keys.
352 - other minor improvements.
353
354 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
355 - automate install
356 - auto-close tickets
357
358 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
359 - update web
360 - update policy
361 - added statistics dir
362
363 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
364 - remove plccache from controllers, all lookups from db.
365 - reformat emailTxt messags
366 - updated bootstates in bootman.py
367
368 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
369 - tag of latest changes.
370 - need to test end to end.
371
372 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
373 - big merge from the 2.0 branch
374
375 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
376 - minor improvements in rendering with sortable tables
377
378 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
379
380 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
381 - first draft with sortable tables + checkpoint
382
383 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
384 - make docs a noop
385 - fix for package name dependency
386 - correct docs
387
388 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
389 - add improved docs to the latest build and tag.
390
391 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
392 - add documentation hooks for adding in-line docs like NM and PLCAPI
393
394 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
395 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
396 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
397 - 'safeboot', 'failboot', 'reinstall', etc.
398
399 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
400 - same as 2.0-12 tag.
401
402 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
403 - merge from 2.0, remove more zabbix code, simplify install, etc.
404
405 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
406 - major merge from 2.0 branch.
407 - ready to be updated with 4.3 and web changes.
408
409 * Fri Apr 03 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-9
410 - added new models to db.
411 - major updates throughout.
412 - better unification. needs an install test.
413
414 * Wed Apr 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-8
415 - removed old pkl database references.
416 - added blacklist to db model
417 - added fix to IntelAMT remoteControl to start an power-down node
418 - added policy.py
419 - added global error count before bailing entirely.
420
421 * Fri Mar 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-7
422 - improved db model
423 - updated files that use db model
424 - updated web view based on node, site, and pcu states.
425 - added local mirror to zabbix Make file.
426
427 * Tue Mar 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-6
428 - added action view to gui
429 - added penalty_applied bit to db model.
430
431 * Fri Mar 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-5
432 - tag for updates to 2.0 db model
433
434 * Fri Mar 13 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-4
435 - splits reboot.py across pcucontrol and monitor modules
436 - moves command.py from monitor/util to pcucontrol/util
437
438 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-3
439 - add email exceptions
440 - other bug fixes.
441
442 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-2
443 - getting the pcucontrol and findall.py scripts to work in an integrated
444 - fashion.
445
446 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
447 - preparing to make a 2.0 branch for monitor.
448
449 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
450 - new changes are significantly different, that I'm upping the number for clarity.
451
452 * Tue Nov 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu>
453 - 1.6.1
454 - initial re-packaging
455
456 * Thu Dec 01 2005 Eugene Grigorjev <eugene.grigorjev@zabbix.com>
457 - 1.1beta2
458 - initial packaging
459
460
461 %define module_current_branch 2.0
462
463 %define taglevel 24
464
465 %define version 3.0