find bwlimit at plnode-utils
[mom.git] / pl_mom.spec
1 #
2 # $Id$
3 #
4 %define url $URL$
5
6 %define name pl_mom
7 %define version 2.3
8 %define taglevel 4
9
10 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
11  
12 Summary: PlanetLab node monitoring tools
13 Name: %{name}
14 Version: %{version}
15 Release: %{release}
16 License: GPL
17 Group: System Environment/Kernel
18 Source: %{name}-%{version}.tgz
19 Vendor: PlanetLab
20 Packager: PlanetLab Central <support@planet-lab.org>
21 Distribution: PlanetLab %{plrelease}
22 URL: %(echo %{url} | cut -d ' ' -f 2)
23 #URL: http://cvs.planet-lab.org/cvs/pl_mom
24 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
25 Requires: expect
26 # swapmon requires vps and vkill
27 Requires: util-vserver, util-vserver-python
28 # for bwlimit used in swapmon
29 Requires: plnode-utils
30 # bwmon requires tc
31 Requires: iproute
32  
33 %description
34 pl_mom is a suite of PlanetLab node monitoring tools.
35
36 swapmon is a swap monitoring daemon. Every 30 seconds, it checks
37 process memory usage. At 90% utilization, resets the slice that is
38 consuming the most physical memory. At 95% utilization, it reboots the
39 machine to avoid a crash.
40
41 pl_mop is a cron job that "fixes" various common problems with nodes
42 (dead services, ext3 corruption, zombie SSH sessions, etc.).
43
44 %prep
45 %setup -q
46
47 %build
48
49 %install
50 rm -rf $RPM_BUILD_ROOT
51
52 # Utility functions
53 install -D -m 644 pl_mom.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/pl_mom.py
54
55 # Bandwidth monitor (bwmon), run periodically
56 #install -D -m 755 bwmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/bwmon.py
57
58 # Swap monitoring daemon (swapmon)
59 install -D -m 755 swapmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/swapmon.py
60 install -D -m 755 swapmon.init $RPM_BUILD_ROOT/%{_initrddir}/swapmon
61
62 # Cleanup script
63 install -D -m 755 pl_mop.sh $RPM_BUILD_ROOT/usr/bin/pl_mop.sh
64
65 # Runs pl_mop and bwmon periodically
66 install -D -m 644 pl_mom.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/pl_mom
67
68 %clean
69 rm -rf $RPM_BUILD_ROOT
70
71 %pre
72 if [ "$PL_BOOTCD" != "1" ] ; then
73     service pl_mom stop
74 fi
75
76 exit 0
77
78 %post 
79 chkconfig --add swapmon
80 chkconfig swapmon on
81 if [ "$PL_BOOTCD" != "1" ] ; then
82     service swapmon restart
83 fi
84
85 # Randomize pl_mop run time
86 M=$((60 * $RANDOM / 32768))
87 H=$((24 * $RANDOM / 32768))
88 sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/pl_mom
89
90 exit 0
91
92 %preun
93 # 0 = erase, 1 = upgrade
94 if [ "$1" -eq 0 ]; then
95     if [ "$PL_BOOTCD" != "1" ] ; then
96         service swapmon stop
97     fi
98     chkconfig swapmon off
99     chkconfig --del swapmon
100 fi
101
102 exit 0
103
104 %files
105 %defattr(-, root, root, -)
106 %{_datadir}/%{name}/pl_mom.py*
107 %{_datadir}/%{name}/swapmon.py*
108 %{_initrddir}/swapmon
109 /usr/bin/pl_mop.sh
110 %{_sysconfdir}/cron.d/pl_mom
111
112 %changelog
113 * Tue May 10 2011 Scott Baker <smbaker@gmail.com> - Mom-2.3-4
114 - Avoid writing error messages to stdout that are due to errors
115 - reported from vps.
116
117 * Wed Apr 20 2011 Scott Baker <smbaker@gmail.com> - Mom-2.3-3
118 - Fix parsing of vps in swapmon, add swapmon error messages when unparseable
119 - lines encountered, add stuck rpm checking to pl_mop
120
121 * Sun Dec 13 2009 Daniel Hokka Zakrisson <daniel@hozac.com> - Mom-2.3-2
122 - Don't restart disabled services.
123
124 * Tue Apr 07 2009 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - Mom-2.3-1
125 - Merge from trunk.
126
127 * Wed Jul 19 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-7.planetlab
128 - swapmon: Added state info so same reset email does not keep getting
129   sent. If slice is already being killed, will wait for a timeout
130   before trying to kill again.
131
132 * Mon Jul 17 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-6.planetlab
133 - swapmon: Added state information per slice.  Slices are now killed
134   after consuming more memory than the threshold more than twice.
135   Also fixed the slice restart issue where slices would be restarted
136   and repeated restart emails would be sent.
137
138 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-5.planetlab
139 - bwmon: Initialize default limits
140
141 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-4.planetlab
142 - bwmon: Use cached values if NM stops responding