Tagging module Mom - Mom-2.2-8
[mom.git] / pl_mom.spec
1 %define name pl_mom
2 %define version 2.2
3 %define taglevel 8
4
5 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
6
7 Summary: PlanetLab node monitoring tools
8 Name: %{name}
9 Version: %{version}
10 Release: %{release}
11 License: GPL
12 Group: System Environment/Kernel
13 Source: %{name}-%{version}.tgz
14 Vendor: PlanetLab
15 Packager: PlanetLab Central <support@planet-lab.org>
16 Distribution: PlanetLab 3.0
17 URL: http://cvs.planet-lab.org/cvs/pl_mom
18 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
19 Requires: expect
20 # swapmon requires vps and bwlimit.py
21 Requires: util-vserver, util-vserver-python
22 # bwmon requires tc
23 Requires: iproute
24  
25 %description
26 pl_mom is a suite of PlanetLab node monitoring tools.
27
28 swapmon is a swap monitoring daemon. Every 30 seconds, it checks
29 process memory usage. At 90% utilization, resets the slice that is
30 consuming the most physical memory. At 95% utilization, it reboots the
31 machine to avoid a crash.
32
33 pl_mop is a cron job that "fixes" various common problems with nodes
34 (dead services, ext3 corruption, zombie SSH sessions, etc.).
35
36 %prep
37 %setup -q
38
39 %build
40
41 %install
42 rm -rf $RPM_BUILD_ROOT
43
44 # Utility functions
45 install -D -m 644 pl_mom.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/pl_mom.py
46
47 # Bandwidth monitor (bwmon), run periodically
48 #install -D -m 755 bwmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/bwmon.py
49
50 # Swap monitoring daemon (swapmon)
51 install -D -m 755 swapmon.py $RPM_BUILD_ROOT/%{_datadir}/%{name}/swapmon.py
52 install -D -m 755 swapmon.init $RPM_BUILD_ROOT/%{_initrddir}/swapmon
53
54 # Cleanup script
55 install -D -m 755 pl_mop.sh $RPM_BUILD_ROOT/usr/bin/pl_mop.sh
56
57 # Runs pl_mop and bwmon periodically
58 install -D -m 644 pl_mom.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/pl_mom
59
60 %clean
61 rm -rf $RPM_BUILD_ROOT
62
63 %pre
64 if [ "$PL_BOOTCD" != "1" ] ; then
65     service pl_mom stop
66 fi
67
68 exit 0
69
70 %post 
71 chkconfig --add swapmon
72 chkconfig swapmon on
73 if [ "$PL_BOOTCD" != "1" ] ; then
74     service swapmon restart
75 fi
76
77 # Randomize pl_mop run time
78 M=$((60 * $RANDOM / 32768))
79 H=$((24 * $RANDOM / 32768))
80 sed -i -e "s/@M@/$M/" -e "s/@H@/$H/" %{_sysconfdir}/cron.d/pl_mom
81
82 exit 0
83
84 %preun
85 # 0 = erase, 1 = upgrade
86 if [ "$1" -eq 0 ]; then
87     if [ "$PL_BOOTCD" != "1" ] ; then
88         service swapmon stop
89     fi
90     chkconfig swapmon off
91     chkconfig --del swapmon
92 fi
93
94 exit 0
95
96 %files
97 %defattr(-, root, root, -)
98 %{_datadir}/%{name}/pl_mom.py*
99 %{_datadir}/%{name}/swapmon.py*
100 %{_initrddir}/swapmon
101 /usr/bin/pl_mop.sh
102 %{_sysconfdir}/cron.d/pl_mom
103
104 %changelog
105 * Thu Feb 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Mom-2.2-8
106 - minor cleanup
107
108 * Wed Nov 19 2008 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - Mom-2.2-7
109 - Kill processes in context rather than restarting it.
110 - * Fixes bug where reset processes lose connectivity.
111
112 * Tue Jul 29 2008 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - Mom-2.2-6
113 - Update mop script to monitor relevant procs.  Update swapmon to avoid corner case when slice is being built.
114
115 * Wed Jun 25 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Mom-2.2-5
116 - specfile was screwed, release number was not incremented upon tagging
117
118 * Thu Apr 24 2008 Faiyaz Ahmed <faiyaza@cs.princeton.edu> - Mom-2.2-4
119
120 - * Send mail from hostname if conf file can't be found
121 - * Use MOM address in conf file insead of support address.
122 - * Use new Vserver.  Start slices without INITSCRIPTS after kill so user can still log in.
123
124
125 * Wed Jul 19 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-7.planetlab
126 - swapmon: Added state info so same reset email does not keep getting
127   sent. If slice is already being killed, will wait for a timeout
128   before trying to kill again.
129
130 * Mon Jul 17 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-6.planetlab
131 - swapmon: Added state information per slice.  Slices are now killed
132   after consuming more memory than the threshold more than twice.
133   Also fixed the slice restart issue where slices would be restarted
134   and repeated restart emails would be sent.
135
136 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-5.planetlab
137 - bwmon: Initialize default limits
138
139 * Mon Jul 10 2006 Faiyaz Ahmed <faiyaza@cs.princeton.edu> 0.4-4.planetlab
140 - bwmon: Use cached values if NM stops responding