Tagging module Monitor - Monitor-3.0-18
[monitor.git] / zabbix.spec
1 %define debug_package %{nil}
2
3 %define _prefix         /usr/local/zabbix
4
5 Name:           zabbix
6 Version:        1.6.2
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 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
294 - bug fixes.
295 - improved templates and views
296 - cleaned controller code for web
297 - added IPMI requirement to pcucontrol package.
298
299 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
300 - added bootmanager log links
301 - addressed root cause of IntegrityErrors ; big deal
302 - adjusted templates to accomodate fix for IntegrityErrors
303 - added session.flush() to bootman.py to write out ActionsRecords
304 - fixed policy to either pause penalties or apply them ; not both.
305
306 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
307 - Added Rpyc from 1.0 branch.
308 - add pcuhistory
309 - add setup-agent for password protected keys.
310 - other minor improvements.
311
312 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
313 - automate install
314 - auto-close tickets
315
316 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
317 - update web
318 - update policy
319 - added statistics dir
320
321 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
322 - remove plccache from controllers, all lookups from db.
323 - reformat emailTxt messags
324 - updated bootstates in bootman.py
325
326 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
327 - tag of latest changes.
328 - need to test end to end.
329
330 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
331 - big merge from the 2.0 branch
332
333 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
334 - minor improvements in rendering with sortable tables
335
336 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
337
338 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
339 - first draft with sortable tables + checkpoint
340
341 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
342 - make docs a noop
343 - fix for package name dependency
344 - correct docs
345
346 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
347 - add improved docs to the latest build and tag.
348
349 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
350 - add documentation hooks for adding in-line docs like NM and PLCAPI
351
352 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
353 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
354 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
355 - 'safeboot', 'failboot', 'reinstall', etc.
356
357 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
358 - same as 2.0-12 tag.
359
360 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
361 - merge from 2.0, remove more zabbix code, simplify install, etc.
362
363 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
364 - major merge from 2.0 branch.
365 - ready to be updated with 4.3 and web changes.
366
367 * Fri Apr 03 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-9
368 - added new models to db.
369 - major updates throughout.
370 - better unification. needs an install test.
371
372 * Wed Apr 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-8
373 - removed old pkl database references.
374 - added blacklist to db model
375 - added fix to IntelAMT remoteControl to start an power-down node
376 - added policy.py
377 - added global error count before bailing entirely.
378
379 * Fri Mar 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-7
380 - improved db model
381 - updated files that use db model
382 - updated web view based on node, site, and pcu states.
383 - added local mirror to zabbix Make file.
384
385 * Tue Mar 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-6
386 - added action view to gui
387 - added penalty_applied bit to db model.
388
389 * Fri Mar 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-5
390 - tag for updates to 2.0 db model
391
392 * Fri Mar 13 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-4
393 - splits reboot.py across pcucontrol and monitor modules
394 - moves command.py from monitor/util to pcucontrol/util
395
396 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-3
397 - add email exceptions
398 - other bug fixes.
399
400 * Tue Mar 10 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-2
401 - getting the pcucontrol and findall.py scripts to work in an integrated
402 - fashion.
403
404 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
405 - preparing to make a 2.0 branch for monitor.
406
407 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
408 - new changes are significantly different, that I'm upping the number for clarity.
409
410 * Tue Nov 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu>
411 - 1.6.1
412 - initial re-packaging
413
414 * Thu Dec 01 2005 Eugene Grigorjev <eugene.grigorjev@zabbix.com>
415 - 1.1beta2
416 - initial packaging
417
418
419 %define module_current_branch 2.0
420
421 %define taglevel 18
422
423 %define version 3.0