Skip to content

Commit df42d6e

Browse files
authored
Merge pull request #41 from opinkerfi/xroad-check_xroad_token
check_xroad_token plugin created
2 parents ea93f81 + 2233315 commit df42d6e

File tree

4 files changed

+68
-0
lines changed

4 files changed

+68
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
xroad_list_tokens=$(signer-console list-tokens)
3+
4+
if [[ $xroad_list_tokens == "Token: 0 (OK, writable, available, active)" ]]
5+
then
6+
echo "OK - $xroad_list_tokens"
7+
exit 0
8+
elif [[ $xroad_list_tokens != "Token: 0 (OK, writable, available, active)" ]]
9+
then
10+
echo "Critical - $xroad_list_tokens"
11+
exit 2
12+
else
13+
echo "Unknown - $xroad_list_tokens"
14+
exit 3
15+
fi
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
%define debug_package %{nil}
2+
3+
Summary: A Nagios plugin to check status of XROAD soft-token
4+
Name: nagios-okplugin-check_xroad_token
5+
Version: 1.0.1
6+
Release: 1%{?dist}
7+
License: GPLv2+
8+
Group: Applications/System
9+
URL: https://github.com/opinkerfi/nagios-plugins/issues
10+
Source0: http://opensource.ok.is/trac/browser/nagios-plugins/check_xroad_token/releases/nagios-okplugin-check_xroad_token-%{version}.tar.gz
11+
Requires: nagios-nrpe
12+
Requires: xroad-signer
13+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
14+
Packager: Gardar Thorsteinsson <[email protected]>
15+
16+
17+
%description
18+
A Nagios plugin to check status of XROAD soft-token
19+
20+
21+
%prep
22+
%setup -q
23+
#perl -pi -e "s|/usr/lib64|%{_libdir}|g" nrpe.d/check_xroad_token.cfg
24+
25+
%build
26+
27+
28+
%install
29+
rm -rf %{buildroot}
30+
install -D -p -m 0755 check_xroad_token.sh %{buildroot}%{_libdir}/nagios/plugins/check_xroad_token.sh
31+
install -D -p -m 0755 nrpe.d/check_xroad_token.cfg %{buildroot}/etc/nrpe.d/check_xroad_token.cfg
32+
install -D -p -m 0644 sudoers.d/check_xroad_token %{buildroot}/etc/sudoers.d/check_xroad_token
33+
34+
%clean
35+
rm -rf %{buildroot}
36+
37+
%files
38+
%defattr(-,root,root,-)
39+
#%doc README LICENSE
40+
%{_libdir}/nagios/plugins/*
41+
/etc/nrpe.d/check_xroad_token.cfg
42+
/etc/sudoers.d/check_xroad_token
43+
44+
%post
45+
restorecon -v %{_libdir}/nagios/plugins/check_xroad_token.sh /etc/nrpe.d/check_xroad_token.cfg /etc/sudoers.d/check_xroad_token
46+
47+
%changelog
48+
* Fri Sep 11 2020 Gardar Thorsteinsson <[email protected]> 1.0.1-1
49+
- Initial packaging
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# xroad plugin to check for tokens
2+
command[check_xroad_token]=sudo -u xroad /usr/lib64/nagios/plugins/check_xroad_token.sh
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Defaults:nrpe !requiretty
2+
nrpe ALL = (xroad) NOPASSWD: /usr/bin/signer-console list-tokens, /usr/lib64/nagios/plugins/check_xroad_token.sh

0 commit comments

Comments
 (0)