04dd860893135405232f5aedfb2812c000e57d66
[monitor.git] / Monitor.spec
1 #
2 # $Id$
3
4
5 %define url $URL: svn+ssh://svn.planet-lab.org/svn/monitor/trunk/monitor.spec $
6
7 %define name monitor
8 %define version 1.1
9 %define taglevel 0
10
11 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
12 %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
13
14 Name: %{name}
15 Version: %{version}
16 Release: %{release}
17 Source0: %{name}-%{version}.tar.bz2
18 License: GPL
19 Group: Applications/System
20 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
21
22 Vendor: PlanetLab
23 Packager: PlanetLab Central <support@planet-lab.org>
24 Distribution: PlanetLab %{plrelease}
25 URL: %(echo %{url} | cut -d ' ' -f 2)
26
27 Summary: Monitor account initialization for the root image.
28 Group: Applications/System
29
30 %description
31 Monitor is a collection of secondary scripts for configuring the node polling
32 system, syncing the PLC db with the monitoring database, notifying users,
33 interacting with PCU hardware, applying penalties to sites that violate
34 acceptable use.
35
36 %package client
37 Summary: Monitor hooks for a PLC node
38 Group: Applications/System
39 Requires: curl
40 Requires: coreutils
41
42 %description client
43 The client scripts handle account creation inside of a node.  This will
44 include configuration setup for the monitoring agent running on the node.  It
45 will also include any cron or init scripts needed to perform this kind of
46 maintenance.
47
48 %package server
49 Summary: Monitor hooks for the PLC server.
50 Group: Applications/System
51 Requires: python
52 Requires: openssh-clients
53 Requires: perl-libwww-perl
54 Requires: perl-IO-Socket-SSL 
55 Requires: MySQL-python
56 Requires: rt3 == 3.4.1
57 Requires: nmap
58 Requires: PLCWWW >= 4.2
59 Requires: bootcd-planetlab-i386 >= 4.2
60
61 %description server
62 The server side include all python modules and scripts needed to fully
63 operation, track, and interact with any third-party monitoring software, such
64 as Zabbix DB.
65
66 %prep
67 %setup -q
68
69 %build
70 # NOTE: the build uses g++ cmdamt/
71 # NOTE: TMPDIR is needed here b/c the tmpfs of the build vserver is too small.
72 cd cmdamt
73 export TMPDIR=$PWD/tmp
74 make
75 cd ..
76
77 %install
78 rm -rf $RPM_BUILD_ROOT
79 #################### CLIENT 
80 install -D -m 755 monitor.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
81 install -D -m 755 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
82
83 #################### SERVER
84 install -d $RPM_BUILD_ROOT/usr/share/%{name}
85 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
86 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
87 install -d $RPM_BUILD_ROOT/var/lib/%{name}
88 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
89 install -d $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
90
91 echo " * Installing core scripts"
92 rsync -a --exclude www --exclude archive-pdb --exclude .svn --exclude CVS \
93           ./ $RPM_BUILD_ROOT/usr/share/%{name}/
94
95 echo " * Installing web pages"
96 rsync -a www/ $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
97
98 echo " * Installing cron job for automated polling"
99 install -D -m 644 %{name}.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/%{name}.cron
100 echo " * TODO: Setting up Monitor account in local MyPLC"
101 # TODO: 
102
103 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
104 install -d -D -m 755 monitor $RPM_BUILD_ROOT/%{python_sitearch}/monitor
105 # TODO: need a much better way to do this.
106 rsync -a monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
107 #for file in __init__.py database.py config.py ; do 
108 #       install -D -m 644 monitor/$file $RPM_BUILD_ROOT/%{python_sitearch}/monitor/$file
109 #done
110 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
111
112 touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
113 chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
114
115 install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
116 cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
117
118 %clean
119 rm -rf $RPM_BUILD_ROOT
120
121 %files server
122 %defattr(-,root,root)
123 %config /usr/share/%{name}/monitorconfig.py
124 %config /etc/monitor.conf
125 /usr/share/%{name}
126 /var/lib/%{name}
127 /var/www/cgi-bin/monitor
128 %{_sysconfdir}/cron.d/%{name}.cron
129 %{python_sitearch}/threadpool.py
130 %{python_sitearch}/threadpool.pyc
131 %{python_sitearch}/threadpool.pyo
132 %{python_sitearch}/monitor
133
134 %files client
135 %defattr(-,root,root)
136 %{_initrddir}/monitor
137 %{_sysconfdir}/cron.d/monitor
138
139 %post server
140 # TODO: this will be nice when we have a web-based service running., such as
141 #               an API server or so on.
142 # TODO: create real monitorconfig.py from monitorconfig-default.py
143 # TODO: create monitorconfig.php using phpconfig.py 
144 # TODO: create symlink in /var/lib/monitor-server for chroot environments
145 # TODO: update the content of automate_pl03.sh 
146 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
147
148 #chkconfig --add monitor-server
149 #chkconfig monitor-server on
150
151 %post client
152 chkconfig --add monitor
153 chkconfig monitor on
154
155 %changelog
156 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
157 - These are all changes in the latest Monitor code.  I will branch this version
158 - next, before making additional large changes.
159
160 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
161 - Checkpointing current version for 4.2-rc21 - many many changes
162
163 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
164 - This is a major tag of every thing.  probably needs a very different release
165 - number.
166
167 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
168 - Incremental improvements
169
170 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
171 - tagging everything for OneLab tech-transfer.
172
173
174 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
175
176
177 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
178
179
180 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
181 - This should be ready for 4.2rc2
182
183
184 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
185 - initial addition.
186
187 %define module_current_branch 1.0