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

#
# spec file for package python-influx-nagios-plugin
#
# Copyright (c) 2018 SUSE LINUX 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-influx
Provides:       python-influx-nagios-plugin = %{version}-%{release}
Version:        1.1.0
Release:        0
License:        MIT
Summary:        Nagios plugin for querying stats from InfluxDB
Url:            https://github.com/shaharke/nagios-influx-plugin.git
Group:          Development/Languages/Python
Source:         https://files.pythonhosted.org/packages/01/b3/0b49b58e4a6559932f1aab1783bd5c302be30a4ab1ed54c43da8a8a03140/influx-nagios-plugin-%{version}.tar.gz
Requires:       python-NagAconda
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  nagios-rpm-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
Nagios plugin for querying stats from InfluxDB.

Usage:

check_influx -h HOST_PORT -u USERNAME -p PASSWORD -d DATABASE -q QUERY [-m METRIC] [-w WARNING] [-c CRITICAL]

Options:

-h Colon separated host and port of InfluxDB (e.g. localhost:8086). Port is optional (8086 by default)
-u InfluxDB username
-p InfluxDB password
-d InfluxDB database name
-q Query to execute
-w Warning threshold
-c Critical threshold
-m Metric name. Query will be used by default [OPTIONAL]



%prep
%setup -q -n influx-nagios-plugin-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mkdir -p %{buildroot}%{nagios_plugindir}
mv %{buildroot}/%{_bindir}/check_influx %{buildroot}%{nagios_plugindir}/
rm -rf %{buildroot}/%{_bindir}

%files
%defattr(-,root,root,-)
%if 0%{?suse_version} >= 1500
%license LICENSE
%else
%doc LICENSE
%endif
%doc README.rst
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_influx
%{python_sitelib}/*

%changelog