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