File check_mk-apcupsd.spec of Package check_mk-apcupsd
#
# spec file for package check_mk-apcupsd
#
# Copyright (c) 2014 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: check_mk-apcupsd
Version: 1.0
Release: 0
Summary: Check_mk plugin monitoring UPS managed by apcupsd
License: GPL-2.0
Group: System/Monitoring
Url: https://github.com/michalskalski/cmk-apcupsd
Source0: cmk-apcupsd-%{version}.mkp
BuildRequires: check_mk >= 1.2.0p1
BuildRequires: check_mk-agent >= 1.2.0p1
BuildRequires: nagios-rpm-macros
Requires: check_mk >= 1.2.0p1
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
This is package for Check_MK which allow to checks status of ups managed by
apcupsd demon. Package contain plugin for check_mk linux agent, templates for
pnp4nagios and perfometer plugins. You can monitor:
* UPS status
* battery charge
* load capacity
* internal temperature
* input, output and battery voltage level
* remaining runtime on battery
Available checks are dependet on which model of ups you have. Package was
tested on APC Smart-UPS 2200 RM. You can adapt the check_parameters in your
main.mk file. Example:
check_parameters += [
# Warn if battery level is below 11V, Critical below 10V
( (11, 10, 0 ,60), ALL_HOSTS, [ "UPS Back-UPS RS 550G battery voltage" ] ),
# Warn if time remaining is less than 10, critical if less than 5 minutes
( (10, 5, 0 ,60), ALL_HOSTS, [ "UPS Back-UPS RS 550G time remaining" ] ),
]
%package -n check_mk-agent-apcupsd
Summary: Check_mk plugin for monitoring UPS managed by apcupsd
Group: System/Monitoring
Requires: check_mk-agent
%description -n check_mk-agent-apcupsd
This package should be installed on the server running the apcupsd and
the check_mk-agent.
It allows to check the status of ups managed by apcupsd demon.
%prep
%setup -q -T -c %{name}-%{version} -a0
%build
#
%install
export SOURCEDIR="$PWD"
if [ -f "${SOURCEDIR}/agents.tar" ]; then
mkdir -p '%{buildroot}%{livestatus_agentsdir}'
cd '%{buildroot}%{livestatus_agentsdir}'
tar -xf "${SOURCEDIR}/agents.tar"
cd -
fi
if [ -f "${SOURCEDIR}/checkman.tar" ]; then
mkdir -p '%{buildroot}%{_defaultdocdir}/check_mk/checks'
cd '%{buildroot}%{_defaultdocdir}/check_mk/checks'
tar -xf "${SOURCEDIR}/checkman.tar"
cd -
fi
if [ -f "${SOURCEDIR}/checks.tar" ]; then
mkdir -p '%{buildroot}%{_datadir}/check_mk/checks'
cd '%{buildroot}%{_datadir}/check_mk/checks'
tar -xf "${SOURCEDIR}/checks.tar"
cd -
fi
if [ -f "${SOURCEDIR}/pnp-templates.tar" ]; then
mkdir -p '%{buildroot}%{pnp4nagios_templatedir}'
cd '%{buildroot}%{pnp4nagios_templatedir}'
tar -xf "${SOURCEDIR}/pnp-templates.tar"
cd -
fi
if [ -f "${SOURCEDIR}/web.tar" ]; then
mkdir -p '%{buildroot}%{livestatus_webdir}'
cd '%{buildroot}%{livestatus_webdir}'
tar -xf "${SOURCEDIR}/web.tar"
cd -
fi
PACKAGENAME=$(grep title ${SOURCEDIR}/info | cut -d "'" -f 4)
install -Dm644 ${SOURCEDIR}/info %{buildroot}%{livestatus_vardir}/packages/$PACKAGENAME
sed -i "s|^apcaccess|/usr/sbin/apcaccess|g" %{buildroot}%{livestatus_agentsdir}/plugins/apcupsd
%files
%defattr(-,root,root,-)
%doc %{_defaultdocdir}/check_mk/checks
%dir %{pnp4nagios_templatedir}
%dir %{livestatus_webdir}/
%dir %{livestatus_webdir}/plugins
%attr(755,root,root) %{_datadir}/check_mk/checks/*
%{pnp4nagios_templatedir}/*
%{livestatus_webdir}/*
%{livestatus_vardir}/packages/*
%files -n check_mk-agent-apcupsd
%defattr(-,root,root,-)
%attr(755,root,root) %{livestatus_agentsdir}/plugins/apcupsd
%changelog