5 %define url $URL: svn+ssh://svn.planet-lab.org/svn/monitor/trunk/monitor.spec $
8 # keep this version in sync with monitor/monitor_version.py
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)" )
18 Source0: %{name}-%{version}.tar.bz2
20 Group: Applications/System
21 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
24 Packager: PlanetLab Central <support@planet-lab.org>
25 Distribution: PlanetLab %{plrelease}
26 URL: %(echo %{url} | cut -d ' ' -f 2)
29 Summary: Monitor account initialization for the root image.
30 Group: Applications/System
33 Monitor is a collection of secondary scripts for configuring the node polling
34 system, syncing the PLC db with the monitoring database, notifying users,
35 interacting with PCU hardware, applying penalties to sites that violate
38 ######################################## NAGIOS
41 Summary: Monitor integration with Nagios
42 Group: Applications/System
49 Requires: mysql-server
55 Requires: nagios-common
56 Requires: nagios-devel
57 Requires: nagios-plugins-all
59 Requires: ndoutils-mysql
63 Scripts and setup necessary to integrate and monitor PLC with Nagios.
64 Best suited to F12 or above.
66 ######################################## CLIENT
69 Summary: Monitor hooks for a PLC node
70 Group: Applications/System
75 The client scripts handle account creation inside of a node. This will
76 include configuration setup for the monitoring agent running on the node. It
77 will also include any cron or init scripts needed to perform this kind of
79 ######################################## Server Deps
81 Summary: Monitor hooks for the PLC server.
82 Group: Applications/System
85 Requires: python-setuptools-devel
86 Requires: python-peak-util-extremes
88 Requires: compat-libstdc++-296
89 Requires: openssh-clients
90 Requires: perl-libwww-perl
91 Requires: perl-IO-Socket-SSL
92 Requires: MySQL-python
97 Requires: plewww-plekit
99 #Requires: zabbix-client
100 #Requires: zabbix-gui
101 #Requires: zabbix-server
103 %description server-deps
104 The server side include all python modules and scripts needed to fully
106 ######################################## Server
108 Summary: Monitor hooks for the PLC server.
109 Group: Applications/System
113 Requires: monitor-server-deps
114 Requires: PLCWWW >= 4.2
115 Requires: bootcd-%{pldistro}-%{distroname}-%{_arch} >= 5.0
119 The server side include all python modules and scripts needed to fully
120 operation, track, and interact with any third-party monitoring software, such
123 ####################################### RunlevelAgent
124 %package runlevelagent
125 summary: the RunlevelAgent that reports node runlevels
126 group: applications/system
129 %description runlevelagent
130 The RunlevelAgent starts as early as possible during boot-up and production
131 mode to actively report the observed runlevel to PLC and update the
132 'last_contact' field.
138 rm -rf $RPM_BUILD_ROOT
139 #################### CLIENT
140 #install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
141 #install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
142 install -D -m 755 tools/timeout.pl $RPM_BUILD_ROOT/usr/bin/timeout.pl
145 #################### SERVER
146 install -d $RPM_BUILD_ROOT/usr/share/%{name}
147 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
148 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
149 install -d $RPM_BUILD_ROOT/var/lib/%{name}
150 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
151 install -d $RPM_BUILD_ROOT/var/www/html/monitorlog/
152 install -d $RPM_BUILD_ROOT/etc/httpd/conf.d/
153 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
156 install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
157 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
158 install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
159 # TODO: update with a real init file
160 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
162 # cron job for automated polling
163 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
165 # apache configuration
166 install -D -m 644 web/monitorweb-httpd.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/
168 # we'll install monitor in site-packages install rest to
170 rsync -a --exclude archive-pdb --exclude .cvsignore --exclude .svn --exclude CVS \
172 ./ $RPM_BUILD_ROOT/usr/share/%{name}/
174 # install monitor python package
175 rsync -a --exclude .svn ./monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
177 # install third-party module to site-packages
178 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
181 echo " * TODO: Setting up Monitor account in local MyPLC"
183 #touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
184 #chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
186 #install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
187 #cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
189 #################### RunlevelAgent
190 install -D -m 755 RunlevelAgent.py $RPM_BUILD_ROOT/usr/bin/RunlevelAgent.py
191 install -D -m 755 monitor-runlevelagent.init $RPM_BUILD_ROOT/%{_initrddir}/monitor-runlevelagent
193 mkdir -p $RPM_BUILD_ROOT/var/log
194 touch $RPM_BUILD_ROOT/var/log/server-deps.log
198 rm -rf $RPM_BUILD_ROOT
201 /var/log/server-deps.log
204 %defattr(-,root,root)
205 %{_sysconfdir}/plc.d/monitor-nagios
206 /usr/share/%{name}/nagios
207 # TODO: not sure how this will impact the server files
210 %defattr(-,root,root)
211 #%config /usr/share/%{name}/monitorconfig.py
212 #%config /etc/monitor.conf
214 /usr/share/%{name}/MANIFEST.in
215 /usr/share/%{name}/Makefile
216 /usr/share/%{name}/Monitor.spec
217 /usr/share/%{name}/README.txt
218 /usr/share/%{name}/RunlevelAgent.py*
219 /usr/share/%{name}/automate-default.sh
220 /usr/share/%{name}/monitor-default.conf
221 /usr/share/%{name}/monitor-runlevelagent.init
222 /usr/share/%{name}/monitor-server.cron
223 /usr/share/%{name}/monitor-server.init
224 /usr/share/%{name}/monitor.functions
225 /usr/share/%{name}/setup.py*
226 /usr/share/%{name}/threadpool.py*
228 /usr/share/%{name}/bootcd
229 /usr/share/%{name}/commands
230 /usr/share/%{name}/config.d
231 /usr/share/%{name}/cron.d
232 /usr/share/%{name}/docs
233 /usr/share/%{name}/keys
234 /usr/share/%{name}/log
235 /usr/share/%{name}/statistics
236 /usr/share/%{name}/tests
237 /usr/share/%{name}/tools
238 /usr/share/%{name}/upgrade
239 /usr/share/%{name}/web
240 /usr/share/%{name}/web
241 /usr/share/%{name}/zabbix
243 #/var/www/cgi-bin/monitor
244 %{_sysconfdir}/cron.d/monitor-server.cron
245 %{_sysconfdir}/plc.d/monitor
246 %{_sysconfdir}/plc.d/monitor.functions
247 %{_sysconfdir}/plc.d/zabbix
248 %{_sysconfdir}/httpd/conf.d
253 %defattr(-,root,root)
254 #%{_initrddir}/monitor
255 #%{_sysconfdir}/cron.d/monitor
259 /usr/bin/RunlevelAgent.py*
260 /%{_initrddir}/monitor-runlevelagent
265 # TODO: depend on distribution packages where feasible.
267 # it would be better to be able to depend on the distribution's
268 # packages for these additional python modules, but packages provided
269 # by fedora 8 (our current deployment) doesn't match the version
271 export TMPDIR=/var/tmp/
272 easy_install -UZ http://files.turbogears.org/eggs/TurboGears-1.0.7-py2.5.egg
273 easy_install -UZ http://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.5.3.tar.gz
274 easy_install -UZ Elixir
276 # crazy openssl libs for racadm binary
277 ln -s /lib/libssl.so.0.9.8b /usr/lib/libssl.so.2
278 mkdir %{_datadir}/%{name}/.ssh
279 chmod 700 %{_datadir}/%{name}/.ssh
281 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
282 sed -i -e 's/^session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/crond
285 # NOTE: enable monitor by default, since we're installing it.
286 if ! plc-config --category plc_monitor --variable enabled ; then
287 plc-config --category plc_monitor --variable enabled --value true \
288 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
290 if ! plc-config --category plc_monitor --variable from_email ; then
291 plc-config --category plc_monitor --variable from_email --value monitor@localhost.localdomain \
292 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
294 if ! plc-config --category plc_monitor --variable cc_email ; then
295 plc-config --category plc_monitor --variable cc_email --value monitor@localhost.localdomain \
296 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
298 if ! plc-config --category plc_monitor --variable rt_queue ; then
299 plc-config --category plc_monitor --variable rt_queue --value support \
300 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
304 if ! plc-config --category plc_zabbix --variable enabled ; then
305 plc-config --category plc_zabbix --variable enabled --value false \
306 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
308 if ! plc-config --category plc_zabbix --variable host ; then
309 plc-config --category plc_zabbix --variable host --value localhost.localdomain \
310 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
312 if ! plc-config --category plc_zabbix --variable ip ; then
313 plc-config --category plc_zabbix --variable ip --value "" \
314 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
318 # TODO: do as much as possible to get the host setup and running.
321 # TODO: this will be nice when we have a web-based service running., such as
322 # an API server or so on.
323 # TODO: create real monitorconfig.py from monitorconfig-default.py
324 # TODO: create symlink in /var/lib/monitor for chroot environments
325 # TODO: update the content of automate_pl03.sh
326 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
328 # NOTE: generate the python defines from zabbix include files.
329 #php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py
331 # apply patches to zabbix
332 #patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff
334 #chkconfig --add monitor-server
335 #chkconfig monitor-server on
338 chkconfig --add monitor
342 chkconfig --add monitor-runlevelagent
343 chkconfig monitor-runlevelagent on
344 if [ "$PL_BOOTCD" != "1" ] ; then
345 service monitor-runlevelagent restart
350 * Thu May 20 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-35
351 - Add CSV link on Advanced query
352 - Preparing to branch
354 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-34
355 - * copy selections to clipbord on Advanced Query page
356 - * RPM Pattern as regexp
359 * Tue Apr 27 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-33
360 - handle hostname changes
362 * Tue Apr 20 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-32
363 - from this version, suitable for 5.0
364 - requires bootcd with the new 5.0 naming style 3-part nodefamily
366 * Mon Apr 12 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-31
367 - added fix for node delete/add causing conflicts in MyOps db.
368 - added statistics scripts
370 * Thu Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
371 - * fix paths for automate script
373 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
374 - - separate pcucontrol as an svn module
375 - - restore easy_instal back into post install stage of server-deps
376 - - template imporovements for web interface
378 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
379 - do not need buildrequires. a new tag to fix centos builds
381 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
382 - fix rpm build issues
384 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
385 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
387 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
388 - add option for site status to include both node & pcu status
389 - improve ticket handling
390 - template gadget.xml for a site-specific google-gadget summary
392 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
395 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
396 - - remove monitor-client.cron
397 - - remove unused monitor-client init script
398 - - fix UP/DOWN summary on nodes page.
399 - - make node page display all nodes by default
400 - - add boot_server field
401 - - add myops_ssh_key to the keychain
402 - - use ext_consortium_id to distinguish pending sites.
404 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
405 - show/hide advance query form.
407 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
408 - fixed pause_penalty bug.
409 - fixed IPAL pcucontrol bug
410 - fixed bootman tunnel setup bug (occurred in rare cases)
412 - added BootmanSequenceRecords to separate config data from source code
413 - added get/setBootmanSequence(s) to xmlrpc API
415 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
417 - added bm log collection and optional integration with BootManager's log Upload()
418 - added iptables_status
419 - expanded advanced query
420 - added differentiated bootmanager_restore actions so that actionsummary displays
421 - counts for each kind of bootmanager action
422 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
423 - added plain-text options for query page by adding tg_format=plain to URL
424 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
425 - fixed a bug in determining whether comon's dir was running on a node
427 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
429 - adds multiple features and web changes
430 - adds new fields to db
432 - general improvements otherwise
434 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
436 - improved templates and views
437 - cleaned controller code for web
438 - added IPMI requirement to pcucontrol package.
440 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
441 - added bootmanager log links
442 - addressed root cause of IntegrityErrors ; big deal
443 - adjusted templates to accomodate fix for IntegrityErrors
444 - added session.flush() to bootman.py to write out ActionsRecords
445 - fixed policy to either pause penalties or apply them ; not both.
447 -* Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
448 -- Added Rpyc from 1.0 branch.
450 -- add setup-agent for password protected keys.
451 -- other minor improvements.
453 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
457 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
460 - added statistics dir
462 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
463 - remove plccache from controllers, all lookups from db.
464 - reformat emailTxt messags
465 - updated bootstates in bootman.py
467 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
468 - tag of latest changes.
469 - need to test end to end.
471 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
472 - big merge from the 2.0 branch
474 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
475 - minor improvements in rendering with sortable tables
477 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
479 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
480 - first draft with sortable tables + checkpoint
482 * Fri May 15 2009 Baris Metin <tmetin@sophia.inria.fr>
483 - use plekit tables from plewww.
484 - depend on plewww-plekit
486 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
488 - fix for package name dependency
491 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
492 - add improved docs to the latest build and tag.
494 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
495 - add documentation hooks for adding in-line docs like NM and PLCAPI
497 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
498 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
499 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
500 - 'safeboot', 'failboot', 'reinstall', etc.
502 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
503 - same as 2.0-12 tag.
505 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
506 - merge from 2.0, remove more zabbix code, simplify install, etc.
508 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
509 - major merge from 2.0 branch.
510 - ready to be updated with 4.3 and web changes.
512 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
513 - preparing to make a 2.0 branch for monitor.
515 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
516 - new changes are significantly different, that I'm upping the number for clarity.
518 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
519 - These are all changes in the latest Monitor code. I will branch this version
520 - next, before making additional large changes.
522 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
523 - Checkpointing current version for 4.2-rc21 - many many changes
525 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
526 - This is a major tag of every thing. probably needs a very different release
529 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
530 - Incremental improvements
532 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
533 - tagging everything for OneLab tech-transfer.
536 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
539 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
542 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
543 - This should be ready for 4.2rc2
546 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
549 %define module_current_branch 3.0