File nagios-plugins.spec of Package nagios-plugins

#
# spec file for package nagios-plugins (Version 1.4.15)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define         libexecdir %_prefix/lib/nagios/plugins

Name:           nagios-plugins
Summary:        The Nagios Plug-Ins
Version:        1.4.15
Release:        2
License:        GPLv2+
Group:          System/Monitoring
Url:            http://nagiosplugins.org/
PreReq:         permissions
Source0:        nagios-plugins-%{version}.tar.bz2
Source10:       nagios-plugins.check_xenvm.sh
Source11:       nagios-plugins-permissions
Source12:       nagios-plugins-README.SuSE
Patch1:         nagios-plugins-1.4.14-ntpd.patch
Patch2:         nagios-plugins-1.4.14-check_log.patch
Patch3:         nagios-plugins-1.4.14-command_cfg.patch
Patch4:         nagios-plugins-1.4.14-nmap.patch
Patch5:         nagios-plugins-1.4.14-check_inodes.patch
Patch6:         nagios-plugins-1.4.6-no_chown.patch
Patch8:         nagios-plugins.ctypes.patch
Patch9:         nagios-plugins.check_dhcp-char.patch
Patch10:        nagios-plugins.asprintf.patch
Patch11:        nagios-plugins.check_snmp.arrayaddress.patch
Patch12:        nagios-plugins-postgresql.patch
Patch13:        nagios-plugins.negate.validate_arguments.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  bind-utils fping iputils procps samba-client
BuildRequires:  dhcp-devel gnutls-devel libsmbclient-devel
BuildRequires:  mysql-devel
BuildRequires:  nagios-devel
BuildRequires:  net-snmp-devel openldap2-devel openssh
BuildRequires:  openssl-devel perl-Net-SNMP postfix postgresql-devel
BuildRequires:  python-devel
%if 0%{?suse_version}
%if 0%{?suse_version} > 1020
BuildRequires:  freeradius-client-devel
%else
BuildRequires:  radiusclient
%endif
%if 0%{?suse_version} > 910
BuildRequires:  krb5-devel syslog-ng
%else
BuildRequires:  heimdal-devel
%endif
%else
BuildRequires:  krb5-devel
%endif
Requires:       perl
Requires:       perl-Net-SNMP

%description
Nagios is a program that will monitor hosts and services on your
network, and to email or page you when a problem arises or is resolved.
Nagios runs on a unix server as a background or daemon 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 contains those plugins.



Authors:
--------
    Karl DeBisschop <kdebisschop@users.sourceforge.net>
    and others

%package  extras
Summary:        Nagios Plug-Ins which depend on additional packages
License:        GPLv2+
Group:          System/Monitoring
Requires:       %{name} = %{version}
Requires:       openssl net-snmp fping
%if 0%{?suse_version} > 1020
Requires:       freeradius-client
%else
Requires:       radiusclient
%endif

%description extras
These are additional plug-ins for Nagios.

They depend on other packages which have to be installed.



Authors:
--------
    Karl DeBisschop <kdebisschop@users.sourceforge.net>
    and others

%prep
%setup -q -n %{name}-%{version}
%{__mkdir_p} example/permissions.d
%{__cp} %{S:11} example/permissions.d/%{name}
%{__cp} %{S:12} ./README.SuSE
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0
%patch5 -p0
%patch6
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
pushd contrib
%{__rm} -r aix
find -type f -exec %{__chmod} 644 {} \;
popd

