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