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

#
# spec file for package monitoring-plugins-rsyslog
#
# 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-rsyslog
Version:        20190317g795602b
Release:        0
Summary:        Check for rsyslog disk queue buffers
License:        GPL-2.0-or-later
Group:          System/Monitoring
Url:            https://github.com/jonschipp/nagios-plugins
Source:         nagios-plugins-%{version}.tar.gz
BuildRequires:  nagios-rpm-macros
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This plugin either checks for presence of disk queue files or for the 
number of logs currently in the queue.

%package -n monitoring-plugins-connections
Summary:        Check the number of connections/sockets in a given state
License:        GPL-2.0-or-later
Group:          System/Monitoring
Requires:       iproute2

%description -n monitoring-plugins-connections
Check the number of connections/sockets in a given state.
Uses iproute2's ss tool to retrieve connections.

%prep
%setup -q -n  nagios-plugins-%{version}

%build
#
%install
# install check binary
install -Dm0755 check_rsyslog.sh %{buildroot}%{nagios_plugindir}/check_rsyslog
sed -i "s|/usr/bin/env bash|/bin/bash|g" %{buildroot}%{nagios_plugindir}/check_rsyslog
ln -s %{nagios_plugindir}/check_rsyslog %{buildroot}%{nagios_plugindir}/check_rsyslog.sh
install -Dm0755 check_connections.sh %{buildroot}%{nagios_plugindir}/check_connections
ln -s %{nagios_plugindir}/check_connections %{buildroot}%{nagios_plugindir}/check_connections.sh
# NRPE configuration check_rsyslog
mkdir -p %{buildroot}%{nrpe_sysconfdir}
cat > %{buildroot}%{nrpe_sysconfdir}/check_rsyslog.cfg << EOF
# Check presence of disk queue (buffer)
command[check_rsyslog_buffer]=%{nagios_plugindir}/check_rsyslog -T buffer -q rsyslog -d /var/spool/rsyslog
# Check number of logs currently in the queue
command[check_rsyslog_queue]=%{nagios_plugindir}/check_rsyslog -T queued -f /var/log/impstats.log -c 100 -w 80
EOF
# NRPE configuration check_connections
cat > %{buildroot}%{nrpe_sysconfdir}/check_connections.cfg << EOF
# Check total number of TCP connections
command[check_connections_tcp]=%{nagios_plugindir}/check_connections -p tcp
command[check_connections_tcp_established]=/usr/lib/nagios/plugins/check_connections -p tcp -s established -w 5000 -c 10000
# Check total number of UDP connections
command[check_connections_udp]=%{nagios_plugindir}/check_connections -p udp
# Check total number of inet connections
command[check_connections_inet]=%{nagios_plugindir}/check_connections -p inet
# Check total number of inet6 connections
command[check_connections_inet6]=%{nagios_plugindir}/check_connections -p inet6
EOF

%files
%defattr(-,root,root)
%license LICENSE
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_rsyslog*
%dir %{nrpe_sysconfdir}
%config(noreplace) %{nrpe_sysconfdir}/check_rsyslog.cfg

%files -n monitoring-plugins-connections
%defattr(-,root,root)
%license LICENSE
%dir %{nagios_libdir}
%dir %{nagios_plugindir}
%{nagios_plugindir}/check_connections*
%dir %{nrpe_sysconfdir}
%config(noreplace) %{nrpe_sysconfdir}/check_connections.cfg

%changelog
openSUSE Build Service is sponsored by