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
69 Scripts and setup necessary to integrate and monitor PLC with Nagios.
70 Best suited to F12 or above.
72 ######################################## CLIENT
75 Summary: Monitor hooks for a PLC node
76 Group: Applications/System
81 The client scripts handle account creation inside of a node. This will
82 include configuration setup for the monitoring agent running on the node. It
83 will also include any cron or init scripts needed to perform this kind of
85 ######################################## Server Deps
87 Summary: Monitor hooks for the PLC server.
88 Group: Applications/System
91 Requires: python-setuptools-devel
92 Requires: python-peak-util-extremes
94 Requires: compat-libstdc++-296
95 Requires: openssh-clients
96 Requires: perl-libwww-perl
97 Requires: perl-IO-Socket-SSL
98 Requires: MySQL-python
99 Requires: perl-DBD-mysql
106 # 5.0-18 is when the extra monitor plc-config values were added to myplc default_config.xml
107 Requires: myplc >= 5.0-18
109 Requires: plewww-plekit
113 #Requires: zabbix-client
114 #Requires: zabbix-gui
115 #Requires: zabbix-server
117 %description server-deps
118 The server side include all python modules and scripts needed to fully
120 ######################################## Server
122 Summary: Monitor hooks for the PLC server.
123 Group: Applications/System
126 Requires: monitor-server-deps
128 # NOTE: removed b/c 'distroname' gets corrupted during build process.
129 # Requires: bootcd-%{pldistro}-%{distroname}-%{_arch} >= 5.0
132 The server side include all python modules and scripts needed to fully
133 operation, track, and interact with any third-party monitoring software, such
136 ######################################## RunlevelAgent
137 %package runlevelagent
138 summary: the RunlevelAgent that reports node runlevels
139 group: applications/system
142 %description runlevelagent
143 The RunlevelAgent starts as early as possible during boot-up and production
144 mode to actively report the observed runlevel to PLC and update the
145 'last_contact' field.
151 rm -rf $RPM_BUILD_ROOT
152 #################### CLIENT
153 #install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
154 #install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
155 install -D -m 755 tools/timeout.pl $RPM_BUILD_ROOT/usr/bin/timeout.pl
158 #################### SERVER
159 install -d $RPM_BUILD_ROOT/usr/share/%{name}
160 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
161 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
162 install -d $RPM_BUILD_ROOT/var/lib/%{name}
163 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
164 install -d $RPM_BUILD_ROOT/var/www/html/monitorlog/
165 install -d $RPM_BUILD_ROOT/etc/httpd/conf.d/
166 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
169 install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
170 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
171 #install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
173 install -D -m 755 nagios/monitor-nagios.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
174 install -D -m 644 nagios/monitor-nagios.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-nagios.cron
176 # cron job for automated polling
177 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
179 # apache configuration
180 install -D -m 644 web/monitorweb.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/
182 # we'll install monitor in site-packages install rest to
184 rsync -a --exclude archive-pdb --exclude .cvsignore --exclude .svn --exclude CVS \
186 ./ $RPM_BUILD_ROOT/usr/share/%{name}/
188 #rm -f $RPM_BUILD_ROOT/usr/share/%{name}/zabbix.spec
190 # install monitor python package
191 rsync -a --exclude .svn ./monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
193 install -D -m 644 monitor/wrapper/plc.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
194 install -D -m 644 monitor/generic.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
196 # install third-party module to site-packages
197 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
200 #touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
201 #chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
203 #install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
204 #cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
206 #################### RunlevelAgent
207 install -D -m 755 RunlevelAgent.py $RPM_BUILD_ROOT/usr/bin/RunlevelAgent.py
208 install -D -m 755 monitor-runlevelagent.init $RPM_BUILD_ROOT/%{_initrddir}/monitor-runlevelagent
210 mkdir -p $RPM_BUILD_ROOT/var/log
211 touch $RPM_BUILD_ROOT/var/log/server-deps.log
215 rm -rf $RPM_BUILD_ROOT
218 /var/log/server-deps.log
221 %defattr(-,root,root)
222 %{_sysconfdir}/plc.d/monitor-nagios
223 /usr/share/%{name}/nagios
224 %{_sysconfdir}/cron.d/monitor-nagios.cron
227 %defattr(-,root,root)
228 #%config /usr/share/%{name}/monitorconfig.py
229 #%config /etc/monitor.conf
231 /usr/share/%{name}/MANIFEST.in
232 /usr/share/%{name}/Makefile
233 /usr/share/%{name}/Monitor.spec
234 /usr/share/%{name}/README.txt
235 /usr/share/%{name}/RunlevelAgent.py*
236 /usr/share/%{name}/automate-default.sh
237 /usr/share/%{name}/monitor-default.conf
238 /usr/share/%{name}/monitor-runlevelagent.init
239 /usr/share/%{name}/monitor-server.cron
240 /usr/share/%{name}/monitor-server.init
241 /usr/share/%{name}/monitor.functions
242 /usr/share/%{name}/setup.py*
243 /usr/share/%{name}/threadpool.py*
244 /usr/share/%{name}/zabbix.spec
246 /usr/share/%{name}/bootcd
247 /usr/share/%{name}/commands
248 /usr/share/%{name}/config.d
249 #/usr/share/%{name}/cron.d
250 /usr/share/%{name}/docs
251 /usr/share/%{name}/histlog
252 /usr/share/%{name}/keys
253 #/usr/share/%{name}/log
254 /usr/share/%{name}/statistics
255 /usr/share/%{name}/tests
256 /usr/share/%{name}/tools
257 /usr/share/%{name}/upgrade
258 /usr/share/%{name}/web
259 /usr/share/%{name}/zabbix
261 #/var/www/cgi-bin/monitor
262 %{_sysconfdir}/cron.d/monitor-server.cron
263 %{_sysconfdir}/plc.d/monitor
264 %{_sysconfdir}/plc.d/monitor.functions
265 #%{_sysconfdir}/plc.d/zabbix
266 %{_sysconfdir}/httpd/conf.d
271 %defattr(-,root,root)
272 #%{_initrddir}/monitor
273 #%{_sysconfdir}/cron.d/monitor
277 /usr/bin/RunlevelAgent.py*
278 /%{_initrddir}/monitor-runlevelagent
282 # TODO: depend on distribution packages where feasible.
284 # it would be better to be able to depend on the distribution's
285 # packages for these additional python modules, but packages provided
286 # by fedora 8 (our current deployment) doesn't match the version
288 export TMPDIR=/var/tmp/
289 #easy_install -UZ http://files.turbogears.org/eggs/TurboGears-1.0.7-py2.5.egg
290 #easy_install -UZ http://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.5.3.tar.gz
291 #easy_install -UZ Elixir
292 chkconfig sendmail on
295 # crazy openssl libs for racadm binary
296 ln -s /lib/libssl.so.0.9.8b /usr/lib/libssl.so.2
297 mkdir %{_datadir}/%{name}/.ssh
298 chmod 700 %{_datadir}/%{name}/.ssh
300 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
301 sed -i -e 's/^session required pam_loginuid.so/#session required pam_loginuid.so/g' /etc/pam.d/crond
304 # NOTE: enable monitor by default, since we're installing it.
305 if ! plc-config --category plc_monitor --variable enabled ; then
306 plc-config --category plc_monitor --variable enabled --value true \
307 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
309 if ! plc-config --category plc_monitor --variable from_email ; then
310 plc-config --category plc_monitor --variable from_email --value monitor@localhost.localdomain \
311 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
313 if ! plc-config --category plc_monitor --variable cc_email ; then
314 plc-config --category plc_monitor --variable cc_email --value monitor@localhost.localdomain \
315 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
317 if ! plc-config --category plc_monitor --variable rt_queue ; then
318 plc-config --category plc_monitor --variable rt_queue --value support \
319 --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml
323 # TODO: do as much as possible to get the host setup and running.
324 #chkconfig --add monitor-nagios
325 #chkconfig monitor-nagios on
329 # TODO: this will be nice when we have a web-based service running., such as
330 # an API server or so on.
331 # TODO: create real monitorconfig.py from monitorconfig-default.py
332 # TODO: create symlink in /var/lib/monitor for chroot environments
333 # TODO: update the content of automate_pl03.sh
334 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
336 # NOTE: generate the python defines from zabbix include files.
337 #php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py
339 # apply patches to zabbix
340 #patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff
342 #chkconfig --add monitor-server
343 #chkconfig monitor-server on
346 chkconfig --add monitor
350 if [ -f /etc/planetlab/node_id ] ; then
351 chkconfig --add monitor-runlevelagent
352 chkconfig monitor-runlevelagent on
353 if [ "$PL_BOOTCD" != "1" ] ; then
354 service monitor-runlevelagent restart
360 * Wed Aug 31 2011 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-3.1-5
361 - account for new ok status type in PCUs
362 - include a percentage of nodes up as well as raw node-count
364 * Fri May 27 2011 s s <soltesz@cs.princeton.edu> - monitor-3.1-4
365 - Fixes to spec file for monitor building
367 * Fri May 27 2011 s s <soltesz@cs.princeton.edu> - monitor-3.1-3
368 - fixing syntax errors
370 * Fri May 27 2011 s s <soltesz@cs.princeton.edu> - monitor-3.1-2
371 - Add better requirements list, work with TurboGears packaged by fedora,
372 - Remove some zabbix files
373 - Add a controllers_local.py for custom extensions
375 * Fri May 06 2011 s s <soltesz@cs.princeton.edu> - monitor-3.1-1
376 - last tag before some more major changes
378 * Thu May 20 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-35
379 - Add CSV link on Advanced query
380 - Preparing to branch
382 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-34
383 - * copy selections to clipbord on Advanced Query page
384 - * RPM Pattern as regexp
387 * Tue Apr 27 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-33
388 - handle hostname changes
390 * Tue Apr 20 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-32
391 - from this version, suitable for 5.0
392 - requires bootcd with the new 5.0 naming style 3-part nodefamily
394 * Mon Apr 12 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-31
395 - added fix for node delete/add causing conflicts in MyOps db.
396 - added statistics scripts
398 * Thu Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
399 - * fix paths for automate script
401 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
402 - - separate pcucontrol as an svn module
403 - - restore easy_instal back into post install stage of server-deps
404 - - template imporovements for web interface
406 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
407 - do not need buildrequires. a new tag to fix centos builds
409 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
410 - fix rpm build issues
412 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
413 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
415 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
416 - add option for site status to include both node & pcu status
417 - improve ticket handling
418 - template gadget.xml for a site-specific google-gadget summary
420 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
423 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
424 - - remove monitor-client.cron
425 - - remove unused monitor-client init script
426 - - fix UP/DOWN summary on nodes page.
427 - - make node page display all nodes by default
428 - - add boot_server field
429 - - add myops_ssh_key to the keychain
430 - - use ext_consortium_id to distinguish pending sites.
432 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
433 - show/hide advance query form.
435 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
436 - fixed pause_penalty bug.
437 - fixed IPAL pcucontrol bug
438 - fixed bootman tunnel setup bug (occurred in rare cases)
440 - added BootmanSequenceRecords to separate config data from source code
441 - added get/setBootmanSequence(s) to xmlrpc API
443 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
445 - added bm log collection and optional integration with BootManager's log Upload()
446 - added iptables_status
447 - expanded advanced query
448 - added differentiated bootmanager_restore actions so that actionsummary displays
449 - counts for each kind of bootmanager action
450 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
451 - added plain-text options for query page by adding tg_format=plain to URL
452 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
453 - fixed a bug in determining whether comon's dir was running on a node
455 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
457 - adds multiple features and web changes
458 - adds new fields to db
460 - general improvements otherwise
462 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
464 - improved templates and views
465 - cleaned controller code for web
466 - added IPMI requirement to pcucontrol package.
468 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
469 - added bootmanager log links
470 - addressed root cause of IntegrityErrors ; big deal
471 - adjusted templates to accomodate fix for IntegrityErrors
472 - added session.flush() to bootman.py to write out ActionsRecords
473 - fixed policy to either pause penalties or apply them ; not both.
475 -* Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
476 -- Added Rpyc from 1.0 branch.
478 -- add setup-agent for password protected keys.
479 -- other minor improvements.
481 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
485 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
488 - added statistics dir
490 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
491 - remove plccache from controllers, all lookups from db.
492 - reformat emailTxt messags
493 - updated bootstates in bootman.py
495 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
496 - tag of latest changes.
497 - need to test end to end.
499 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
500 - big merge from the 2.0 branch
502 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
503 - minor improvements in rendering with sortable tables
505 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
507 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
508 - first draft with sortable tables + checkpoint
510 * Fri May 15 2009 Baris Metin <tmetin@sophia.inria.fr>
511 - use plekit tables from plewww.
512 - depend on plewww-plekit
514 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
516 - fix for package name dependency
519 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
520 - add improved docs to the latest build and tag.
522 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
523 - add documentation hooks for adding in-line docs like NM and PLCAPI
525 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
526 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
527 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
528 - 'safeboot', 'failboot', 'reinstall', etc.
530 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
531 - same as 2.0-12 tag.
533 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
534 - merge from 2.0, remove more zabbix code, simplify install, etc.
536 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
537 - major merge from 2.0 branch.
538 - ready to be updated with 4.3 and web changes.
540 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
541 - preparing to make a 2.0 branch for monitor.
543 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
544 - new changes are significantly different, that I'm upping the number for clarity.
546 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
547 - These are all changes in the latest Monitor code. I will branch this version
548 - next, before making additional large changes.
550 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
551 - Checkpointing current version for 4.2-rc21 - many many changes
553 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
554 - This is a major tag of every thing. probably needs a very different release
557 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
558 - Incremental improvements
560 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
561 - tagging everything for OneLab tech-transfer.
564 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
567 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
570 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
571 - This should be ready for 4.2rc2
574 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
577 %define module_current_branch 3.0