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

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


Name:           monitoring-plugins-cpu_stats
Version:        0.0.1.g62f56aa
Release:        0
Summary:        CPU Utilization Statistics 
License:        GPL-3.0-or-later
Group:          System/Monitoring
Url:            https://github.com/Reamer/check_cpu_stats
Source:         check_cpu_stats-%{version}.tar.xz
Source1:        monitoring-plugins-cpu_stats-rpmlintrc
BuildRequires:  nagios-rpm-macros
Requires:       sysstat
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Monitoring plugin to check CPU utilization statistics. This script has
been designed and written on Unix platforms (Linux, Aix, Solaris).

The script is used to query 6 of the key cpu statistics: 

* user
* system
* iowait
* idle
* nice and 
* steal (if possible) 

You can also set warning and critical values (in percent) for 

* user
* system and
* iowat

Usage examples: 

* ./check_cpu_stats.sh
* ./check_cpu_stats.sh -w 70,40,30 -c 90,60,40
* ./check_cpu_stats.sh -w 70,40,30 -c 90,60,40 -i 3 -n 5


%prep
%autosetup -n check_cpu_stats-%{version}

%build
#
%install
install -D -m755 check_cpu_stats.sh %buildroot/%{nagios_plugindir}/check_cpu_stats
mkdir -p %{buildroot}%{nrpe_sysconfdir}
cat > %{buildroot}%{nrpe_sysconfdir}/check_cpu_stats.cfg << EOL
command[check_cpu_stats]=%{nagios_plugindir}/check_cpu_stats
#command[check_cpu_stats]=%{nagios_plugindir}/check_cpu_stats -w 70,40,30 -c 90,60,40
#command[check_cpu_stats]=%{nagios_plugindir}/check_cpu_stats -w 70,40,30 -c 90,60,40 -i 3 -n 5
EOL

%files
%defattr(-,root,root)
%doc README.md
%license LICENSE
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%dir %{nrpe_sysconfdir}
%{nagios_plugindir}/check_cpu_stats
%config(noreplace) %{nrpe_sysconfdir}/check_cpu_stats.cfg

%changelog
openSUSE Build Service is sponsored by