File prometheus-nagios_plugins.spec of Package prometheus-nagios_plugins
#
# spec file for package prometheus-nagios_plugins
#
# Copyright (c) 2019 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: prometheus-nagios_plugins
Version: 0.3.0
Release: 0
Summary: Nagios plugins for alerting on Prometheus query results
License: Apache-2.0
Group: System/Monitoring
Url: https://github.com/prometheus/nagios_plugins
Source: nagios_plugins-%{version}.tar.gz
BuildRequires: nagios-rpm-macros
Requires: curl
Requires: jq
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Nagios plugin (in fact only one) for alerting on prometheus query results.
PROMETHEUS_SERVER='http://demo.robustperception.io:9090'
QUERY_SCALAR_UP='scalar(up{instance="demo.robustperception.io:9100"})'
QUERY_VECTOR_UP='up{instance="demo.robustperception.io:9100"}'
bash check_prometheus_metric.sh -H $PROMETHEUS_SERVER -q $QUERY_SCALAR_UP -w 1 -c 1 -n $QUERY_SCALAR_UP -m lt
OK - scalar(up{instance="demo.robustperception.io:9100"}) is 1
%prep
%setup -q -n nagios_plugins-%{version}
%build
#
%install
install -Dm755 check_prometheus_metric.sh %{buildroot}%{nagios_plugindir}/check_prometheus_metric.sh
%files
%defattr(-,root,root)
%doc *.md NOTICE
%if 0%{?suse_version} > 1500
%license LICENSE
%else
%doc LICENSE
%endif
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_prometheus_metric.sh
%changelog