%build
export CFLAGS="%optflags -fno-strict-aliasing -DLDAP_DEPRECATED"
%configure \
	--libexecdir=%{libexecdir} \
	--with-cgiurl=/nagios/cgi-bin \
	--sysconfdir=%{_sysconfdir}/nagios \
	--enable-static=no \
    --enable-extra-opts \
	--with-fping-command=%{_sbindir}/fping \
	--with-ipv6 \
	--with-ping6-command='/bin/ping6 -n -U -w %d -c %d %s' \
	--with-apt-get-command=%{_bindir}/apt-get \
	--with-qstat-command=%{_bindir}/qstat \
	--with-rpcinfo-command=%{_sbindir}/rpcinfo \
    --with-ntpq-command=%{_sbindir}/ntpq \
    --with-ntpdc-command=%{_sbindir}/ntpdc \
    --with-ntpdate-command=%{_sbindir}/ntpdate \
	--with-ps-command="/bin/ps axwo 'stat uid pid ppid vsz rss pcpu etime comm args'" \
	--with-ps-format='%s %d %d %d %d %d %f %s %s %n' \
	--with-ps-cols=10 \
	--with-ps-varlist='procstat,&procuid,&procpid,&procppid,&procvsz,&procrss,&procpcpu,procetime,procprog,&pos' \
	--with-mysql
	#--enable-perl-modules 
make all %{?jobs:-j%jobs}

%install
sed -i 's,^MKINSTALLDIRS.*,MKINSTALLDIRS = ../mkinstalldirs,' po/Makefile
%makeinstall
%{__install} -m 0755 %{S:10} $RPM_BUILD_ROOT%{libexecdir}/check_xenvm
%{__install} -m 0755 contrib/check_linux_raid.pl $RPM_BUILD_ROOT%{libexecdir}/
%{__install} -m 0755 contrib/check_netapp.pl $RPM_BUILD_ROOT%{libexecdir}/
# fix "use lib" on installed perl checks
pushd $RPM_BUILD_ROOT%{libexecdir}
for file in $(find -maxdepth 1 -type f); do
    sed -i 's|use lib "nagios/plugins".*;|use lib "%{libexecdir}";|g;
            s|use lib "/usr/local/nagios/libexec".*;|use lib "%{libexecdir}";|g' $file
done
popd
# check_sensors makes no sense on some archs
%ifarch ppc ppc64 sparc sparc64
%{__rm} -f %{buildroot}%{libexecdir}/check_sensors
%endif
%find_lang %{name}

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%post
# in case somebody uses the permissions file we provide 
# in docdir, run permission here
%run_permissions

%files -f %{name}.lang
%defattr(-,root,root)
%doc ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS BUGS ChangeLog CODING COPYING FAQ LEGAL
%doc NEWS README REQUIREMENTS SUPPORT THANKS
%doc example README.SuSE
%doc contrib
%doc command.cfg
%dir %{_prefix}/lib/nagios
%dir %{libexecdir}
#
%defattr(0755,root,root)
%{libexecdir}/*
%exclude %{libexecdir}/check_fping
%exclude %{libexecdir}/check_hpjd
%exclude %{libexecdir}/check_ldap
%exclude %{libexecdir}/check_ldaps
%exclude %{libexecdir}/check_mysql
%exclude %{libexecdir}/check_mysql_query
%exclude %{libexecdir}/check_pgsql
#%exclude %{libexecdir}/check_radius
%exclude %{libexecdir}/check_snmp
%exclude %{libexecdir}/check_jabber
%exclude %{libexecdir}/check_nntps
%exclude %{libexecdir}/check_simap
%exclude %{libexecdir}/check_spop
%exclude %{libexecdir}/check_ssmtp
%exclude %{libexecdir}/check_apt
%exclude %{libexecdir}/check_game
%attr(0644,root,root) %{libexecdir}/utils.pm

%files extras
%defattr(0755,root,root)
%{libexecdir}/check_fping
%{libexecdir}/check_hpjd
%{libexecdir}/check_ldap
%{libexecdir}/check_ldaps
%{libexecdir}/check_mysql
%{libexecdir}/check_mysql_query
%{libexecdir}/check_pgsql
#%{libexecdir}/check_radius
%{libexecdir}/check_snmp
%{libexecdir}/check_jabber
%{libexecdir}/check_nntps
%{libexecdir}/check_simap
%{libexecdir}/check_spop
%{libexecdir}/check_ssmtp
%{libexecdir}/check_apt
%{libexecdir}/check_game

%changelog