Moved some files around and merged from 1.0 branch:
[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
52 Requires: python
53 Requires: python-sqlalchemy
54 Requires: python-elixir
55
56 Requires: openssh-clients
57 Requires: perl-libwww-perl
58 Requires: perl-IO-Socket-SSL 
59 Requires: MySQL-python
60 Requires: rt3 == 3.4.1
61 Requires: nmap
62 Requires: PLCWWW >= 4.2
63 Requires: bootcd-planetlab-i386 >= 4.2
64
65 %description server
66 The server side include all python modules and scripts needed to fully
67 operation, track, and interact with any third-party monitoring software, such
68 as Zabbix DB.
69
70 %prep
71 %setup -q
72
73 %build
74 # NOTE: the build uses g++ cmdamt/
75 # NOTE: TMPDIR is needed here b/c the tmpfs of the build vserver is too small.
76 cd cmdamt
77 export TMPDIR=$PWD/tmp
78 make
79 cd ..
80
81 %install
82 rm -rf $RPM_BUILD_ROOT
83 #################### CLIENT 
84 install -D -m 755 monitor.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
85 install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
86
87 #################### SERVER
88 install -d $RPM_BUILD_ROOT/usr/share/%{name}
89 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
90 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
91 install -d $RPM_BUILD_ROOT/var/lib/%{name}
92 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
93 install -d $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
94
95 echo " * Installing core scripts"
96 rsync -a --exclude www --exclude archive-pdb --exclude .svn --exclude CVS \
97           ./ $RPM_BUILD_ROOT/usr/share/%{name}/
98
99 echo " * Installing web pages"
100 rsync -a www/ $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/
101
102 echo " * Installing cron job for automated polling"
103 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
104 echo " * TODO: Setting up Monitor account in local MyPLC"
105 # TODO: 
106
107 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
108 install -d -D -m 755 monitor $RPM_BUILD_ROOT/%{python_sitearch}/monitor
109 # TODO: need a much better way to do this.
110 rsync -a monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
111 #for file in __init__.py database.py config.py ; do 
112 #       install -D -m 644 monitor/$file $RPM_BUILD_ROOT/%{python_sitearch}/monitor/$file
113 #done
114 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
115
116 touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
117 chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
118
119 install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
120 cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
121
122 %clean
123 rm -rf $RPM_BUILD_ROOT
124
125 %files server
126 %defattr(-,root,root)
127 %config /usr/share/%{name}/monitorconfig.py
128 %config /etc/monitor.conf
129 /usr/share/%{name}
130 /var/lib/%{name}
131 /var/www/cgi-bin/monitor
132 %{_sysconfdir}/cron.d/monitor-server.cron
133 %{python_sitearch}/threadpool.py
134 %{python_sitearch}/threadpool.pyc
135 %{python_sitearch}/threadpool.pyo
136 %{python_sitearch}/monitor
137
138 %files client
139 %defattr(-,root,root)
140 %{_initrddir}/monitor
141 %{_sysconfdir}/cron.d/monitor
142
143 %post server
144 # TODO: this will be nice when we have a web-based service running., such as
145 #               an API server or so on.
146 # TODO: create real monitorconfig.py from monitorconfig-default.py
147 # TODO: create monitorconfig.php using phpconfig.py 
148 # TODO: create symlink in /var/lib/monitor-server for chroot environments
149 # TODO: update the content of automate_pl03.sh 
150 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
151
152 #chkconfig --add monitor-server
153 #chkconfig monitor-server on
154
155 %post client
156 chkconfig --add monitor
157 chkconfig monitor on
158
159 %changelog
160 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
161 - These are all changes in the latest Monitor code.  I will branch this version
162 - next, before making additional large changes.
163
164 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
165 - Checkpointing current version for 4.2-rc21 - many many changes
166
167 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
168 - This is a major tag of every thing.  probably needs a very different release
169 - number.
170
171 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
172 - Incremental improvements
173
174 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
175 - tagging everything for OneLab tech-transfer.
176
177
178 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
179
180
181 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
182
183
184 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
185 - This should be ready for 4.2rc2
186
187
188 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
189 - initial addition.
190
191 %define module_current_branch 1.0