File monitoring-plugins-snmp-C.spec of Package monitoring-plugins-snmp-C

#
# spec file for package monitoring-plugins-snmp-C
#
# Copyright (c) 2012-2014 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/
#

Name:           monitoring-plugins-snmp-C
Version:        0.6.0
Release:        100
License:        GPL-2.0+
%define         realname nagios-plugins-snmp
Summary:        SNMP Plugins for Nagios v3
Url:            http://nagios.manubulon.com/
Group:          System/Monitoring
Source:         %realname-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM -- Add missing DESTDIR to Makefile
Patch0:         monitoring-plugins-snmp-0.6.0-Makefile.patch
# PATCH-FIX-UPSTREAM -- fix buffer overflows and small performance improvements
Patch1:         monitoring-plugins-snmp-0.6.0-segfault-performance.patch
#BuildRequires:  nagios
BuildRequires:  automake
BuildRequires:  autoconf
BuildRequires:  libtool
BuildRequires:  net-snmp-devel
BuildRequires:  tcpd-devel
BuildRequires:  nagios-rpm-macros
Provides:       nagios-plugins-snmp-C = %{version}-%{release}
Obsoletes:      nagios-plugins-snmp-C < %{version}-%{release}
Requires:       monitoring-plugins-common
%if 0%{?suse_version} > 1020
BuildRequires:  libopenssl0_9_8
%else
BuildRequires:  openssl-devel
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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 additional SNMP check plugins from http://nagios.manubulon.com/

%prep
%setup -q -n %realname
%patch0
%patch1 -p1

%build
autoreconf -fi
#autoconf
%configure \
    --libexecdir=%{nagios_plugindir} \
    --with-basetmpdir=%{nagios_spooldir} \
    --with-cachedir=%{nagios_spooldir}/snmp_cache \
    --sysconfdir=%{nagios_sysconfdir}
make %{?_smp_mflags}

%install
%makeinstall DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{nagios_spooldir}/snmp_cache


# add some example configs
mkdir -p %{buildroot}/%{nagios_sysconfdir}/snmp %{buildroot}%{nagios_spooldir}/snmp
cat > %{buildroot}/%{nagios_sysconfdir}/snmp/commands.cfg << EOF
# Some example command definitions for check_snmp-storage
#
# Arguments
# ARG1 : regexp of storage name
# ARG2 : warning level
# ARG3 : critical level
# ARG4 : additional arguments if needed.

#check_snmp_storage_v1 : using v1 snmp protocol
define command{
 command_name check_snmp_storage_v1
 command_line $USER1$/check_snmp_storage -H $HOSTADDRESS$ $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}

# check_snmp_storage_v2c : using v2c snmp protocol
define command{
 command_name check_snmp_storage_v2c
 command_line $USER1$/check_snmp_storage -H $HOSTADDRESS$ -2 $USER7$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}

# check_snmp_storage_v3 : using v3 snmp protocol
define command{
 command_name check_snmp_storage_v3
 command_line $USER1$/check_snmp_storage -H $HOSTADDRESS$ $USER8$ -m $ARG1$ -w $ARG2$ -c $ARG3$ $ARG4$
}
EOF

%find_lang %realname

%clean
rm -rf %{buildroot}

%files -f %realname.lang
%defattr(-,root,root)
%doc ABOUT-NLS AUTHORS ChangeLog COPYING NEWS README
%dir %{nagios_sysconfdir}
%dir %{nagios_sysconfdir}/snmp
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%dir %{nagios_spooldir}
%dir %{nagios_spooldir}/snmp
%attr(0775,%nagios_user,%nagios_group) %dir %{nagios_spooldir}/snmp_cache
%config(noreplace) %{nagios_sysconfdir}/snmp/*
%{nagios_plugindir}/*

%changelog