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: ndoutils
Requires: ndoutils-mysql
+Requires: rt3
+
%description nagios
Scripts and setup necessary to integrate and monitor PLC with Nagios.
install -D -m 644 monitor.functions $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor.functions
install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor
install -D -m 755 zabbix/monitor-zabbix.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/zabbix
-# TODO: update with a real init file
-install -D -m 755 monitor-server.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
+
+install -D -m 755 nagios/monitor-nagios.init $RPM_BUILD_ROOT/%{_sysconfdir}/plc.d/monitor-nagios
+install -D -m 644 nagios/monitor-nagios.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-nagios.cron
# cron job for automated polling
install -D -m 644 monitor-server.cron $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/monitor-server.cron
# we'll install monitor in site-packages install rest to
# /usr/share/monitor
-rsync -a --exclude archive-pdb --exclude .svn --exclude CVS \
+rsync -a --exclude archive-pdb --exclude .cvsignore --exclude .svn --exclude CVS \
--exclude monitor/ \
./ $RPM_BUILD_ROOT/usr/share/%{name}/
# install monitor python package
rsync -a --exclude .svn ./monitor/ $RPM_BUILD_ROOT/%{python_sitearch}/monitor/
+install -D -m 644 monitor/wrapper/plc.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
+install -D -m 644 monitor/generic.py $RPM_BUILD_ROOT/usr/share/%{name}/nagios/
+
# install third-party module to site-packages
install -D -m 755 threadpool.py $RPM_BUILD_ROOT/%{python_sitearch}/threadpool.py
# TODO:
-echo " * TODO: Setting up Monitor account in local MyPLC"
-
#touch $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
#chmod 777 $RPM_BUILD_ROOT/var/www/cgi-bin/monitor/monitorconfig.php
%files nagios
%defattr(-,root,root)
%{_sysconfdir}/plc.d/monitor-nagios
-#/usr/share/%{name}/nagios # TODO: not sure how this will impact the server files
+/usr/share/%{name}/nagios
+%{_sysconfdir}/cron.d/monitor-nagios.cron
%files server
%defattr(-,root,root)
#%config /usr/share/%{name}/monitorconfig.py
#%config /etc/monitor.conf
-/usr/share/%{name}
/var/lib/%{name}
+/usr/share/%{name}/MANIFEST.in
+/usr/share/%{name}/Makefile
+/usr/share/%{name}/Monitor.spec
+/usr/share/%{name}/README.txt
+/usr/share/%{name}/RunlevelAgent.py*
+/usr/share/%{name}/automate-default.sh
+/usr/share/%{name}/monitor-default.conf
+/usr/share/%{name}/monitor-runlevelagent.init
+/usr/share/%{name}/monitor-server.cron
+/usr/share/%{name}/monitor-server.init
+/usr/share/%{name}/monitor.functions
+/usr/share/%{name}/setup.py*
+/usr/share/%{name}/threadpool.py*
+/usr/share/%{name}/zabbix.spec
+
+/usr/share/%{name}/bootcd
+/usr/share/%{name}/commands
+/usr/share/%{name}/config.d
+/usr/share/%{name}/cron.d
+/usr/share/%{name}/docs
+/usr/share/%{name}/keys
+/usr/share/%{name}/log
+/usr/share/%{name}/statistics
+/usr/share/%{name}/tests
+/usr/share/%{name}/tools
+/usr/share/%{name}/upgrade
+/usr/share/%{name}/web
+/usr/share/%{name}/zabbix
+
#/var/www/cgi-bin/monitor
%{_sysconfdir}/cron.d/monitor-server.cron
%{_sysconfdir}/plc.d/monitor
%post nagios
# TODO: do as much as possible to get the host setup and running.
+#chkconfig --add monitor-nagios
+#chkconfig monitor-nagios on
+chkconfig mysqld on
%post server
# TODO: this will be nice when we have a web-based service running., such as
chkconfig monitor on
%post runlevelagent
-chkconfig --add monitor-runlevelagent
-chkconfig monitor-runlevelagent on
-if [ "$PL_BOOTCD" != "1" ] ; then
- service monitor-runlevelagent restart
+if [ -f /etc/planetlab/node_id ] ; then
+ chkconfig --add monitor-runlevelagent
+ chkconfig monitor-runlevelagent on
+ if [ "$PL_BOOTCD" != "1" ] ; then
+ service monitor-runlevelagent restart
+ fi
fi