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

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

Name:           monitoring-plugins-json
Version:        0.0git.1565463848.1220302
Release:        0
Summary:        Nagios plugin to check JSON attributes via http(s)
License:        GPL-2.0-or-later
Group:          System/Monitoring
Source:         check_json-%{version}.tar.xz
Source1:        monitoring-plugins-json-icinga2_check_command.cfg
Source2:        monitoring-plugins-json-icinga2_check_definition.cfg
BuildRequires:  nagios-rpm-macros
Requires:       perl(HTTP::Request::Common)
Requires:       perl(LWP::UserAgent)
Requires:       perl(JSON)
Requires:       perl(Monitoring::Plugin)
Requires:       perl(Data::Dumper)
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

This Plugin is a fork of the existing JSON Plugin from with the enhancements of using the
Monitoring::Plugin Perl Module, allowing to use thresholds and performance data
collection from various json attributes, and supporting X-Auth and Bearer Token
authorization methods.

Performance data is also enhanced to extract performance data compliant to
Nagios and Graphite standards. One attribute is selected for thresholds check,
multiple others can be added for extracting performance data. This plugin is
aimed at simplifying Nagios, Icinga & Icinga2 polling of JSON status APIs.

%setup -q -n check_json-%{version}

install -D -m755  %buildroot/%{nagios_plugindir}/check_json
sed -i "s|/usr/bin/env perl|%{_bindir}/perl|g" %buildroot/%{nagios_plugindir}/check_json
install -D -m644 %{SOURCE1}     %{buildroot}%{_defaultdocdir}/%{name}/icinga2_check_json_command.cfg
install -m644 %{SOURCE2}     %{buildroot}%{_defaultdocdir}/%{name}/icinga2_check_json_object_definition.cfg
install -m644      %{buildroot}%{_defaultdocdir}/%{name}/

%dir %{_defaultdocdir}/%{name}/
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%doc %{_defaultdocdir}/%{name}/*

openSUSE Build Service is sponsored by