# Copyright (C) 2007 Platform Computing Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # # # $Id$ # Summary: Kusu configuration for Nagios(R) Name: kusu-nagios-config Version: 0.1 Release: 2 License: GPLv2 Group: Applications/System Vendor: Platform Computing Corporation Source0: %{name}-%{version}.1.tar.gz URL: http://www.nagios.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot Requires: nagios BuildArch: noarch %description This package will modify the configuration of a standard Nagios(R) install to monitor a Kusu cluster out of the box. %prep %setup -q -n %{name} %build # There are a handful of occurences of /usr/lib or /usr/lib64. sed "s,__LIB_DIR__,%{_libdir},g" etc/cgi.cfg > tmp && mv tmp etc/cgi.cfg %install rm -rf %{buildroot} install -d -m 0755 %{buildroot}%{_sysconfdir}/nagios/commands install -d -m 0755 %{buildroot}%{_sysconfdir}/httpd/conf.d install -m 0664 etc/*cfg* %{buildroot}%{_sysconfdir}/nagios install -m 0664 etc/commands/* %{buildroot}%{_sysconfdir}/nagios/commands install -D -m 0644 nagios-httpd.conf %{buildroot}%{_sysconfdir}/httpd/conf.d/nagios.conf.kusu install -D -m 0755 kusu-nagios_user_restore %{buildroot}%{_sbindir}/kusu-nagios_user_restore mv %{buildroot}%{_sysconfdir}/nagios/cgi.cfg{,.kusu} mv %{buildroot}%{_sysconfdir}/nagios/nagios.cfg{,.kusu} %clean %pre %preun %post # Move the original configs aside. mv %{_sysconfdir}/nagios/cgi.cfg{,.orig} mv %{_sysconfdir}/nagios/nagios.cfg{,.orig} mv %{_sysconfdir}/nagios/commands.cfg{,.orig} mv %{_sysconfdir}/nagios/localhost.cfg{,.orig} mv %{_sysconfdir}/httpd/conf.d/nagios.conf{,.orig} # Install our configs. mv %{_sysconfdir}/nagios/cgi.cfg{.kusu,} mv %{_sysconfdir}/nagios/nagios.cfg{.kusu,} mv %{_sysconfdir}/httpd/conf.d/nagios.conf{.kusu,} # The login/password for nagios is admin/admin. /usr/bin/htpasswd -bc %{_sysconfdir}/nagios/passwd admin admin > /dev/null 2>&1 chmod 0640 %{_sysconfdir}/nagios/passwd chgrp nagios %{_sysconfdir}/nagios/passwd # Have Nagios start on boot. /sbin/chkconfig nagios on > /dev/null 2>&1 || : # Start the nagios service and restart webserver. /sbin/service nagios start > /dev/null 2>&1 || : /sbin/service httpd condrestart > /dev/null 2>&1 || : %postun %files %defattr(-,root,root,-) %dir %{_sysconfdir}/nagios %{_sbindir}/* %config(noreplace) %{_sysconfdir}/httpd/conf.d/nagios.conf.kusu %config(noreplace) %{_sysconfdir}/nagios/*cfg* %config(noreplace) %{_sysconfdir}/nagios/commands/*cfg* %changelog * Mon Jan 28 2008 Mike Mazur 0.1-2 - Initial package.