#New ADVX macros %define ADVXdir %{_datadir}/ADVX %{expand:%(cat %{ADVXdir}/ADVX-build)} %define build_mysql 0 %define build_postgresql 0 # commandline overrides: # rpm -ba|--rebuild --with 'xxx' %{?_with_mysql: %{expand: %%define build_mysql 1}} %{?_with_postgresql: %{expand: %%define build_postgresql 1}} %if %{build_mysql} %define build_mysql 1 %define build_postgresql 0 %endif %if %{build_postgresql} %define build_mysql 0 %define build_postgresql 1 %endif %define name nagios %define version 1.0 %define release 7mdk %define nsusr nagios %define nsgrp nagios %define cmdusr apache %define cmdgrp apache Summary: Host/service/network monitoring program Name: %{name} Version: %{version} Release: %{release} License: GPL Group: Networking/Other URL: http://www.nagios.org/ Source0: %{name}-%{version}.tar.bz2 Source1: %{name}.init.bz2 Source2: %{name}-%{version}-minimalistic_config.tar.bz2 Source3: %{name}-%{version}-apache2_config.tar.bz2 PreReq: rpm-helper Requires: chkconfig Requires: gawk Requires: grep Requires: nagios-plugins Requires: shadow-utils Requires: textutils Requires: perl BuildRequires: freetype2-devel BuildRequires: freetype-devel BuildRequires: libgd2-devel BuildRequires: libjpeg62-devel BuildRequires: libpng3-devel BuildRequires: libxpm4-devel BuildRequires: XFree86-devel BuildRequires: zlib1-devel BuildRequires: perl-devel BuildRequires: ADVX-build >= 1.2 # use this when embedded perl works in nagios #Requires: libgdbm2 #BuildRequires: libgdbm2-devel #BuildRequires: perl-devel %if %{build_mysql} Requires: libmysql12 BuildRequires: libmysql12-devel %endif %if %{build_postgresql} Requires: libopenssl0.9.7 libpq3 libgcc1 libstdc++5 BuildRequires: postgresql-devel libpq3-devel libopenssl0.9.7-devel libstdc++5-devel %endif BuildRoot: %{_tmppath}/%{name}-buildroot Obsoletes: netsaint Provides: netsaint %description Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. The actual service checks are performed by separate "plugin" programs which return the status of the checks to Nagios. This package provide core programs for nagios. The web interface, documentation, and development files are built as separate packages You can also rebuild nagios with either MySQL or PostgreSQL support. The following are valid build options. (ie. use with rpm --rebuild): --with postgresql Build with PostgreSQL support --with mysql Build with MySQL support %package www Summary: Provides the HTML and CGI files for the Nagios web interface. Group: Networking/WWW PreReq: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release} Requires: apache2 Requires: freetype Requires: freetype2 Requires: libgd2 Requires: libintl2 Requires: libjpeg62 Requires: libpng3 Requires: libxpm4 Requires: mailx Requires: perl Requires: XFree86-libs Requires: zlib1 Requires: traceroute %description www Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. Several CGI programs are included with Nagios in order to allow you to view the current service status, problem history, notification history, and log file via the web. This package provides the HTML and CGI files for the Nagios web interface. In addition, HTML documentation is included in this package %package devel Group: Development/C Summary: Provides include files that Nagios-related applications may compile against. %description devel Nagios is a program that will monitor hosts and services on your network. It has the ability to email or page you when a problem arises and when a problem is resolved. Nagios is written in C and is designed to run under Linux (and some other *NIX variants) as a background process, intermittently running checks on various services that you specify. This package provides include files that Nagios-related applications may compile against. %prep %setup -q -a3 mv contrib/database/README contrib/database/README.database mv contrib/README contrib/README.contrib %build %serverbuild %configure \ --with-init-dir=%{_initrddir} \ --exec-prefix=%{_sbindir} \ --bindir=%{_sbindir} \ --sbindir=%{_libdir}/nagios/cgi \ --libexecdir=%{_libdir}/nagios/plugins \ --datadir=%{_datadir}/nagios \ --sysconfdir=%{_sysconfdir}/nagios \ --localstatedir=/var/log/nagios \ --with-lockfile=/var/run/nagios/nagios.pid \ --with-ping-command="/bin/ping -n %%s -c %%d" \ --with-mail=/bin/mail \ --with-nagios-user=%{nsusr} \ --with-nagios-grp=%{nsgrp} \ --with-command-user=%{cmdusr} \ --with-command-grp=%{cmdgrp} \ --with-cgiurl=/admin/nagios/cgi-bin \ --with-htmurl=/admin/nagios \ %if !%{build_mysql} && !%{build_postgresql} --with-default-comments \ --with-default-downtime \ --with-default-extinfo \ --with-default-retention \ --with-default-status \ %endif %if %{build_mysql} --with-mysql-comments \ --with-mysql-downtime \ --with-mysql-extinfo \ --with-mysql-inc=%{_includedir}/mysql \ --with-mysql-lib=%{_libdir} \ --with-mysql-retention \ --with-mysql-status \ --with-mysql-xdata \ %endif %if %{build_postgresql} --with-pgsql-comments \ --with-pgsql-downtime \ --with-pgsql-extinfo \ --with-pgsql-inc=%{_includedir}/pgsql \ --with-pgsql-lib=%{_libdir} \ --with-pgsql-retention \ --with-pgsql-status \ --with-pgsql-xdata \ %endif --with-default-objects \ --with-default-perfdata \ --with-file-perfdata \ --with-template-extinfo \ --with-template-objects # use this when embedded perl works in nagios # --enable-embedded-perl \ # --with-perlcache \ make all pushd contrib make daemonchk.cgi make traceroute.cgi # use this when embedded perl works in nagios # make mini_epn make convertcfg popd # build the extra ministatus.cgi pushd cgi cp ../contrib/ministatus.c . make ministatus.cgi popd %install [ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} # don't fiddle with the initscript! export DONT_GPRINTIFY=1 install -d -m0755 %{buildroot}/var/spool/nagios install -d -m0755 %{buildroot}/var/run/nagios install -d -m0755 %{buildroot}%{_includedir}/nagios install -d -m0755 %{buildroot}%{_initrddir} install -d -m0755 %{buildroot}%{_sysconfdir}/httpd/conf.d install -d -m0755 %{buildroot}%{_sysconfdir}/nagios install -d -m0755 %{buildroot}%{_libdir}/nagios/plugins make DESTDIR=%{buildroot} INSTALL_OPTS="" INIT_OPTS="" COMMAND_OPTS="" \ install install-html install-commandmode install-config \ fullinstall install -m0644 sample-config/nagios.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/cgi.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/resource.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/checkcommands.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/contactgroups.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/contacts.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/dependencies.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/escalations.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/hostgroups.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/hosts.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/misccommands.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/services.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 sample-config/template-object/timeperiods.cfg %{buildroot}%{_sysconfdir}/nagios/ install -m0644 common/locations.h %{buildroot}%{_includedir}/nagios/ pushd contrib make INSTALL=install INSTALL_OPTS="" COMMAND_OPTS="" CGIDIR=%{buildroot}%{_libdir}/nagios/cgi install popd # install the extra ministatus.cgi install -m755 cgi/ministatus.cgi %{buildroot}%{_libdir}/nagios/cgi/ # fix strange dir perms find %{buildroot}%{_datadir}/nagios -type d | xargs chmod 755 # fix default config perl -p -i -e "s|=/var/log/nagios/rw/|=/var/spool/nagios/|g" %{buildroot}%{_sysconfdir}/nagios/* # install simplified init script bzcat %{SOURCE1} > %{buildroot}%{_initrddir}/nagios chmod 755 %{buildroot}%{_initrddir}/nagios # install my minimalistic config (should generate less error feedback;)) pushd %{buildroot}%{_sysconfdir}/nagios tar -jxf %{SOURCE2} popd # fix web access install -m644 apache2_config %{buildroot}%{_sysconfdir}/httpd/conf.d/a12_nagios.conf install -m644 passwd %{buildroot}%{_sysconfdir}/nagios/passwd install -m644 group %{buildroot}%{_sysconfdir}/nagios/group # put the extra utilities in place #mv %{buildroot}%{_libdir}/nagios/cgi/mini_epn %{buildroot}%{_sbindir}/ mv %{buildroot}%{_libdir}/nagios/cgi/convertcfg %{buildroot}%{_sbindir}/ %pre %_pre_useradd %{nsusr} /var/log/nagios /bin/sh %post %_post_service %{name} %preun %_preun_service %{name} %postun %_postun_userdel %{nsusr} %post www %ADVXpost echo "NOTE: Don't forget to set the nagios password, issue the command:" echo "htpasswd %{_sysconfdir}/nagios/passwd nagios" %postun www %ADVXpost %clean [ -n "%{buildroot}" -a "%{buildroot}" != / ] && rm -rf %{buildroot} %files %defattr(-,root,root) %doc Changelog INSTALLING LEGAL README UPGRADING contrib/htaccess.sample %if %{build_mysql} %doc contrib/database/README.database contrib/database/create_mysql %endif %if %{build_postgresql} %doc contrib/database/README.database contrib/database/create_pgsql %endif %attr(0755,root,root) %config(noreplace) %{_initrddir}/nagios %attr(0755,root,root) %{_sbindir}/* %attr(0755,root,root) %dir %{_sysconfdir}/nagios %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/cgi.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/checkcommands.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/contactgroups.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/contacts.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/dependencies.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/escalations.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/hostgroups.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/hosts.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/misccommands.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/nagios.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/resource.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/services.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/timeperiods.cfg-sample %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/cgi.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/checkcommands.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/contactgroups.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/contacts.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/dependencies.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/escalations.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/hostgroups.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/hosts.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/misccommands.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/nagios.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/resource.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/services.cfg %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/timeperiods.cfg %attr(0755,%{nsusr},%{nsgrp}) %dir /var/log/nagios %attr(0755,%{nsusr},%{nsgrp}) %dir /var/log/nagios/archives %attr(2775,%{nsusr},%{cmdgrp}) %dir /var/spool/nagios %attr(0755,%{nsusr},%{nsgrp}) %dir /var/run/nagios %files www %defattr(-,root,root) %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/a12_nagios.conf %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/passwd %attr(644,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/nagios/group %attr(0755,root,root) %dir %{_libdir}/nagios/cgi %attr(0755,root,root) %{_libdir}/nagios/cgi/* %attr(0755,root,root) %dir %{_datadir}/nagios %attr(-,root,root) %{_datadir}/nagios/* %files devel %defattr(-,root,root) %attr(0755,root,root) %dir %{_includedir}/nagios %attr(0644,root,root) %{_includedir}/nagios/* %changelog * Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-7mdk - argh!!! forgot to update requires and buildrequires for the conditional builds!!! * Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-6mdk - argh!!! forgot to provide the pid dir!!! - might as well restart apache... (using the advx macros) * Sun Mar 09 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-5mdk - fixed S2 & S3 (this should work right out of the box...) * Sat Mar 08 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-4mdk - remove rude stuff in %%post, let apache2 handle it... - added S3 - relocate the /nagios url to /admin/nagios - fix pid dir in S1 and in the spec file * Thu Jan 16 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-3mdk - build release * Sat Dec 07 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-2mdk - PreReq: nagios on the nagios-www subpackage (should generate the nagios user and prevent errors) - ship my minimalistic config files (S2) in %%{_sysconfdir}/nagios/, people expects nagios to work right out of the box..., well there you have it..., now it should... - simplified the sysv script (S1) - major spec file fixes * Mon Nov 25 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0-1mdk - new version * Sat Nov 23 2002 Olivier Thauvin <thauvin@aerov.jussieu.fr> 1.0b6-2mdk - fix missing/unpackaged files * Tue Sep 17 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b6-1mdk - new version * Sun Sep 15 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b5-2mdk - fixed a bug where restart did not work as pointed out by Guillaume Bourque - misc spec file fixes * Thu Aug 15 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 1.0b5-1mdk - initial cooker contrib - misc spec file fixes, used the provided spec file but used spec file voodoo magic from Vincent Danens qmail package to be able to rebuild with either MySQL or PostgreSQL support.