update nagios scripts with new paths
[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 # keep this version in sync with monitor/monitor_version.py
9 %define version 3.1
10 %define taglevel 0
11
12 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
13 %global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
14
15 Name: %{name}
16 Version: %{version}
17 Release: %{release}
18 Source0: %{name}-%{version}.tar.bz2
19 License: GPL
20 Group: Applications/System
21 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
22
23 Vendor: PlanetLab
24 Packager: PlanetLab Central <support@planet-lab.org>
25 Distribution: PlanetLab %{plrelease}
26 URL: %(echo %{url} | cut -d ' ' -f 2)
27
28
29 Summary: Monitor account initialization for the root image.
30 Group: Applications/System
31
32 %description
33 Monitor is a collection of secondary scripts for configuring the node polling
34 system, syncing the PLC db with the monitoring database, notifying users,
35 interacting with PCU hardware, applying penalties to sites that violate
36 acceptable use.
37
38 ######################################## NAGIOS
39
40 %package nagios
41 Summary: Monitor integration with Nagios
42 Group: Applications/System
43
44 Requires: coreutils
45 Requires: passwd
46 Requires: gd
47 Requires: gd-devel
48 Requires: mysql
49 Requires: mysql-server
50 Requires: mysql-devel
51 Requires: mysql-libs
52 Requires: mailx
53
54 Requires: nagios
55 Requires: nagios-common
56 Requires: nagios-devel
57 Requires: nagios-plugins-all
58 Requires: ndoutils
59 Requires: ndoutils-mysql
60
61
62 %description nagios
63 Scripts and setup necessary to integrate and monitor PLC with Nagios.
64 Best suited to F12 or above.
65
66 ######################################## CLIENT
67
68 %package client
69 Summary: Monitor hooks for a PLC node
70 Group: Applications/System
71 Requires: curl
72 Requires: coreutils
73
74 %description client
75 The client scripts handle account creation inside of a node.  This will
76 include configuration setup for the monitoring agent running on the node.  It
77 will also include any cron or init scripts needed to perform this kind of
78 maintenance.
79 ######################################## Server Deps
80 %package server-deps
81 Summary: Monitor hooks for the PLC server.
82 Group: Applications/System
83
84 Requires: python
85 Requires: python-setuptools-devel
86 Requires: python-peak-util-extremes
87
88 Requires: compat-libstdc++-296
89 Requires: openssh-clients
90 Requires: perl-libwww-perl
91 Requires: perl-IO-Socket-SSL 
92 Requires: MySQL-python
93 Requires: nmap
94 Requires: nc
95 Requires: rt3
96
97 Requires: plewww-plekit
98
99 #Requires: zabbix-client
100 #Requires: zabbix-gui
101 #Requires: zabbix-server
102
103 %description server-deps
104 The server side include all python modules and scripts needed to fully
105
106 ######################################## Server
107 %package server
108 Summary: Monitor hooks for the PLC server.
109 Group: Applications/System
110
111 Requires: python
112
113 Requires: monitor-server-deps
114 Requires: PLCWWW >= 4.2
115 Requires: bootcd-%{pldistro}-%{distroname}-%{_arch} >= 5.0
116 Requires: pcucontrol
117
118 %description server
119 The server side include all python modules and scripts needed to fully
120 operation, track, and interact with any third-party monitoring software, such
121 as Zabbix DB.
122
123 ####################################### RunlevelAgent
124 %package runlevelagent
125 summary: the RunlevelAgent that reports node runlevels
126 group: applications/system
127 requires: python
128
129 %description runlevelagent
130 The RunlevelAgent starts as early as possible during boot-up and production
131 mode to actively report the observed runlevel to PLC and update the
132 'last_contact' field.
133
134 %prep
135 %setup -q
136
137 %install
138 rm -rf $RPM_BUILD_ROOT
139 #################### CLIENT 
140 #install -D -m 755 monitor-client.init $RPM_BUILD_ROOT/%{_initrddir}/monitor
141 #install -D -m 644 monitor.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor
142 install -D -m 755 tools/timeout.pl $RPM_BUILD_ROOT/usr/bin/timeout.pl
143
144
145 #################### SERVER
146 install -d $RPM_BUILD_ROOT/usr/share/%{name}
147 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}
148 install -d $RPM_BUILD_ROOT/data/var/lib/%{name}/archive-pdb
149 install -d $RPM_BUILD_ROOT/var/lib/%{name}
150 install -d $RPM_BUILD_ROOT/var/lib/%{name}/archive-pdb
151 install -d $RPM_BUILD_ROOT/var/www/html/monitorlog/
152 install -d $RPM_BUILD_ROOT/etc/httpd/conf.d/
153 install -d $RPM_BUILD_ROOT/%{python_sitearch}/monitor
154
155 # plc.d scripts
156 install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
157 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
158 install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
159 # TODO: update with a real init file
160 install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
161
162 # cron job for automated polling
163 install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
164
165 # apache configuration
166 install -D -m 644 web/monitorweb-httpd.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/
167
168 # we'll install monitor in site-packages install rest to
169 # /usr/share/monitor
170 rsync -a --exclude archive-pdb --exclude .svn --exclude CVS  \
171     --exclude monitor/ \
172     ./  $RPM_BUILD_ROOT/usr/share/%{name}/
173
174 # install monitor python package
175 rsync -a --exclude .svn  ./monitor/   $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
176
177 # install third-party module to site-packages
178 install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
179
180 # TODO: 
181 echo " * TODO: Setting up Monitor account in local MyPLC"
182
183 #touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
184 #chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
185
186 #install -D -m 755 monitor-default.conf $RPM_BUILD_ROOT/etc/monitor.conf
187 #cp $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig-default.py $RPM_BUILD_ROOT/usr/share/%{name}/monitorconfig.py
188
189 #################### RunlevelAgent
190 install -D -m 755 RunlevelAgent.py $RPM_BUILD_ROOT/usr/bin/RunlevelAgent.py
191 install -D -m 755 monitor-runlevelagent.init $RPM_BUILD_ROOT/%{_initrddir}/monitor-runlevelagent
192
193 mkdir -p $RPM_BUILD_ROOT/var/log
194 touch $RPM_BUILD_ROOT/var/log/server-deps.log
195
196
197 %clean
198 rm -rf $RPM_BUILD_ROOT
199
200 %files server-deps
201 /var/log/server-deps.log
202
203 %files nagios
204 %defattr(-,root,root)
205 %{_sysconfdir}/plc.d/monitor-nagios
206 #/usr/share/%{name}/nagios # TODO: not sure how this will impact the server files
207
208 %files server
209 %defattr(-,root,root)
210 #%config /usr/share/%{name}/monitorconfig.py
211 #%config /etc/monitor.conf
212 /usr/share/%{name}
213 /var/lib/%{name}
214 #/var/www/cgi-bin/monitor
215 %{_sysconfdir}/cron.d/monitor-server.cron
216 %{_sysconfdir}/plc.d/monitor
217 %{_sysconfdir}/plc.d/monitor.functions
218 %{_sysconfdir}/plc.d/zabbix
219 %{_sysconfdir}/httpd/conf.d
220 %{python_sitearch}
221
222
223 %files client
224 %defattr(-,root,root)
225 #%{_initrddir}/monitor
226 #%{_sysconfdir}/cron.d/monitor
227 /usr/bin/timeout.pl
228
229 %files runlevelagent
230 /usr/bin/RunlevelAgent.py*
231 /%{_initrddir}/monitor-runlevelagent
232
233
234 %post server-deps
235 #
236 # TODO: depend on distribution packages where feasible.
237 #
238 #  it would be better to be able to depend on the distribution's
239 # packages for these additional python modules, but packages provided
240 # by fedora 8 (our current deployment) doesn't match the version
241 # requirements.
242 export TMPDIR=/var/tmp/
243 easy_install -UZ http://files.turbogears.org/eggs/TurboGears-1.0.7-py2.5.egg
244 easy_install -UZ http://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.5.3.tar.gz
245 easy_install -UZ Elixir
246
247 # crazy openssl libs for racadm binary
248 ln -s /lib/libssl.so.0.9.8b /usr/lib/libssl.so.2
249 mkdir %{_datadir}/%{name}/.ssh
250 chmod 700 %{_datadir}/%{name}/.ssh
251
252 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
253     sed -i -e 's/^session    required   pam_loginuid.so/#session    required   pam_loginuid.so/g' /etc/pam.d/crond
254 fi
255
256 # NOTE: enable monitor by default, since we're installing it.
257 if ! plc-config --category plc_monitor --variable enabled ; then 
258         plc-config --category plc_monitor --variable enabled --value true \
259                         --save /etc/planetlab/configs/site.xml  /etc/planetlab/configs/site.xml 
260 fi
261 if ! plc-config --category plc_monitor --variable from_email ; then
262         plc-config --category plc_monitor --variable from_email --value monitor@localhost.localdomain \
263                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
264 fi
265 if ! plc-config --category plc_monitor --variable cc_email ; then
266         plc-config --category plc_monitor --variable cc_email --value monitor@localhost.localdomain \
267                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
268 fi
269 if ! plc-config --category plc_monitor --variable rt_queue ; then
270         plc-config --category plc_monitor --variable rt_queue --value support \
271                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
272 fi
273
274 # zabbix:
275 if ! plc-config --category plc_zabbix --variable enabled ; then
276         plc-config --category plc_zabbix --variable enabled --value false \
277                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
278 fi
279 if ! plc-config --category plc_zabbix --variable host ; then
280         plc-config --category plc_zabbix --variable host --value localhost.localdomain \
281                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
282 fi
283 if ! plc-config --category plc_zabbix --variable ip ; then
284         plc-config --category plc_zabbix --variable ip --value "" \ 
285                         --save /etc/planetlab/configs/site.xml /etc/planetlab/configs/site.xml 
286 fi
287
288 %post nagios
289 # TODO: do as much as possible to get the host setup and running.
290
291 %post server
292 # TODO: this will be nice when we have a web-based service running., such as
293 #               an API server or so on.
294 # TODO: create real monitorconfig.py from monitorconfig-default.py
295 # TODO: create symlink in /var/lib/monitor for chroot environments
296 # TODO: update the content of automate_pl03.sh 
297 # TODO: Use the installed version of bootcd to create custom boot images. ( or, use the api now).
298
299 # NOTE: generate the python defines from zabbix include files.
300 #php /usr/share/%{name}/zabbix/getdefines.php > %{python_sitearch}/monitor/database/zabbixapi/defines.py
301
302 # apply patches to zabbix
303 #patch -d /var/www/html/zabbix/ -p0 < /usr/share/%{name}/zabbix/zabbix-auto-login.diff
304
305 #chkconfig --add monitor-server
306 #chkconfig monitor-server on
307
308 %post client
309 chkconfig --add monitor
310 chkconfig monitor on
311
312 %post runlevelagent
313 chkconfig --add monitor-runlevelagent
314 chkconfig monitor-runlevelagent on
315 if [ "$PL_BOOTCD" != "1" ] ; then
316         service monitor-runlevelagent restart
317 fi
318
319
320 %changelog
321 * Thu May 20 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-35
322 - Add CSV link on Advanced query
323 - Preparing to branch
324
325 * Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-34
326 - * copy selections to clipbord on Advanced Query page
327 - * RPM Pattern as regexp
328 - * scan ipmi port
329
330 * Tue Apr 27 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-33
331 - handle hostname changes
332
333 * Tue Apr 20 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-32
334 - from this version, suitable for 5.0
335 - requires bootcd with the new 5.0 naming style 3-part nodefamily
336
337 * Mon Apr 12 2010 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-31
338 - added fix for node delete/add causing conflicts in MyOps db.
339 - added statistics scripts
340
341 * Thu Jan 21 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-30
342 - * fix paths for automate script
343
344 * Tue Dec 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-29
345 - - separate pcucontrol as an svn module
346 - - restore easy_instal back into post install stage of server-deps
347 - - template imporovements for web interface
348
349 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-28
350 - do not need buildrequires. a new tag to fix centos builds
351
352 * Thu Dec 17 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-27
353 - fix rpm build issues
354
355 * Wed Dec 16 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-26
356 - to many changes, but mostly moved stuff around. there are some small fixes here and there.
357
358 * Fri Nov 20 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-25
359 - add option for site status to include both node & pcu status
360 - improve ticket handling
361 - template gadget.xml for a site-specific google-gadget summary
362
363 * Thu Oct 22 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-24
364 - - add install_date
365
366 * Mon Oct 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-23
367 - - remove monitor-client.cron
368 - - remove unused monitor-client init script
369 - - fix UP/DOWN summary on nodes page.
370 - - make node page display all nodes by default
371 - - add boot_server field
372 - - add myops_ssh_key to the keychain
373 - - use ext_consortium_id to distinguish pending sites.
374
375 * Fri Oct 09 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-22
376 - show/hide advance query form.
377
378 * Thu Sep 24 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-21
379 - fixed pause_penalty bug.
380 - fixed IPAL pcucontrol bug
381 - fixed bootman tunnel setup bug (occurred in rare cases)
382 - deprecated pcuview
383 - added BootmanSequenceRecords to separate config data from source code
384 - added get/setBootmanSequence(s) to xmlrpc API
385
386 * Fri Sep 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-20
387 - Major Features:
388 - added bm log collection and optional integration with BootManager's log Upload()
389 - added iptables_status
390 - expanded advanced query
391 - added differentiated bootmanager_restore actions so that actionsummary displays
392 - counts for each kind of bootmanager action
393 - added pcuerror notices (for mis-configurations) in addition to pcufailed notices
394 - added plain-text options for query page by adding tg_format=plain to URL
395 - fixed cross-module reference that prevented pcucontrol for working with RebootNodeWithPCU() api call.
396 - fixed a bug in determining whether comon's dir was running on a node
397
398 * Mon Aug 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-19
399 - Major increment -
400 - adds multiple features and web changes
401 - adds new fields to db
402 - improved layout
403 - general improvements otherwise
404
405 * Sun Jun 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-18
406 - bug fixes.
407 - improved templates and views
408 - cleaned controller code for web
409 - added IPMI requirement to pcucontrol package.
410
411 * Thu Jun 18 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-17
412 - added bootmanager log links
413 - addressed root cause of IntegrityErrors ; big deal
414 - adjusted templates to accomodate fix for IntegrityErrors
415 - added session.flush() to bootman.py to write out ActionsRecords
416 - fixed policy to either pause penalties or apply them ; not both.
417
418 -* Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-16
419 -- Added Rpyc from 1.0 branch.
420 -- add pcuhistory
421 -- add setup-agent for password protected keys.
422 -- other minor improvements.
423
424 * Wed Jun 17 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-15
425 - automate install
426 - auto-close tickets
427
428 * Fri Jun 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-14
429 - update web
430 - update policy
431 - added statistics dir
432
433 * Mon Jun 08 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-13
434 - remove plccache from controllers, all lookups from db.
435 - reformat emailTxt messags
436 - updated bootstates in bootman.py
437
438 * Tue Jun 02 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-12
439 - tag of latest changes.
440 - need to test end to end.
441
442 * Sat May 30 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-11
443 - big merge from the 2.0 branch
444
445 * Tue May 26 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-10
446 - minor improvements in rendering with sortable tables
447
448 * Tue May 19 2009 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - Monitor-3.0-9
449
450 * Fri May 15 2009 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-3.0-8
451 - first draft with sortable tables + checkpoint
452
453 * Fri May 15 2009 Baris Metin <tmetin@sophia.inria.fr>
454 - use plekit tables from plewww.
455 - depend on plewww-plekit
456
457 * Tue May 12 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-7
458 - make docs a noop
459 - fix for package name dependency
460 - correct docs
461
462 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-6
463 - add improved docs to the latest build and tag.
464
465 * Mon May 04 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-5
466 - add documentation hooks for adding in-line docs like NM and PLCAPI
467
468 * Fri May 01 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-4
469 - Rough pass over monitor-3.0 to allow it to work with 4.3 API.
470 - replaced GetNodeNetworks, nodeinterface_ids and using new bootstates
471 - 'safeboot', 'failboot', 'reinstall', etc.
472
473 * Tue Apr 28 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-3
474 - same as 2.0-12 tag.
475
476 * Mon Apr 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-2
477 - merge from 2.0, remove more zabbix code, simplify install, etc.
478
479 * Thu Apr 16 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-3.0-1
480 - major merge from 2.0 branch.
481 - ready to be updated with 4.3 and web changes.
482
483 * Fri Feb 27 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-1
484 - preparing to make a 2.0 branch for monitor.
485
486 * Mon Jan 05 2009 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-2.0-0
487 - new changes are significantly different, that I'm upping the number for clarity.
488
489 * Wed Sep 24 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-8
490 - These are all changes in the latest Monitor code.  I will branch this version
491 - next, before making additional large changes.
492
493 * Mon Sep 01 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - Monitor-1.0-7
494 - Checkpointing current version for 4.2-rc21 - many many changes
495
496 * Mon Aug 11 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-6
497 - This is a major tag of every thing.  probably needs a very different release
498 - number.
499
500 * Fri Jul 18 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-5
501 - Incremental improvements
502
503 * Mon May 19 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-4
504 - tagging everything for OneLab tech-transfer.
505
506
507 * Fri May 09 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-3
508
509
510 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-2
511
512
513 * Wed Apr 23 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - Monitor-1.0-1
514 - This should be ready for 4.2rc2
515
516
517 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - monitor-1.0-0
518 - initial addition.
519
520 %define module_current_branch 3.0