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

#
# spec file for package monitoring-plugins-puppet_agent
#
# Copyright (c) 2013-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-puppet_agent
Version:        20131209
Release:        100
License:        BSD-3-Clause
Summary:        Monitor Puppet agent state
Url:            https://github.com/aswen/nagios-plugins
Group:          System/Monitoring
Source0:        check_puppet_agent
Source2:        %{name}-rpmlintrc
Source3:        %{name}-sudoers
Patch0:         check_puppet_agent-use_sudo_for_awk.patch
BuildRequires:  nagios-rpm-macros
Provides:       nagios-plugins-puppet_agent = %{version}-%{release}
Obsoletes:      nagios-plugins-puppet_agent < %{version}-%{release}
Requires:       bash
Requires:       gawk
Requires:       grep
Requires:       sudo
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This script looks if there is a puppet agent process and then it checks the
last state summary file and checks when puppet agent last run the catalog.

The plugin should be run by NRPE (or similar software) and reports ok. warn or
crit back.

Please note that the user executing this command (normally nagios or icinga) 
should either have an entry in /etc/sudoers like the following one:
 nagios ALL=NOPASSWD:/usr/bin/puppet,/usr/lib/nagios/plugins/check_puppet_agent,/bin/kill
or the plugin script itself should be run as root (permissions 4755).

Furthermore this plugin checks some fail counters and warn about them if any of
them is greater than 0.

%prep
%setup -q -T -c %{name}-%{version}
install -m755 %{SOURCE0} .
%patch0 -p0


%build

%install
install -D -m755 check_puppet_agent %{buildroot}/%{nagios_plugindir}/check_puppet_agent
install -D -m644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/sudoers.d/%{name}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%dir %{_sysconfdir}/sudoers.d
%{nagios_plugindir}/check_puppet_agent
%attr(0440,root,root) %config(noreplace) %{_sysconfdir}/sudoers.d/%{name}

%changelog
openSUSE Build Service is sponsored by