File ltb-project-nagios-plugins.spec of Package ltb-project-nagios-plugins

#
# spec file for package ltb-project-nagios-plugins
#
# Copyright (c) 2016 SUSE LINUX Products 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:           ltb-project-nagios-plugins
Version:        0.6
Release:        0
License:        GPL-2.0+ 
Summary:        Nagios plugins provided by the LDAP Tool Box project 
Url:            http://ltb-project.org
Group:          System/Monitoring
Source:         %{name}-%{version}.tar.gz
Source1:        gpl-2.0.txt
BuildRequires:  nagios-rpm-macros
BuildRequires:  sed
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
The LDAP Tool Box project provides some additional Nagios plugins to 
monitor LDAP servers. Please note that this package is just containing 
the GPL license for the packages containing the real checks:

* monitoring-plugins-berkeleydb_locks
* monitoring-plugins-ldap_dn
* monitoring-plugins-ldap_monitor
* monitoring-plugins-ldap_query
* monitoring-plugins-ldap_slurpd_status.pl
* monitoring-plugins-syncrepl_status
* monitoring-plugins-ldap_time
* monitoring-plugins-lmdb_usage
* monitoring-eventhandlers-restart_slapd

Please install the packages above depending on your needs.


%package -n monitoring-plugins-berkeleydb_locks
Summary:        Get BerkeleyDB maximum and current locks used
Group:          System/Monitoring
Version:        0.5
Release:        0
Requires:       perl(File::Basename)
Requires:       perl(Getopt::Long)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-berkeleydb_locks
This package provides a check to get BerkeleyDB maximum and current locks used.

%files -n monitoring-plugins-berkeleydb_locks
%defattr(-,root,root)
%{nagios_plugindir}/check_berkeleydb_locks.pl


%package -n monitoring-plugins-ldap_dn
Summary:        Checks if a DN is in an LDAP Server
Group:          System/Monitoring
Version:        3
Release:        0
Requires:       perl(Net::LDAP)
Requires:       perl(Getopt::Std)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-ldap_dn
The package provides a check to see if a DN is in an LDAP Server.

%files -n monitoring-plugins-ldap_dn
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_dn.pl


%package -n monitoring-plugins-ldap_monitor
Summary:        Query an openLDAP Monitor backend
Group:          System/Monitoring
Version:        0.5
Release:        0
Requires:       perl(File::Basename)
Requires:       perl(Net::LDAP)
Requires:       perl(Getopt::Long)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-ldap_monitor
This check queries an openLDAP Monitor backend for different values.

%files -n monitoring-plugins-ldap_monitor
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_monitor.pl


%package -n monitoring-plugins-ldap_query
Summary:        Check LDAP query
Group:          System/Monitoring
Version:        0.4
Release:        0
Requires:       perl(File::Basename)
Requires:       perl(Net::LDAP)
Requires:       perl(Getopt::Long)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-ldap_query
This check queries an openLDAP Server and counts the entries returned.

%files -n monitoring-plugins-ldap_query
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_query.pl


%package -n monitoring-plugins-ldap_slurpd_status.pl
Summary:        Check Master/Slave replication via slurpd
Group:          System/Monitoring
Version:        0.1
Release:        0
Requires:       perl(Getopt::Std)
Requires:       perl(List::Util)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-ldap_slurpd_status.pl
This script parses files generated by slurpd (OpenLDAP replication server)
displays if errors occured and if master and slaves are up2date.

Usage :
You have to set the replica's name and port (as written in slapd.conf)
./check_ldap_slurpd_status -w warning_level -c critical_level [-h hostname] [-p hostport] [-v]
* The level must be given with 3 integers, for exemple 100,5,30
* The first integer are the entries in transition (not picked up by slurpd)
* The second integer are the rejected entries (not accepted by the slave)
* The third integer are the waiting entries (picked up by slurpd but not sent to the slave)
* If only one integer is given, the level will be the max of all entries (in transition + rejected + waiting)
* If no port is declared, 0 will be used
* If no host is declared, localhost will be used
* Option -v displays a lot of message, use for debug only


%files -n monitoring-plugins-ldap_slurpd_status.pl
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_slurpd_status.pl

%package -n monitoring-plugins-syncrepl_status
Summary:        Check OpenLDAP Syncrepl status
Group:          System/Monitoring
Version:        0.4
Release:        0
Requires:       perl(Getopt::Long)
Requires:       perl(File::Basename)
Requires:       perl(POSIX)
Requires:       perl(Net::LDAP)
Requires:       perl(Date::Manip)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-syncrepl_status
To know if a slave and a master are in sync, get the ContextCSN
and compare them.

%files -n monitoring-plugins-syncrepl_status
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_syncrepl_status.pl


%package -n monitoring-plugins-ldap_time
Summary:        Check response time of an openLDAP server
Group:          System/Monitoring
Version:        0.4
Release:        0
Requires:       perl(Getopt::Long)
Requires:       perl(File::Basename)
Requires:       perl(Net::LDAP)
Requires:       perl(Time::HiRes)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-ldap_time
Checks the response time of an LDAP Server doing a search on RootDSE.

It uses threads if parameter -n is filled (threads require Perl 5.8).

%files -n monitoring-plugins-ldap_time
%defattr(-,root,root)
%{nagios_plugindir}/check_ldap_time.pl


%package -n monitoring-plugins-lmdb_usage
Summary:        Monitor pages used in an LMDB base
Group:          System/Monitoring
Version:        0.1
Release:        0
Requires:       perl(Getopt::Long)
Requires:       perl(File::Basename)
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-plugins-lmdb_usage
This plugin checks the used pages in an LMDB base.

%files -n monitoring-plugins-lmdb_usage
%defattr(-,root,root)
%{nagios_plugindir}/check_lmdb_usage.pl


%package -n monitoring-eventhandlers-restart_slapd
Summary:        Restart OpenLDAP Event Handler
Group:          System/Monitoring
Version:        0.1
Release:        0
Requires:       bash
Requires:       util-linux
Requires:       coreutils
Requires:       %{name}
License:        GPL-2.0+

%description -n monitoring-eventhandlers-restart_slapd
This script is an event handler designed to restart an OpenLDAP server
if the LDAP service in in hard state.

%files -n monitoring-eventhandlers-restart_slapd
%defattr(-,root,root)
%dir %{nagios_eventhandlerdir}
%{nagios_eventhandlerdir}/restart_slapd.sh


%prep
%setup -q
install -m644 %{SOURCE1} .

%build
#
%install
mkdir -p %buildroot/%{nagios_plugindir} %buildroot/%{nagios_eventhandlerdir}
for i in *.pl ; do
    sed -e "s|use lib '/usr/local/nagios/libexec';|use lib '%{nagios_plugindir}';|g" $i \
    > %buildroot/%{nagios_plugindir}/$i
done
chmod 755 %buildroot/%{nagios_plugindir}/*
# eventhandler:
install -m755 restart_slapd.sh %buildroot/%{nagios_eventhandlerdir}/

%files
%defattr(-,root,root)
%doc gpl-2.0.txt
# avoid build dependecy of nagios - own the dirs
%dir %{nagios_libdir}
%dir %{nagios_plugindir}


%changelog
openSUSE Build Service is sponsored by