Add RPM spec file

This commit is contained in:
Ott, Jörn WI (Fa. Allgeier Experts / Goetzfried) 2019-10-11 13:47:01 +02:00
parent bcb0719d5c
commit 7008ff5805
2 changed files with 57 additions and 0 deletions

View File

@ -10,9 +10,26 @@ https://github.com/systemd/systemd/issues/83
## How to install?
### Debian
git clone https://github.com/pengutronix/monitoring-check-systemd-service.git
apt-get install python3-nagiosplugin python3-gi
### RedHat / CentOS
python 3.6 and the corresponding gobject implementation are provided by the
EPEL package. Follow [the instructions](https://fedoraproject.org/wiki/EPEL)
to install EPEL on your system. The python3-nagiosplugin can be found at
[https://github.com/joernott/python-nagiosplugin-rpm](https://github.com/joernott/python-nagiosplugin-rpm)
and the RPM for this plugin can be built using the instructions below.
yum -y install rh-python36 python36-gobject python36-gobject-base python3-nagiosplugin nagios-plugin-systemd-service
## How to build the RPM
[Set up your RPMBUILD environment](https://wiki.centos.org/HowTos/SetupRpmBuildEnvironment)
and put the SPEC file into the SPECS folder. Then get the source and run rpmbuild:
curl -o SPECS https://https://raw.githubusercontent.com/joernott/monitoring-check-systemd-service/master/contrib/check-systemd-service.spec
spectool -g -R SPECS/check-systemd-service.spec
rpmbuild -ba SPECS/check-systemd-service.spec
## How to use?

View File

@ -0,0 +1,40 @@
%define version 1.1.0
%define plugindir /usr/lib64/nagios/plugins/
Name: check-systemd-service
Version: %{version}
Release: 1
Epoch: 1
Summary: Nagios/Icinga check for systemd services
AutoReqProv: no
BuildRoot: %buildroot
BuildArch: noarch
Source0: https://github.com/joernott/monitoring-check-systemd-service/archive/v%{version}.tar.gz#/monitoring-check-systemd-service-%{version}.tar.gz
License: BSD
URL: https://github.com/joernott/monitoring-check-systemd-service
Requires: python36-gobject
Requires: python3-nagiosplugin
%description
This script is intended for icinga/nagios/icinga2 to check the state of a
systemd service. We check the ServiceState and the Substate.
This tools uses dbus to gather needed informations, as systemd-developer
Lennart Poettering says it is the right way to do and cli output is not stable
and should not be parsed.
%prep
%autosetup -n monitoring-check-systemd-service-%{version}
%build
%install
mkdir -p $RPM_BUILD_ROOT%{plugindir}
mv %{_builddir}/monitoring-check-systemd-service-%{version}/check-systemd-service $RPM_BUILD_ROOT%{plugindir}/
rm -rf $RPM_BUILD_ROOT/monitoring-check-systemd-service-%{version}
%clean
rm -rf $RPM_BUILD_ROOT/*
%files
%attr(755,root,root) %{plugindir}/check-systemd-service