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

# 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
PreReq:         permissions
Source0:        nagios-plugins-%{version}.tar.bz2
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
BuildRequires:  radiusclient
%if 0%{?suse_version} > 910
BuildRequires:  krb5-devel syslog-ng
BuildRequires:  heimdal-devel
BuildRequires:  krb5-devel
Requires:       perl
Requires:       perl-Net-SNMP

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.

    Karl DeBisschop <>
    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
Requires:       radiusclient

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

They depend on other packages which have to be installed.

    Karl DeBisschop <>
    and others

%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
pushd contrib
%{__rm} -r aix
find -type f -exec %{__chmod} 644 {} \;

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' \
make all %{?jobs:-j%jobs}

sed -i 's,^MKINSTALLDIRS.*,MKINSTALLDIRS = ../mkinstalldirs,' po/Makefile
%{__install} -m 0755 %{S:10} $RPM_BUILD_ROOT%{libexecdir}/check_xenvm
%{__install} -m 0755 contrib/ $RPM_BUILD_ROOT%{libexecdir}/
%{__install} -m 0755 contrib/ $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
# check_sensors makes no sense on some archs
%ifarch ppc ppc64 sparc sparc64
%{__rm} -f %{buildroot}%{libexecdir}/check_sensors
%find_lang %{name}

%{__rm} -rf $RPM_BUILD_ROOT

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

%files -f %{name}.lang
%doc example README.SuSE
%doc contrib
%doc command.cfg
%dir %{_prefix}/lib/nagios
%dir %{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}/

%files extras