%define name myops
# keep this version in sync with monitor/monitor_version.py
%define version 1.0
-%define taglevel 0
+%define taglevel 1
%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
%global python_sitearch %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
%description getqueryview
The combination of collection, query and view servers.
+######################################## NAGIOS
+
+%package policy
+Summary: MyOps integration with Nagios
+Group: Applications/System
+
+Requires: coreutils
+Requires: passwd
+Requires: gd
+Requires: gd-devel
+Requires: mysql
+Requires: mysql-server
+Requires: mysql-devel
+Requires: mysql-libs
+Requires: mailx
+Requires: sendmail
+Requires: php
+Requires: httpd
+
+Requires: cronie
+Requires: nagios
+Requires: nagios-common
+Requires: nagios-devel
+Requires: nagios-plugins-all
+Requires: ndoutils
+Requires: ndoutils-mysql
+
+Requires: rt3
+
+
+%description policy
+Scripts and setup necessary to integrate and monitor PLC with Nagios.
+Best suited to F12 or above.
+
+
%prep
%setup -q
install -d $RPM_BUILD_ROOT/var/www/html/PlanetLabConf/
install -d $RPM_BUILD_ROOT/var/www/html/view
-rsync -a ./puppet $RPM_BUILD_ROOT/usr/share/myops/
-rsync -a ./web $RPM_BUILD_ROOT/usr/share/myops/
+rsync -a ./puppet $RPM_BUILD_ROOT/usr/share/myops/
+rsync -a ./web $RPM_BUILD_ROOT/usr/share/myops/
+rsync -a ./nagios $RPM_BUILD_ROOT/usr/share/myops/
# Generate an autosign list from plc node hostnames
install -D -m 755 puppet/cron.d/autosign.plcsh $RPM_BUILD_ROOT/%{_sysconfdir}/cron.hourly/
install -D -m 644 web/db-config.d/030-conf_files_myops $RPM_BUILD_ROOT/etc/planetlab/db-config.d
install -D -m 755 web/collect/sar2graphite.py $RPM_BUILD_ROOT/usr/bin/
+install -D -m 755 web/collect/client/update.sh $RPM_BUILD_ROOT/var/www/html/PlanetLabConf/myops_update_sh
install -D -m 755 web/collect/sar2graphite.py $RPM_BUILD_ROOT/var/www/html/PlanetLabConf/
install -D -m 644 web/collect/cron.d/sysstat.cron $RPM_BUILD_ROOT/var/www/html/PlanetLabConf/
install -D -m 644 web/collect/cron.d/sysstat.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/
install -D -m 644 web/view/urllist.txt $RPM_BUILD_ROOT/var/www/html/view/
install -D -m 644 web/view/index.php $RPM_BUILD_ROOT/var/www/html/view/
+install -D -m 755 nagios/myops-nagios.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/myops-nagios
+install -D -m 644 nagios/myops-nagios.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/myops-nagios.cron
+install -D -m 644 nagios/plc.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
+install -D -m 644 nagios/generic.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
+
%clean
rm -rf $RPM_BUILD_ROOT
%defattr(-,root,root)
/usr/share/%{name}/web
/%{_sysconfdir}/cron.d/sysstat.cron
+/var/www/html/PlanetLabConf/myops_update_sh
/var/www/html/PlanetLabConf/sysstat.cron
/var/www/html/PlanetLabConf/sar2graphite.py*
/usr/bin/sar2graphite.py
/var/www/html/view/urllist.txt
/var/www/html/view/index.php
+%files policy
+%defattr(-,root,root)
+%{_sysconfdir}/plc.d/myops-nagios
+/usr/share/%{name}/nagios
+%{_sysconfdir}/cron.d/myops-nagios.cron
+
%files puppet-server
%defattr(-,root,root)
/%{_sysconfdir}/cron.hourly/autosign.plcsh