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