merged pcucontrol into monitor-server. although monitor-pcucontrol may
[monitor.git] / Monitor.spec
1 #
2 # $Id$
3
4
5 %define url $URL: svn+ssh://svn.planet-lab.org/svn/monitor/trunk/monitor.spec $
6
7 %define name monitor
8 # keep this version in sync with monitor/monitor_version.py
9 %define version 3.0
10 %define taglevel 28
11
12 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
13 %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
14
15 Name: %{name}
16 Version: %{version}
17 Release: %{release}
18 Source0: %{name}-%{version}.tar.bz2
19 License: GPL
20 Group: Applications/System
21 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
22
23 Vendor: PlanetLab
24 Packager: PlanetLab Central <support@planet-lab.org>
25 Distribution: PlanetLab %{plrelease}
26 URL: %(echo %{url} | cut -d ' ' -f 2)
27
28 # this is only required for fedora and we have this in devel.pkgs for
29 # all fedora builds.
30 # BuildRequires: python-setuptools-devel
31
32
33 Summary: Monitor account initialization for the root image.
34 Group: Applications/System
35
36 %description
37 Monitor is a collection of secondary scripts for configuring the node polling
38 system, syncing the PLC db with the monitoring database, notifying users,
39 interacting with PCU hardware, applying penalties to sites that violate
40 acceptable use.
41
42 ######################################## CLIENT
43
44 %package client
45 Summary: Monitor hooks for a PLC node
46 Group: Applications/System
47 Requires: curl
48 Requires: coreutils
49
50 %description client
51 The client scripts handle account creation inside of a node.  This will
52 include configuration setup for the monitoring agent running on the node.  It
53 will also include any cron or init scripts needed to perform this kind of
54 maintenance.
55 ######################################## Server Deps
56 %package server-deps
57 Summary: Monitor hooks for the PLC server.
58 Group: Applications/System
59
60 Requires: python
61 Requires: python-peak-util-extremes
62
63 Requires: compat-libstdc++-296
64 Requires: openssh-clients
65 Requires: perl-libwww-perl
66 Requires: perl-IO-Socket-SSL 
67 Requires: MySQL-python
68 Requires: nmap
69 Requires: nc
70 Requires: rt3
71
72 Requires: plewww-plekit
73
74 #Requires: zabbix-client
75 #Requires: zabbix-gui
76 #Requires: zabbix-server
77
78 %description server-deps
79 The server side include all python modules and scripts needed to fully
80
81 ######################################## Server
82 %package server
83 Summary: Monitor hooks for the PLC server.
84 Group: Applications/System
85
86 Requires: python
87
88 Requires: monitor-server-deps
89 Requires: PLCWWW >= 4.2
90 Requires: bootcd-%{pldistro}-%{_arch} >= 4.2
91
92 %description server
93 The server side include all python modules and scripts needed to fully
94 operation, track, and interact with any third-party monitoring software, such
95 as Zabbix DB.
96
97 ####################################### RunlevelAgent
98 %package runlevelagent
99 summary: the RunlevelAgent that reports node runlevels
100 group: applications/system
101 requires: python
102
103 %description runlevelagent
104 The RunlevelAgent starts as early as possible during boot-up and production
105 mode to actively report the observed runlevel to PLC and update the
106 'last_contact' field.
107
108 %prep
109 %setup -q
110
111 %build
112 # NOTE: the build uses g++ cmdamt/
113 # NOTE: TMPDIR is needed here b/c the tmpfs of the build vserver is too small.
114 cd pcucontrol/models/intelamt
115 export TMPDIR=$PWD/tmp
116 make
117 cd ..
118
119 %install
120 rm -rf $RPM_BUILD_ROOT
121 #################### CLIENT 
122 #install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
123 #install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
124 install -D -m 755 tools/timeout.pl $RPM_BUILD_ROOT/usr/bin/timeout.pl
125
126
127 #################### SERVER
128 install -d $RPM_BUILD_ROOT/usr/share/%{name}
129 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
130 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
131 install -d $RPM_BUILD_ROOT/var/lib/%{name}
132 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
133 install -d $RPM_BUILD_ROOT/var/www/html/monitorlog/
134 install -d $RPM_BUILD_ROOT/etc/httpd/conf.d/
135 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
136
137 # pack monitor's dependencies in RPM to make it easier to deploy.
138 export TMPDIR=/var/tmp/
139 export PYTHONPATH=$PYTHONPATH:$RPM_BUILD_ROOT/%{python_sitearch}/
140 easy_install -d $RPM_BUILD_ROOT/%{python_sitearch}/ -UZ http://files.turbogears.org/eggs/TurboGears-1.0.7-py2.5.egg
141 easy_install -d $RPM_BUILD_ROOT/%{python_sitearch}/ -UZ http://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.5.3.tar.gz
142 easy_install -d $RPM_BUILD_ROOT/%{python_sitearch}/ -UZ Elixir
143 rm -rf $RPM_BUILD_ROOT/%{python_sitearch}/site.py*
144
145 # plc.d scripts
146 install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
147 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
148 install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
149
150 # cron job for automated polling
151 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
152
153 # apache configuration
154 install -D -m 644 web/monitorweb-httpd.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/
155
156 # we'll install monitor and pcucontrol in site-packages
157 # install rest to /usr/share/monitor
158 rsync -a --exclude archive-pdb --exclude .svn --exclude CVS  \
159     --exclude monitor/ \
160     --exclude pcucontol/ \
161     ./  $RPM_BUILD_ROOT/usr/share/%{name}/
162
163 # install monitor python package
164 rsync -a --exclude .svn  ./monitor/   $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
165
166 # and pcucontrol
167 rsync -a --exclude .svn  ./pcucontrol/    $RPM_BUILD_ROOT/%{python_sitearch}/pcucontrol/
168
169 # install third-party module to site-packages
170 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
171
172 # TODO: 
173 echo " * TODO: Setting up Monitor account in local MyPLC"
174
175 #touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
176 #chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
177
178 #install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
179 #cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
180
181 #################### RunlevelAgent
182 install -D -m 755 RunlevelAgent.py $RPM_BUILD_ROOT/usr/bin/RunlevelAgent.py
183 install -D -m 755 monitor-runlevelagent.init $RPM_BUILD_ROOT/%{_initrddir}/monitor-runlevelagent
184
185 mkdir -p $RPM_BUILD_ROOT/var/log
186 touch $RPM_BUILD_ROOT/var/log/server-deps.log
187
188
189 %clean
190 rm -rf $RPM_BUILD_ROOT
191
192 %files server-deps
193 /var/log/server-deps.log
194
195 %files server
196 %defattr(-,root,root)
197 #%config /usr/share/%{name}/monitorconfig.py
198 #%config /etc/monitor.conf
199 /usr/share/%{name}
200 /var/lib/%{name}
201 #/var/www/cgi-bin/monitor
202 %{_sysconfdir}/cron.d/monitor-server.cron
203 %{_sysconfdir}/plc.d/monitor
204 %{_sysconfdir}/plc.d/monitor.functions
205 %{_sysconfdir}/plc.d/zabbix
206 %{_sysconfdir}/httpd/conf.d
207 %{python_sitearch}
208
209 %files client
210 %defattr(-,root,root)
211 #%{_initrddir}/monitor
212 #%{_sysconfdir}/cron.d/monitor
213 /usr/bin/timeout.pl
214
215 %files runlevelagent
216 /usr/bin/RunlevelAgent.py*
217 /%{_initrddir}/monitor-runlevelagent
218
219 %post server-deps
220
221 # crazy openssl libs for racadm binary
222 ln -s /lib/libssl.so.0.9.8b /usr/lib/libssl.so.2
223 mkdir %{_datadir}/%{name}/.ssh
224 chmod 700 %{_datadir}/%{name}/.ssh
225
226 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
227     sed -i -e 's/^session    required   pam_loginuid.so/#session    required   pam_loginuid.so/g' /etc/pam.d/crond
228 fi
229
230 # NOTE: enable monitor by default, since we're installing it.
231 if ! plc-config --category plc_monitor --variable enabled ; then 
232         plc-config --category plc_monitor --variable enabled --value true \
233                         --save /etc/planetlab/configs/site.xml  /etc/planetlab/configs/site.xml 
234 fi
235 if ! plc-config --category plc_monitor --variable from_email ; then
236         plc-config --category plc_monitor --variable from_email --value monitor@localhost.localdomain \
237                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
238 fi
239 if ! plc-config --category plc_monitor --variable cc_email ; then
240         plc-config --category plc_monitor --variable cc_email --value monitor@localhost.localdomain \
241                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
242 fi
243 if ! plc-config --category plc_monitor --variable rt_queue ; then
244         plc-config --category plc_monitor --variable rt_queue --value support \
245                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
246 fi
247
248 # zabbix:
249 if ! plc-config --category plc_zabbix --variable enabled ; then
250         plc-config --category plc_zabbix --variable enabled --value false \
251                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
252 fi
253 if ! plc-config --category plc_zabbix --variable host ; then
254         plc-config --category plc_zabbix --variable host --value localhost.localdomain \
255                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
256 fi
257 if ! plc-config --category plc_zabbix --variable ip ; then
258         plc-config --category plc_zabbix --variable ip --value "" \ 
259                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
260 fi
261
262 %post server
263 # TODO: this will be nice when we have a web-based service running., such as
264 #               an API server or so on.
265 # TODO: create real monitorconfig.py from monitorconfig-default.py
266 # TODO: create symlink in /var/lib/monitor for chroot environments
267 # TODO: update the content of automate_pl03.sh 
268 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
269
270 # NOTE: generate the python defines from zabbix include files.
271 #php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py
272
273 # apply patches to zabbix
274 #patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff
275
276 #chkconfig --add monitor-server
277 #chkconfig monitor-server on
278
279 %post client
280 chkconfig --add monitor
281 chkconfig monitor on
282
283 %post runlevelagent
284 chkconfig --add monitor-runlevelagent
285 chkconfig monitor-runlevelagent on
286 if [ "$PL_BOOTCD" != "1" ] ; then
287         service monitor-runlevelagent restart
288 fi
289
290
291 %changelog
292 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
293 - do not need buildrequires. a new tag to fix centos builds
294
295 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
296 - fix rpm build issues
297
298 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
299 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
300
301 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
302 - add option for site status to include both node & pcu status
303 - improve ticket handling
304 - template gadget.xml for a site-specific google-gadget summary
305
306 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
307 - - add install_date
308
309 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
310 - - remove monitor-client.cron
311 - - remove unused monitor-client init script
312 - - fix UP/DOWN summary on nodes page.
313 - - make node page display all nodes by default
314 - - add boot_server field
315 - - add myops_ssh_key to the keychain
316 - - use ext_consortium_id to distinguish pending sites.
317
318 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
319 - show/hide advance query form.
320
321 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
322 - fixed pause_penalty bug.
323 - fixed IPAL pcucontrol bug
324 - fixed bootman tunnel setup bug (occurred in rare cases)
325 - deprecated pcuview
326 - added BootmanSequenceRecords to separate config data from source code
327 - added get/setBootmanSequence(s) to xmlrpc API
328
329 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
330 - Major Features:
331 - added bm log collection and optional integration with BootManager's log Upload()
332 - added iptables_status
333 - expanded advanced query
334 - added differentiated bootmanager_restore actions so that actionsummary displays
335 - counts for each kind of bootmanager action
336 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
337 - added plain-text options for query page by adding tg_format=plain to URL
338 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
339 - fixed a bug in determining whether comon's dir was running on a node
340
341 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
342 - Major increment -
343 - adds multiple features and web changes
344 - adds new fields to db
345 - improved layout
346 - general improvements otherwise
347
348 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
349 - bug fixes.
350 - improved templates and views
351 - cleaned controller code for web
352 - added IPMI requirement to pcucontrol package.
353
354 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
355 - added bootmanager log links
356 - addressed root cause of IntegrityErrors ; big deal
357 - adjusted templates to accomodate fix for IntegrityErrors
358 - added session.flush() to bootman.py to write out ActionsRecords
359 - fixed policy to either pause penalties or apply them ; not both.
360
361 -* Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
362 -- Added Rpyc from 1.0 branch.
363 -- add pcuhistory
364 -- add setup-agent for password protected keys.
365 -- other minor improvements.
366
367 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
368 - automate install
369 - auto-close tickets
370
371 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
372 - update web
373 - update policy
374 - added statistics dir
375
376 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
377 - remove plccache from controllers, all lookups from db.
378 - reformat emailTxt messags
379 - updated bootstates in bootman.py
380
381 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
382 - tag of latest changes.
383 - need to test end to end.
384
385 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
386 - big merge from the 2.0 branch
387
388 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
389 - minor improvements in rendering with sortable tables
390
391 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
392
393 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
394 - first draft with sortable tables + checkpoint
395
396 * Fri May 15 2009 Baris Metin <tmetin@sophia.inria.fr>
397 - use plekit tables from plewww.
398 - depend on plewww-plekit
399
400 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
401 - make docs a noop
402 - fix for package name dependency
403 - correct docs
404
405 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
406 - add improved docs to the latest build and tag.
407
408 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
409 - add documentation hooks for adding in-line docs like NM and PLCAPI
410
411 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
412 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
413 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
414 - 'safeboot', 'failboot', 'reinstall', etc.
415
416 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
417 - same as 2.0-12 tag.
418
419 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
420 - merge from 2.0, remove more zabbix code, simplify install, etc.
421
422 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
423 - major merge from 2.0 branch.
424 - ready to be updated with 4.3 and web changes.
425
426 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
427 - preparing to make a 2.0 branch for monitor.
428
429 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
430 - new changes are significantly different, that I'm upping the number for clarity.
431
432 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
433 - These are all changes in the latest Monitor code.  I will branch this version
434 - next, before making additional large changes.
435
436 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
437 - Checkpointing current version for 4.2-rc21 - many many changes
438
439 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
440 - This is a major tag of every thing.  probably needs a very different release
441 - number.
442
443 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
444 - Incremental improvements
445
446 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
447 - tagging everything for OneLab tech-transfer.
448
449
450 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
451
452
453 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
454
455
456 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
457 - This should be ready for 4.2rc2
458
459
460 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
461 - initial addition.
462
463 %define module_current_branch 2.0