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