check_systemd 2.0.9__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {check_systemd-2.0.9 → check_systemd-2.1.0}/PKG-INFO +26 -11
- {check_systemd-2.0.9 → check_systemd-2.1.0}/README.md +25 -10
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/PKG-INFO +26 -11
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.py +27 -11
- {check_systemd-2.0.9 → check_systemd-2.1.0}/LICENSE +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/MANIFEST.in +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/SOURCES.txt +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/dependency_links.txt +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/entry_points.txt +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/requires.txt +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/check_systemd.egg-info/top_level.txt +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/setup.cfg +0 -0
- {check_systemd-2.0.9 → check_systemd-2.1.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: check_systemd
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Nagios / Icinga monitoring plugin to check systemd for failed units.
|
|
5
5
|
Home-page: https://github.com/Josef-Friedrich/check_systemd
|
|
6
6
|
Author: Josef Friedrich
|
|
@@ -11,12 +11,16 @@ Description: [](https
|
|
|
11
11
|
|
|
12
12
|
# check_systemd
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
`check_systemd` is a
|
|
15
|
+
[Nagios](https://www.nagios.org) / [Icinga](https://icinga.com)
|
|
16
|
+
monitoring plugin to check [systemd](https://systemd.io) for failed
|
|
17
|
+
units.
|
|
15
18
|
|
|
16
|
-
This Python script will report a degraded system to
|
|
17
|
-
It requires only the
|
|
19
|
+
This Python script will report a degraded system to your monitoring solution.
|
|
20
|
+
It requires only the
|
|
21
|
+
[nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable) library.
|
|
18
22
|
|
|
19
|
-
You can also test a single service with
|
|
23
|
+
You can also test a single service with the `-u, --unit` parameter.
|
|
20
24
|
|
|
21
25
|
Released under GNU GPLv2 License.
|
|
22
26
|
|
|
@@ -29,11 +33,10 @@ Description: [](https
|
|
|
29
33
|
## Command line interface
|
|
30
34
|
|
|
31
35
|
```
|
|
32
|
-
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V]
|
|
33
|
-
[-w SECONDS]
|
|
36
|
+
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V] [-w SECONDS]
|
|
34
37
|
|
|
35
38
|
Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
|
|
36
|
-
Copyright (c) 2019 Josef Friedrich <josef@friedrich.rocks>
|
|
39
|
+
Copyright (c) 2019-20 Josef Friedrich <josef@friedrich.rocks>
|
|
37
40
|
|
|
38
41
|
Nagios / Icinga monitoring plugin to check systemd for failed units.
|
|
39
42
|
|
|
@@ -42,9 +45,9 @@ Description: [](https
|
|
|
42
45
|
-c SECONDS, --critical SECONDS
|
|
43
46
|
Startup time in seconds to result in critical status.
|
|
44
47
|
-e UNIT, --exclude UNIT
|
|
45
|
-
Exclude a systemd unit from the checks. This option
|
|
46
|
-
can be
|
|
47
|
-
|
|
48
|
+
Exclude a systemd unit from the checks. This option can be applied multiple times, for example: -e mnt-data.mount -e
|
|
49
|
+
task.service. Regular expressions can be used to exclude multiple units at once, for example: -e 'user@\d+\.service'. For
|
|
50
|
+
more informations see the Python documentation about regular expressions (https://docs.python.org/3/library/re.html).
|
|
48
51
|
-u UNIT, --unit UNIT Name of the systemd unit that is being tested.
|
|
49
52
|
-v, --verbose Increase output verbosity (use up to 3 times).
|
|
50
53
|
-V, --version show program's version number and exit
|
|
@@ -70,10 +73,22 @@ Description: [](https
|
|
|
70
73
|
## Testing
|
|
71
74
|
|
|
72
75
|
```
|
|
76
|
+
pyenv install 3.7.6
|
|
77
|
+
pyenv install 3.8.1
|
|
78
|
+
pyenv local 3.7.6 3.8.1
|
|
73
79
|
pip3 install tox
|
|
74
80
|
tox
|
|
75
81
|
```
|
|
76
82
|
|
|
83
|
+
## Deploying
|
|
84
|
+
|
|
85
|
+
Edit version number in check_systemd.py (without `v`)
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
git tag v2.0.11
|
|
89
|
+
git push --tags
|
|
90
|
+
```
|
|
91
|
+
|
|
77
92
|
Keywords: nagios,systemd
|
|
78
93
|
Platform: UNKNOWN
|
|
79
94
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
# check_systemd
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`check_systemd` is a
|
|
7
|
+
[Nagios](https://www.nagios.org) / [Icinga](https://icinga.com)
|
|
8
|
+
monitoring plugin to check [systemd](https://systemd.io) for failed
|
|
9
|
+
units.
|
|
7
10
|
|
|
8
|
-
This Python script will report a degraded system to
|
|
9
|
-
It requires only the
|
|
11
|
+
This Python script will report a degraded system to your monitoring solution.
|
|
12
|
+
It requires only the
|
|
13
|
+
[nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable) library.
|
|
10
14
|
|
|
11
|
-
You can also test a single service with
|
|
15
|
+
You can also test a single service with the `-u, --unit` parameter.
|
|
12
16
|
|
|
13
17
|
Released under GNU GPLv2 License.
|
|
14
18
|
|
|
@@ -21,11 +25,10 @@ pip3 install check_systemd
|
|
|
21
25
|
## Command line interface
|
|
22
26
|
|
|
23
27
|
```
|
|
24
|
-
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V]
|
|
25
|
-
[-w SECONDS]
|
|
28
|
+
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V] [-w SECONDS]
|
|
26
29
|
|
|
27
30
|
Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
|
|
28
|
-
Copyright (c) 2019 Josef Friedrich <josef@friedrich.rocks>
|
|
31
|
+
Copyright (c) 2019-20 Josef Friedrich <josef@friedrich.rocks>
|
|
29
32
|
|
|
30
33
|
Nagios / Icinga monitoring plugin to check systemd for failed units.
|
|
31
34
|
|
|
@@ -34,9 +37,9 @@ optional arguments:
|
|
|
34
37
|
-c SECONDS, --critical SECONDS
|
|
35
38
|
Startup time in seconds to result in critical status.
|
|
36
39
|
-e UNIT, --exclude UNIT
|
|
37
|
-
Exclude a systemd unit from the checks. This option
|
|
38
|
-
can be
|
|
39
|
-
|
|
40
|
+
Exclude a systemd unit from the checks. This option can be applied multiple times, for example: -e mnt-data.mount -e
|
|
41
|
+
task.service. Regular expressions can be used to exclude multiple units at once, for example: -e 'user@\d+\.service'. For
|
|
42
|
+
more informations see the Python documentation about regular expressions (https://docs.python.org/3/library/re.html).
|
|
40
43
|
-u UNIT, --unit UNIT Name of the systemd unit that is being tested.
|
|
41
44
|
-v, --verbose Increase output verbosity (use up to 3 times).
|
|
42
45
|
-V, --version show program's version number and exit
|
|
@@ -62,6 +65,18 @@ Performance data:
|
|
|
62
65
|
## Testing
|
|
63
66
|
|
|
64
67
|
```
|
|
68
|
+
pyenv install 3.7.6
|
|
69
|
+
pyenv install 3.8.1
|
|
70
|
+
pyenv local 3.7.6 3.8.1
|
|
65
71
|
pip3 install tox
|
|
66
72
|
tox
|
|
67
73
|
```
|
|
74
|
+
|
|
75
|
+
## Deploying
|
|
76
|
+
|
|
77
|
+
Edit version number in check_systemd.py (without `v`)
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
git tag v2.0.11
|
|
81
|
+
git push --tags
|
|
82
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: check-systemd
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Nagios / Icinga monitoring plugin to check systemd for failed units.
|
|
5
5
|
Home-page: https://github.com/Josef-Friedrich/check_systemd
|
|
6
6
|
Author: Josef Friedrich
|
|
@@ -11,12 +11,16 @@ Description: [](https
|
|
|
11
11
|
|
|
12
12
|
# check_systemd
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
`check_systemd` is a
|
|
15
|
+
[Nagios](https://www.nagios.org) / [Icinga](https://icinga.com)
|
|
16
|
+
monitoring plugin to check [systemd](https://systemd.io) for failed
|
|
17
|
+
units.
|
|
15
18
|
|
|
16
|
-
This Python script will report a degraded system to
|
|
17
|
-
It requires only the
|
|
19
|
+
This Python script will report a degraded system to your monitoring solution.
|
|
20
|
+
It requires only the
|
|
21
|
+
[nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable) library.
|
|
18
22
|
|
|
19
|
-
You can also test a single service with
|
|
23
|
+
You can also test a single service with the `-u, --unit` parameter.
|
|
20
24
|
|
|
21
25
|
Released under GNU GPLv2 License.
|
|
22
26
|
|
|
@@ -29,11 +33,10 @@ Description: [](https
|
|
|
29
33
|
## Command line interface
|
|
30
34
|
|
|
31
35
|
```
|
|
32
|
-
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V]
|
|
33
|
-
[-w SECONDS]
|
|
36
|
+
usage: check_systemd [-h] [-c SECONDS] [-e UNIT | -u UNIT] [-v] [-V] [-w SECONDS]
|
|
34
37
|
|
|
35
38
|
Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
|
|
36
|
-
Copyright (c) 2019 Josef Friedrich <josef@friedrich.rocks>
|
|
39
|
+
Copyright (c) 2019-20 Josef Friedrich <josef@friedrich.rocks>
|
|
37
40
|
|
|
38
41
|
Nagios / Icinga monitoring plugin to check systemd for failed units.
|
|
39
42
|
|
|
@@ -42,9 +45,9 @@ Description: [](https
|
|
|
42
45
|
-c SECONDS, --critical SECONDS
|
|
43
46
|
Startup time in seconds to result in critical status.
|
|
44
47
|
-e UNIT, --exclude UNIT
|
|
45
|
-
Exclude a systemd unit from the checks. This option
|
|
46
|
-
can be
|
|
47
|
-
|
|
48
|
+
Exclude a systemd unit from the checks. This option can be applied multiple times, for example: -e mnt-data.mount -e
|
|
49
|
+
task.service. Regular expressions can be used to exclude multiple units at once, for example: -e 'user@\d+\.service'. For
|
|
50
|
+
more informations see the Python documentation about regular expressions (https://docs.python.org/3/library/re.html).
|
|
48
51
|
-u UNIT, --unit UNIT Name of the systemd unit that is being tested.
|
|
49
52
|
-v, --verbose Increase output verbosity (use up to 3 times).
|
|
50
53
|
-V, --version show program's version number and exit
|
|
@@ -70,10 +73,22 @@ Description: [](https
|
|
|
70
73
|
## Testing
|
|
71
74
|
|
|
72
75
|
```
|
|
76
|
+
pyenv install 3.7.6
|
|
77
|
+
pyenv install 3.8.1
|
|
78
|
+
pyenv local 3.7.6 3.8.1
|
|
73
79
|
pip3 install tox
|
|
74
80
|
tox
|
|
75
81
|
```
|
|
76
82
|
|
|
83
|
+
## Deploying
|
|
84
|
+
|
|
85
|
+
Edit version number in check_systemd.py (without `v`)
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
git tag v2.0.11
|
|
89
|
+
git push --tags
|
|
90
|
+
```
|
|
91
|
+
|
|
77
92
|
Keywords: nagios,systemd
|
|
78
93
|
Platform: UNKNOWN
|
|
79
94
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
You can redistribute it and/or modify it under the terms of the GNU General
|
|
5
5
|
Public License as published by the Free Software Foundation, either version 2
|
|
6
6
|
of the License.
|
|
7
|
-
Copyright
|
|
8
|
-
Copyright 2019 Josef Friedrich
|
|
7
|
+
Copyright see argparse help text.
|
|
9
8
|
"""
|
|
10
9
|
import io
|
|
11
10
|
import subprocess
|
|
@@ -15,7 +14,7 @@ import re
|
|
|
15
14
|
import nagiosplugin
|
|
16
15
|
from nagiosplugin import Metric
|
|
17
16
|
|
|
18
|
-
__version__ = '2.0
|
|
17
|
+
__version__ = '2.1.0'
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
class SystemdctlListUnitsResource(nagiosplugin.Resource):
|
|
@@ -27,6 +26,12 @@ class SystemdctlListUnitsResource(nagiosplugin.Resource):
|
|
|
27
26
|
def __init__(self, excludes=[]):
|
|
28
27
|
self.excludes = excludes
|
|
29
28
|
|
|
29
|
+
def re_match(self, unit):
|
|
30
|
+
for exclude in self.excludes:
|
|
31
|
+
if re.match(exclude, unit):
|
|
32
|
+
return(True)
|
|
33
|
+
return(False)
|
|
34
|
+
|
|
30
35
|
def probe(self):
|
|
31
36
|
"""Query system state and return metrics.
|
|
32
37
|
|
|
@@ -66,13 +71,20 @@ class SystemdctlListUnitsResource(nagiosplugin.Resource):
|
|
|
66
71
|
unit = split_line[0]
|
|
67
72
|
# failed
|
|
68
73
|
active = split_line[2]
|
|
69
|
-
# Only count not
|
|
70
|
-
if
|
|
74
|
+
# Only count not excluded units.
|
|
75
|
+
if not self.re_match(unit):
|
|
76
|
+
# Quick fix:
|
|
77
|
+
# Issue on Arch: “not-found” in column ACTIVE
|
|
78
|
+
# maybe cli table output changed on newer versions of
|
|
79
|
+
# systemd?
|
|
80
|
+
# maybe .split() is not working correctly?
|
|
81
|
+
if active not in units:
|
|
82
|
+
units[active] = []
|
|
71
83
|
units[active].append(unit)
|
|
72
84
|
count_units += 1
|
|
73
85
|
|
|
74
86
|
for unit in units['failed']:
|
|
75
|
-
if
|
|
87
|
+
if not self.re_match(unit):
|
|
76
88
|
yield Metric(name=unit, value='failed', context='unit')
|
|
77
89
|
|
|
78
90
|
for active, unit_names in units.items():
|
|
@@ -164,7 +176,7 @@ class SystemctlIsActiveResource(nagiosplugin.Resource):
|
|
|
164
176
|
|
|
165
177
|
def __init__(self, *args, **kwargs):
|
|
166
178
|
self.unit = kwargs.pop('unit')
|
|
167
|
-
super(
|
|
179
|
+
super().__init__(*args, **kwargs)
|
|
168
180
|
|
|
169
181
|
def probe(self):
|
|
170
182
|
"""Query system state and return metrics.
|
|
@@ -276,7 +288,7 @@ def get_argparser():
|
|
|
276
288
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
277
289
|
description= # noqa: E251
|
|
278
290
|
'Copyright (c) 2014-18 Andrea Briganti a.k.a \'Kbyte\' <kbytesys@gmail.com>\n' # noqa: E501
|
|
279
|
-
'Copyright (c) 2019 Josef Friedrich <josef@friedrich.rocks>\n'
|
|
291
|
+
'Copyright (c) 2019-20 Josef Friedrich <josef@friedrich.rocks>\n'
|
|
280
292
|
'\n'
|
|
281
293
|
'Nagios / Icinga monitoring plugin to check systemd for failed units.\n', # noqa: E501
|
|
282
294
|
epilog= # noqa: E251
|
|
@@ -304,8 +316,13 @@ def get_argparser():
|
|
|
304
316
|
action='append',
|
|
305
317
|
default=[],
|
|
306
318
|
help='Exclude a systemd unit from the checks. This option can be '
|
|
307
|
-
'applied multiple times
|
|
308
|
-
'task.service.'
|
|
319
|
+
'applied multiple times, for example: -e mnt-data.mount -e '
|
|
320
|
+
'task.service. Regular expressions can be used to exclude '
|
|
321
|
+
'multiple units at once, for example: '
|
|
322
|
+
'-e \'user@\\d+\\.service\'. '
|
|
323
|
+
'For more informations see the Python documentation about '
|
|
324
|
+
'regular expressions '
|
|
325
|
+
'(https://docs.python.org/3/library/re.html).',
|
|
309
326
|
)
|
|
310
327
|
|
|
311
328
|
exclusive_group.add_argument(
|
|
@@ -338,7 +355,6 @@ def get_argparser():
|
|
|
338
355
|
return parser
|
|
339
356
|
|
|
340
357
|
|
|
341
|
-
@nagiosplugin.guarded
|
|
342
358
|
def main():
|
|
343
359
|
args = get_argparser().parse_args()
|
|
344
360
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|