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

#
# spec file for package monitoring-plugins-wmi_plus
#
# Copyright (c) 2017-2019, Martin Hauke <mardnh@gmx.de>
# Copyright (c) 2016, SUSE Linux GmbH, Nuremberg
#
# 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/
#


%define         realname check_wmi_plus
Name:           monitoring-plugins-wmi_plus
Version:        1.65
Release:        0
Summary:        A client-less Icinga/Nagios plugin for checking Windows systems
License:        GPL-2.0-or-later
Group:          System/Monitoring
URL:            https://www.edcint.co.nz/checkwmiplus/
Source:         %{realname}.v%{version}.tar.gz
BuildRequires:  monitoring-plugins-common
BuildRequires:  nagios-rpm-macros
BuildRequires:  perl(Config::IniFiles)
BuildRequires:  perl(DateTime)
BuildRequires:  perl(Number::Format)
Requires:       perl(Config::IniFiles)
Requires:       perl(DateTime)
Requires:       perl(Number::Format)
Requires:       wmic
BuildArch:      noarch

%description
Check WMI Plus is a client-less Nagios plugin for checking Windows systems.
No more need to install any software on any of your Windows machines.
Monitor Microsoft Windows systems directly from your Nagios server.
Check WMI Plus uses the Windows Management Interface (WMI) to check for common
services (cpu, disk, sevices, eventlog...) on Windows machines. It requires
the open source wmi client for Linux (wmic).

%prep
%setup -q -c -n %{realname}-%{version}
# set proper basedir
sed -i 's|/opt/nagios/bin/plugins|/usr/lib/nagios/plugins|g' check_wmi_plus.pl
# fix spurious exec permissions
chmod -x check_wmi_plus.README.txt
find etc -type f -exec chmod -x {} \;
# fix filename for the check_wmi_plus.pl help-file
sed -i 's|$base_dir/check_wmi_plus_help.pl|$base_dir/check_wmi_plus_help|g' check_wmi_plus.pl

%build

%install
install -d %{buildroot}/%{nagios_plugindir}
install -d %{buildroot}/%{_sysconfdir}/check_wmi_plus/
install -D -m0755 check_wmi_plus.pl %{buildroot}/%{nagios_plugindir}/check_wmi_plus
install -D -m0644 check_wmi_plus_help.pl %{buildroot}/%{nagios_plugindir}/check_wmi_plus_help
mv etc/check_wmi_plus/* %{buildroot}/%{_sysconfdir}/check_wmi_plus/
# PRO-only - where the check_wmi_plus will store some persistent data
rm -r %{buildroot}/%{_sysconfdir}/check_wmi_plus/check_wmi_plus.data/

%files
%doc check_wmi_plus.README.txt
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_wmi_plus
%{nagios_plugindir}/check_wmi_plus_help
%dir %{_sysconfdir}/check_wmi_plus
%config %{_sysconfdir}/check_wmi_plus/check_wmi_plus.d/*.ini
%{_sysconfdir}/check_wmi_plus/check_wmi_plus.conf.sample
%dir %{_sysconfdir}/check_wmi_plus/check_wmi_plus.d
%{_sysconfdir}/check_wmi_plus/check_wmi_plus.d/CommandExamples.chtml
%{_sysconfdir}/check_wmi_plus/check_wmi_plus.d/README.txt
%{_sysconfdir}/check_wmi_plus/check_wmi_plus.d/WarnCritExamples.chtml

%changelog
openSUSE Build Service is sponsored by