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