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
59 Requires: nagios-common
60 Requires: nagios-devel
61 Requires: nagios-plugins-all
63 Requires: ndoutils-mysql
67 Scripts and setup necessary to integrate and monitor PLC with Nagios.
68 Best suited to F12 or above.
70 ######################################## CLIENT
73 Summary: Monitor hooks for a PLC node
74 Group: Applications/System
79 The client scripts handle account creation inside of a node. This will
80 include configuration setup for the monitoring agent running on the node. It
81 will also include any cron or init scripts needed to perform this kind of
83 ######################################## Server Deps
85 Summary: Monitor hooks for the PLC server.
86 Group: Applications/System
89 Requires: python-setuptools-devel
90 Requires: python-peak-util-extremes
92 Requires: compat-libstdc++-296
93 Requires: openssh-clients
94 Requires: perl-libwww-perl
95 Requires: perl-IO-Socket-SSL
96 Requires: MySQL-python
101 Requires: plewww-plekit
103 #Requires: zabbix-client
104 #Requires: zabbix-gui
105 #Requires: zabbix-server
107 %description server-deps
108 The server side include all python modules and scripts needed to fully
110 ######################################## Server
112 Summary: Monitor hooks for the PLC server.
113 Group: Applications/System
117 Requires: monitor-server-deps
118 Requires: PLCWWW >= 4.2
119 Requires: bootcd-%{pldistro}-%{distroname}-%{_arch} >= 5.0
123 The server side include all python modules and scripts needed to fully
124 operation, track, and interact with any third-party monitoring software, such
127 ####################################### RunlevelAgent
128 %package runlevelagent
129 summary: the RunlevelAgent that reports node runlevels
130 group: applications/system
133 %description runlevelagent
134 The RunlevelAgent starts as early as possible during boot-up and production
135 mode to actively report the observed runlevel to PLC and update the
136 'last_contact' field.
142 rm -rf $RPM_BUILD_ROOT
143 #################### CLIENT
144 #install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
145 #install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
146 install -D -m 755 tools/timeout.pl $RPM_BUILD_ROOT/usr/bin/timeout.pl
149 #################### SERVER
150 install -d $RPM_BUILD_ROOT/usr/share/%{name}
151 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
152 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
153 install -d $RPM_BUILD_ROOT/var/lib/%{name}
154 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
155 install -d $RPM_BUILD_ROOT/var/www/html/monitorlog/
156 install -d $RPM_BUILD_ROOT/etc/httpd/conf.d/
157 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
160 install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
161 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
162 install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
164 install -D -m 755 nagios/monitor-nagios.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
165 install -D -m 644 nagios/monitor-nagios.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-nagios.cron
167 # cron job for automated polling
168 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
170 # apache configuration
171 install -D -m 644 web/monitorweb-httpd.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/
173 # we'll install monitor in site-packages install rest to
175 rsync -a --exclude archive-pdb --exclude .cvsignore --exclude .svn --exclude CVS \
177 ./ $RPM_BUILD_ROOT/usr/share/%{name}/
179 # install monitor python package
180 rsync -a --exclude .svn ./monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
182 install -D -m 644 monitor/wrapper/plc.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
183 install -D -m 644 monitor/generic.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
185 # install third-party module to site-packages
186 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
189 #touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
190 #chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
192 #install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
193 #cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
195 #################### RunlevelAgent
196 install -D -m 755 RunlevelAgent.py $RPM_BUILD_ROOT/usr/bin/RunlevelAgent.py
197 install -D -m 755 monitor-runlevelagent.init $RPM_BUILD_ROOT/%{_initrddir}/monitor-runlevelagent
199 mkdir -p $RPM_BUILD_ROOT/var/log
200 touch $RPM_BUILD_ROOT/var/log/server-deps.log
204 rm -rf $RPM_BUILD_ROOT
207 /var/log/server-deps.log
210 %defattr(-,root,root)
211 %{_sysconfdir}/plc.d/monitor-nagios
212 /usr/share/%{name}/nagios
213 %{_sysconfdir}/cron.d/monitor-nagios.cron
216 %defattr(-,root,root)
217 #%config /usr/share/%{name}/monitorconfig.py
218 #%config /etc/monitor.conf
220 /usr/share/%{name}/MANIFEST.in
221 /usr/share/%{name}/Makefile
222 /usr/share/%{name}/Monitor.spec
223 /usr/share/%{name}/README.txt
224 /usr/share/%{name}/RunlevelAgent.py*
225 /usr/share/%{name}/automate-default.sh
226 /usr/share/%{name}/monitor-default.conf
227 /usr/share/%{name}/monitor-runlevelagent.init
228 /usr/share/%{name}/monitor-server.cron
229 /usr/share/%{name}/monitor-server.init
230 /usr/share/%{name}/monitor.functions
231 /usr/share/%{name}/setup.py*
232 /usr/share/%{name}/threadpool.py*
233 /usr/share/%{name}/zabbix.spec
235 /usr/share/%{name}/bootcd
236 /usr/share/%{name}/commands
237 /usr/share/%{name}/config.d
238 /usr/share/%{name}/cron.d
239 /usr/share/%{name}/docs
240 /usr/share/%{name}/keys
241 /usr/share/%{name}/log
242 /usr/share/%{name}/statistics
243 /usr/share/%{name}/tests
244 /usr/share/%{name}/tools
245 /usr/share/%{name}/upgrade
246 /usr/share/%{name}/web
247 /usr/share/%{name}/zabbix
249 #/var/www/cgi-bin/monitor
250 %{_sysconfdir}/cron.d/monitor-server.cron
251 %{_sysconfdir}/plc.d/monitor
252 %{_sysconfdir}/plc.d/monitor.functions
253 %{_sysconfdir}/plc.d/zabbix
254 %{_sysconfdir}/httpd/conf.d
259 %defattr(-,root,root)
260 #%{_initrddir}/monitor
261 #%{_sysconfdir}/cron.d/monitor
265 /usr/bin/RunlevelAgent.py*
266 /%{_initrddir}/monitor-runlevelagent
271 # TODO: depend on distribution packages where feasible.
273 # it would be better to be able to depend on the distribution's
274 # packages for these additional python modules, but packages provided
275 # by fedora 8 (our current deployment) doesn't match the version
277 export TMPDIR=/var/tmp/
278 easy_install -UZ http://files.turbogears.org/eggs/TurboGears-1.0.7-py2.5.egg
279 easy_install -UZ http://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.5.3.tar.gz
280 easy_install -UZ Elixir
282 # crazy openssl libs for racadm binary
283 ln -s /lib/libssl.so.0.9.8b /usr/lib/libssl.so.2
284 mkdir %{_datadir}/%{name}/.ssh
285 chmod 700 %{_datadir}/%{name}/.ssh
287 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
288 sed -i -e 's/^session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/crond
291 # NOTE: enable monitor by default, since we're installing it.
292 if ! plc-config --category plc_monitor --variable enabled ; then
293 plc-config --category plc_monitor --variable enabled --value true \
294 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
296 if ! plc-config --category plc_monitor --variable from_email ; then
297 plc-config --category plc_monitor --variable from_email --value monitor@localhost.localdomain \
298 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
300 if ! plc-config --category plc_monitor --variable cc_email ; then
301 plc-config --category plc_monitor --variable cc_email --value monitor@localhost.localdomain \
302 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
304 if ! plc-config --category plc_monitor --variable rt_queue ; then
305 plc-config --category plc_monitor --variable rt_queue --value support \
306 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
310 if ! plc-config --category plc_zabbix --variable enabled ; then
311 plc-config --category plc_zabbix --variable enabled --value false \
312 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
314 if ! plc-config --category plc_zabbix --variable host ; then
315 plc-config --category plc_zabbix --variable host --value localhost.localdomain \
316 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
318 if ! plc-config --category plc_zabbix --variable ip ; then
319 plc-config --category plc_zabbix --variable ip --value "" \
320 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
324 # TODO: do as much as possible to get the host setup and running.
325 #chkconfig --add monitor-nagios
326 #chkconfig monitor-nagios on
330 # TODO: this will be nice when we have a web-based service running., such as
331 # an API server or so on.
332 # TODO: create real monitorconfig.py from monitorconfig-default.py
333 # TODO: create symlink in /var/lib/monitor for chroot environments
334 # TODO: update the content of automate_pl03.sh
335 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
337 # NOTE: generate the python defines from zabbix include files.
338 #php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py
340 # apply patches to zabbix
341 #patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff
343 #chkconfig --add monitor-server
344 #chkconfig monitor-server on
347 chkconfig --add monitor
351 chkconfig --add monitor-runlevelagent
352 chkconfig monitor-runlevelagent on
353 if [ "$PL_BOOTCD" != "1" ] ; then
354 service monitor-runlevelagent restart
359 * Thu May 20 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-35
360 - Add CSV link on Advanced query
361 - Preparing to branch
363 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-34
364 - * copy selections to clipbord on Advanced Query page
365 - * RPM Pattern as regexp
368 * Tue Apr 27 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-33
369 - handle hostname changes
371 * Tue Apr 20 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-32
372 - from this version, suitable for 5.0
373 - requires bootcd with the new 5.0 naming style 3-part nodefamily
375 * Mon Apr 12 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-31
376 - added fix for node delete/add causing conflicts in MyOps db.
377 - added statistics scripts
379 * Thu Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
380 - * fix paths for automate script
382 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
383 - - separate pcucontrol as an svn module
384 - - restore easy_instal back into post install stage of server-deps
385 - - template imporovements for web interface
387 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
388 - do not need buildrequires. a new tag to fix centos builds
390 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
391 - fix rpm build issues
393 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
394 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
396 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
397 - add option for site status to include both node & pcu status
398 - improve ticket handling
399 - template gadget.xml for a site-specific google-gadget summary
401 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
404 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
405 - - remove monitor-client.cron
406 - - remove unused monitor-client init script
407 - - fix UP/DOWN summary on nodes page.
408 - - make node page display all nodes by default
409 - - add boot_server field
410 - - add myops_ssh_key to the keychain
411 - - use ext_consortium_id to distinguish pending sites.
413 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
414 - show/hide advance query form.
416 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
417 - fixed pause_penalty bug.
418 - fixed IPAL pcucontrol bug
419 - fixed bootman tunnel setup bug (occurred in rare cases)
421 - added BootmanSequenceRecords to separate config data from source code
422 - added get/setBootmanSequence(s) to xmlrpc API
424 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
426 - added bm log collection and optional integration with BootManager's log Upload()
427 - added iptables_status
428 - expanded advanced query
429 - added differentiated bootmanager_restore actions so that actionsummary displays
430 - counts for each kind of bootmanager action
431 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
432 - added plain-text options for query page by adding tg_format=plain to URL
433 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
434 - fixed a bug in determining whether comon's dir was running on a node
436 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
438 - adds multiple features and web changes
439 - adds new fields to db
441 - general improvements otherwise
443 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
445 - improved templates and views
446 - cleaned controller code for web
447 - added IPMI requirement to pcucontrol package.
449 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
450 - added bootmanager log links
451 - addressed root cause of IntegrityErrors ; big deal
452 - adjusted templates to accomodate fix for IntegrityErrors
453 - added session.flush() to bootman.py to write out ActionsRecords
454 - fixed policy to either pause penalties or apply them ; not both.
456 -* Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
457 -- Added Rpyc from 1.0 branch.
459 -- add setup-agent for password protected keys.
460 -- other minor improvements.
462 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
466 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
469 - added statistics dir
471 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
472 - remove plccache from controllers, all lookups from db.
473 - reformat emailTxt messags
474 - updated bootstates in bootman.py
476 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
477 - tag of latest changes.
478 - need to test end to end.
480 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
481 - big merge from the 2.0 branch
483 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
484 - minor improvements in rendering with sortable tables
486 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
488 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
489 - first draft with sortable tables + checkpoint
491 * Fri May 15 2009 Baris Metin <tmetin@sophia.inria.fr>
492 - use plekit tables from plewww.
493 - depend on plewww-plekit
495 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
497 - fix for package name dependency
500 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
501 - add improved docs to the latest build and tag.
503 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
504 - add documentation hooks for adding in-line docs like NM and PLCAPI
506 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
507 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
508 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
509 - 'safeboot', 'failboot', 'reinstall', etc.
511 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
512 - same as 2.0-12 tag.
514 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
515 - merge from 2.0, remove more zabbix code, simplify install, etc.
517 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
518 - major merge from 2.0 branch.
519 - ready to be updated with 4.3 and web changes.
521 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
522 - preparing to make a 2.0 branch for monitor.
524 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
525 - new changes are significantly different, that I'm upping the number for clarity.
527 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
528 - These are all changes in the latest Monitor code. I will branch this version
529 - next, before making additional large changes.
531 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
532 - Checkpointing current version for 4.2-rc21 - many many changes
534 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
535 - This is a major tag of every thing. probably needs a very different release
538 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
539 - Incremental improvements
541 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
542 - tagging everything for OneLab tech-transfer.
545 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
548 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
551 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
552 - This should be ready for 4.2rc2
555 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
558 %define module_current_branch 3.0