vserver is no longer needed.
[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 0
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 bwlimit.py
27 Requires: util-vserver, util-vserver-python
28 # bwmon requires tc
29 Requires: iproute
30  
31 %description
32 pl_mom is a suite of PlanetLab node monitoring tools.
33
34 swapmon is a swap monitoring daemon. Every 30 seconds, it checks
35 process memory usage. At 90% utilization, resets the slice that is
36 consuming the most physical memory. At 95% utilization, it reboots the
37 machine to avoid a crash.
38
39 pl_mop is a cron job that "fixes" various common problems with nodes
40 (dead services, ext3 corruption, zombie SSH sessions, etc.).
41
42 %prep
43 %setup -q
44
45 %build
46
47 %install
48 rm -rf $RPM_BUILD_ROOT
49
50 # Utility functions
51 install -D -m 644 pl_mom.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/pl_mom.py
52
53 # Bandwidth monitor (bwmon), run periodically
54 #install -D -m 755 bwmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/bwmon.py
55
56 # Swap monitoring daemon (swapmon)
57 install -D -m 755 swapmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/swapmon.py
58 install -D -m 755 swapmon.init $RPM_BUILD_ROOT/%{_initrddir}/swapmon
59
60 # Cleanup script
61 install -D -m 755 pl_mop.sh $RPM_BUILD_ROOT/usr/bin/pl_mop.sh
62
63 # Runs pl_mop and bwmon periodically
64 install -D -m 644 pl_mom.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/pl_mom
65
66 %clean
67 rm -rf $RPM_BUILD_ROOT
68
69 %pre
70 if [ "$PL_BOOTCD" != "1" ] ; then
71     service pl_mom stop
72 fi
73
74 exit 0
75
76 %post 
77 chkconfig --add swapmon
78 chkconfig swapmon on
79 if [ "$PL_BOOTCD" != "1" ] ; then
80     service swapmon restart
81 fi
82
83 # Randomize pl_mop run time
84 M=$((60 * $RANDOM / 32768))
85 H=$((24 * $RANDOM / 32768))
86 sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/pl_mom
87
88 exit 0
89
90 %preun
91 # 0 = erase, 1 = upgrade
92 if [ "$1" -eq 0 ]; then
93     if [ "$PL_BOOTCD" != "1" ] ; then
94         service swapmon stop
95     fi
96     chkconfig swapmon off
97     chkconfig --del swapmon
98 fi
99
100 exit 0
101
102 %files
103 %defattr(-, root, root, -)
104 %{_datadir}/%{name}/pl_mom.py*
105 %{_datadir}/%{name}/swapmon.py*
106 %{_initrddir}/swapmon
107 /usr/bin/pl_mop.sh
108 %{_sysconfdir}/cron.d/pl_mom
109
110 %changelog
111 * Wed Jul 19 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-7.planetlab
112 - swapmon: Added state info so same reset email does not keep getting
113   sent. If slice is already being killed, will wait for a timeout
114   before trying to kill again.
115
116 * Mon Jul 17 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-6.planetlab
117 - swapmon: Added state information per slice.  Slices are now killed
118   after consuming more memory than the threshold more than twice.
119   Also fixed the slice restart issue where slices would be restarted
120   and repeated restart emails would be sent.
121
122 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-5.planetlab
123 - bwmon: Initialize default limits
124
125 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-4.planetlab
126 - bwmon: Use cached values if NM stops responding