File monitoring-plugins-pdns.spec of Package monitoring-plugins-pdns

# spec file for package monitoring-plugins-pdns
# Copyright (c) 2017 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

Name:           monitoring-plugins-pdns
Version:        0~git73
Release:        0
License:        GPL-3.0+
Summary:        Monitor PowerDNS
Group:          System/Monitoring
Source1:        check_pdns.php
Source2:        COPYING
Source3:        monitoring-plugins-pdns-rpmlintrc
Patch0:         check_pdns.patch
BuildRequires:  nagios-rpm-macros
Requires:       sudo
Requires:       pdns
Requires:       pnp4nagios
Requires:       python
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Nagios plugin for monitoring PowerDNS. 

install -D -m755 %{SOURCE0} %buildroot/%{nagios_plugindir}/
patch %buildroot/%{nagios_plugindir}/ %{PATCH0}
install -Dp -m 0644 %{SOURCE1} %{buildroot}%{pnp4nagios_templatedir}/check_pdns.php
install -Dp -m 0644 %{SOURCE2} %{buildroot}%{_defaultdocdir}/%{name}/COPYING
install -d -m 755 %{buildroot}%{_sysconfdir}/sudoers.d
cat >> %{buildroot}%{_sysconfdir}/sudoers.d/%{name} << EOF
# Needed for %{name} - to gather statistics for the monitoring
Defaults:%{nagios_user} !requiretty
%{nagios_user} ALL=NOPASSWD: %{_bindir}/pdns_control

rm -rf %{buildroot}

%dir %{_defaultdocdir}/%{name}
%dir %{_sysconfdir}/sudoers.d
%doc %{_defaultdocdir}/%{name}/COPYING
%config(noreplace) %attr(0400,root,root) %{_sysconfdir}/sudoers.d/%{name}
# avoid build dependecy of nagios - own the dirs
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%dir %{pnp4nagios_datadir}
%dir %{pnp4nagios_templatedir}