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

#
# spec file for package monitoring-plugins-rabbitmq
#
# 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 http://bugs.opensuse.org/
#

Name:           monitoring-plugins-rabbitmq
Version:        20180813
Release:        0
License:        GPL-3.0+
Summary:        Check rabbitmq for connection and queue counts
Url:            https://github.com/CaptPhunkosis/check_rabbitmq
Group:          System/Monitoring
Source:         check_rabbitmq-%{version}.tar.bz2
Source1:        sudoers-monitoring-plugins-rabbitmq
Patch0:         check_rabbitmq-perfdata.patch
Patch2:         check_rabbitmq-minmax.patch
Patch3:         check_rabbitmq-queuelength-3.7.patch
Patch4:         check_rabbitmq-skip_option.patch
BuildRequires:  nagios-rpm-macros
BuildRequires:  sed
BuildRequires:  sudo
Requires:       sudo
Requires:       python
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build


%description
Needed a simple way to check rabbitmq for connection and queue counts. This was
the quick dirty solution. Posting as it might be useful for others and a nice
beginning for a fuller featured plugin.

We used this with NRPE on the server where rabbitmq was doing it's thing.
Here's an example from our nrpe.cfg

 command[rab_connection_count]=$USER1$/check_rabbitmq -a connection_count -C 100 -W 80
 command[rab_queries_count]=$USER1$/check_rabbitmq -a queues_count -C 100 -W 80


%prep
%setup -n check_rabbitmq-%{version}
%patch0 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
sed -i "s|#!/usr/bin/env python2|#!%{_bindir}/python2|g" check_rabbitmq

%build
#
%install
mkdir -p %{buildroot}/%{nagios_plugindir}
install -Dm755 check_rabbitmq %{buildroot}/%{nagios_plugindir}/
install -Dm644 %{SOURCE1} %{buildroot}/%{_sysconfdir}/sudoers.d/%{name}

%files
%defattr(-,root,root)
%doc README*
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_rabbitmq
%config(noreplace) %{_sysconfdir}/sudoers.d/%{name}

%changelog