# # $Id$ # %define url $URL$ %define name pl_mom %define version 2.3 %define taglevel 2 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}} Summary: PlanetLab node monitoring tools Name: %{name} Version: %{version} Release: %{release} License: GPL Group: System Environment/Kernel Source: %{name}-%{version}.tgz Vendor: PlanetLab Packager: PlanetLab Central Distribution: PlanetLab %{plrelease} URL: %(echo %{url} | cut -d ' ' -f 2) #URL: http://cvs.planet-lab.org/cvs/pl_mom BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: expect # swapmon requires vps and bwlimit.py Requires: util-vserver, util-vserver-python # bwmon requires tc Requires: iproute %description pl_mom is a suite of PlanetLab node monitoring tools. swapmon is a swap monitoring daemon. Every 30 seconds, it checks process memory usage. At 90% utilization, resets the slice that is consuming the most physical memory. At 95% utilization, it reboots the machine to avoid a crash. pl_mop is a cron job that "fixes" various common problems with nodes (dead services, ext3 corruption, zombie SSH sessions, etc.). %prep %setup -q %build %install rm -rf $RPM_BUILD_ROOT # Utility functions install -D -m 644 pl_mom.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/pl_mom.py # Bandwidth monitor (bwmon), run periodically #install -D -m 755 bwmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/bwmon.py # Swap monitoring daemon (swapmon) install -D -m 755 swapmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/swapmon.py install -D -m 755 swapmon.init $RPM_BUILD_ROOT/%{_initrddir}/swapmon # Cleanup script install -D -m 755 pl_mop.sh $RPM_BUILD_ROOT/usr/bin/pl_mop.sh # Runs pl_mop and bwmon periodically install -D -m 644 pl_mom.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/pl_mom %clean rm -rf $RPM_BUILD_ROOT %pre if [ "$PL_BOOTCD" != "1" ] ; then service pl_mom stop fi exit 0 %post chkconfig --add swapmon chkconfig swapmon on if [ "$PL_BOOTCD" != "1" ] ; then service swapmon restart fi # Randomize pl_mop run time M=$((60 * $RANDOM / 32768)) H=$((24 * $RANDOM / 32768)) sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/pl_mom exit 0 %preun # 0 = erase, 1 = upgrade if [ "$1" -eq 0 ]; then if [ "$PL_BOOTCD" != "1" ] ; then service swapmon stop fi chkconfig swapmon off chkconfig --del swapmon fi exit 0 %files %defattr(-, root, root, -) %{_datadir}/%{name}/pl_mom.py* %{_datadir}/%{name}/swapmon.py* %{_initrddir}/swapmon /usr/bin/pl_mop.sh %{_sysconfdir}/cron.d/pl_mom %changelog * Sun Dec 13 2009 Daniel Hokka Zakrisson - Mom-2.3-2 - Don't restart disabled services. * Tue Apr 07 2009 Faiyaz Ahmed - Mom-2.3-1 - Merge from trunk. * Wed Jul 19 2006 Faiyaz Ahmed 0.4-7.planetlab - swapmon: Added state info so same reset email does not keep getting sent. If slice is already being killed, will wait for a timeout before trying to kill again. * Mon Jul 17 2006 Faiyaz Ahmed 0.4-6.planetlab - swapmon: Added state information per slice. Slices are now killed after consuming more memory than the threshold more than twice. Also fixed the slice restart issue where slices would be restarted and repeated restart emails would be sent. * Mon Jul 10 2006 Faiyaz Ahmed 0.4-5.planetlab - bwmon: Initialize default limits * Mon Jul 10 2006 Faiyaz Ahmed 0.4-4.planetlab - bwmon: Use cached values if NM stops responding