check_systemd 2.3.0__tar.gz → 2.3.1__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.
@@ -1,3 +1,2 @@
1
1
  include LICENSE
2
2
  prune test
3
- prune systemd_source_code
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: check_systemd
3
- Version: 2.3.0
3
+ Version: 2.3.1
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,16 +11,14 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
11
11
 
12
12
  # check_systemd
13
13
 
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.
18
-
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.
22
-
23
- You can also test a single service with the `-u, --unit` parameter.
14
+ `check_systemd` is a [Nagios](https://www.nagios.org) /
15
+ [Icinga](https://icinga.com) monitoring plugin to check
16
+ [systemd](https://systemd.io). This Python script will report a degraded
17
+ system to your monitoring solution. It can also be used to monitor
18
+ individual systemd services (with the `-u, --unit` parameter) and timers
19
+ units (with the `-t, --dead-timers` parameter). The only dependency the
20
+ plugin needs is the Python library
21
+ [nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable).
24
22
 
25
23
  ## Installation
26
24
 
@@ -28,13 +26,18 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
28
26
  pip3 install check_systemd
29
27
  ```
30
28
 
29
+ ## Packages
30
+
31
+ * Debian ([package](https://ftp-master.debian.org/new/monitoring-plugins-systemd_2.3.0+ds-1.html), [source code](https://salsa.debian.org/python-team/packages/monitoring-plugins-systemd/-/tree/debian/master/debian)): work in progress
32
+ * NixOS ([package](https://search.nixos.org/packages?channel=unstable&query=check_systemd), [source code](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/servers/monitoring/nagios/plugins/check_systemd.nix)): `nix-env -iA nixos.check_systemd`
33
+
31
34
  ## Command line interface
32
35
 
33
36
  ```
34
37
  usage: check_systemd [-h] [-u UNIT | -e UNIT] [-n] [-w SECONDS] [-c SECONDS]
35
38
  [-t] [-W SECONDS] [-C SECONDS] [-i] [-v] [-V]
36
39
 
37
- Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
40
+ Copyright (c) 2014-18 Andrea Briganti <kbytesys@gmail.com>
38
41
  Copyright (c) 2019-21 Josef Friedrich <josef@friedrich.rocks>
39
42
 
40
43
  Nagios / Icinga monitoring plugin to check systemd.
@@ -97,9 +100,9 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
97
100
 
98
101
  ## Project pages
99
102
 
100
- * https://github.com/Josef-Friedrich/check_systemd
101
- * https://exchange.icinga.com/joseffriedrich/check_systemd
102
- * https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details
103
+ * on [github.com](https://github.com/Josef-Friedrich/check_systemd)
104
+ * on [icinga.com](https://exchange.icinga.com/joseffriedrich/check_systemd)
105
+ * on [nagios.org](https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details)
103
106
 
104
107
  ## Behind the scenes
105
108
 
@@ -127,6 +130,12 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
127
130
  systemctl list-timers --all
128
131
  ```
129
132
 
133
+ To learn how `systemd` produces the text output on the command line, it
134
+ is worthwhile to take a look at `systemd`’s source
135
+ code. Files relevant for text output are:
136
+ [basic/time-util.c](https://github.com/systemd/systemd/blob/main/src/basic/time-util.c),
137
+ [analyze/analyze.c](https://github.com/systemd/systemd/blob/main/src/analyze/analyze.c).
138
+
130
139
  ## Testing
131
140
 
132
141
  ```
@@ -139,10 +148,11 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
139
148
 
140
149
  ## Deploying
141
150
 
142
- Edit version number in check_systemd.py (without `v`)
151
+ Edit the version number in check_systemd.py (without `v`). Use the `-s`
152
+ option to sign the tag (required for the Debian package).
143
153
 
144
154
  ```
145
- git tag v2.0.11
155
+ git tag -s v2.0.11
146
156
  git push --tags
147
157
  ```
148
158
 
@@ -3,16 +3,14 @@
3
3
 
4
4
  # check_systemd
5
5
 
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.
10
-
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.
14
-
15
- You can also test a single service with the `-u, --unit` parameter.
6
+ `check_systemd` is a [Nagios](https://www.nagios.org) /
7
+ [Icinga](https://icinga.com) monitoring plugin to check
8
+ [systemd](https://systemd.io). This Python script will report a degraded
9
+ system to your monitoring solution. It can also be used to monitor
10
+ individual systemd services (with the `-u, --unit` parameter) and timers
11
+ units (with the `-t, --dead-timers` parameter). The only dependency the
12
+ plugin needs is the Python library
13
+ [nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable).
16
14
 
17
15
  ## Installation
18
16
 
@@ -20,13 +18,18 @@ You can also test a single service with the `-u, --unit` parameter.
20
18
  pip3 install check_systemd
21
19
  ```
22
20
 
21
+ ## Packages
22
+
23
+ * Debian ([package](https://ftp-master.debian.org/new/monitoring-plugins-systemd_2.3.0+ds-1.html), [source code](https://salsa.debian.org/python-team/packages/monitoring-plugins-systemd/-/tree/debian/master/debian)): work in progress
24
+ * NixOS ([package](https://search.nixos.org/packages?channel=unstable&query=check_systemd), [source code](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/servers/monitoring/nagios/plugins/check_systemd.nix)): `nix-env -iA nixos.check_systemd`
25
+
23
26
  ## Command line interface
24
27
 
25
28
  ```
26
29
  usage: check_systemd [-h] [-u UNIT | -e UNIT] [-n] [-w SECONDS] [-c SECONDS]
27
30
  [-t] [-W SECONDS] [-C SECONDS] [-i] [-v] [-V]
28
31
 
29
- Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
32
+ Copyright (c) 2014-18 Andrea Briganti <kbytesys@gmail.com>
30
33
  Copyright (c) 2019-21 Josef Friedrich <josef@friedrich.rocks>
31
34
 
32
35
  Nagios / Icinga monitoring plugin to check systemd.
@@ -89,9 +92,9 @@ Performance data:
89
92
 
90
93
  ## Project pages
91
94
 
92
- * https://github.com/Josef-Friedrich/check_systemd
93
- * https://exchange.icinga.com/joseffriedrich/check_systemd
94
- * https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details
95
+ * on [github.com](https://github.com/Josef-Friedrich/check_systemd)
96
+ * on [icinga.com](https://exchange.icinga.com/joseffriedrich/check_systemd)
97
+ * on [nagios.org](https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details)
95
98
 
96
99
  ## Behind the scenes
97
100
 
@@ -119,6 +122,12 @@ To find dead timers this plugin launches:
119
122
  systemctl list-timers --all
120
123
  ```
121
124
 
125
+ To learn how `systemd` produces the text output on the command line, it
126
+ is worthwhile to take a look at `systemd`’s source
127
+ code. Files relevant for text output are:
128
+ [basic/time-util.c](https://github.com/systemd/systemd/blob/main/src/basic/time-util.c),
129
+ [analyze/analyze.c](https://github.com/systemd/systemd/blob/main/src/analyze/analyze.c).
130
+
122
131
  ## Testing
123
132
 
124
133
  ```
@@ -131,9 +140,10 @@ tox
131
140
 
132
141
  ## Deploying
133
142
 
134
- Edit version number in check_systemd.py (without `v`)
143
+ Edit the version number in check_systemd.py (without `v`). Use the `-s`
144
+ option to sign the tag (required for the Debian package).
135
145
 
136
146
  ```
137
- git tag v2.0.11
147
+ git tag -s v2.0.11
138
148
  git push --tags
139
149
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: check-systemd
3
- Version: 2.3.0
3
+ Version: 2.3.1
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,16 +11,14 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
11
11
 
12
12
  # check_systemd
13
13
 
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.
18
-
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.
22
-
23
- You can also test a single service with the `-u, --unit` parameter.
14
+ `check_systemd` is a [Nagios](https://www.nagios.org) /
15
+ [Icinga](https://icinga.com) monitoring plugin to check
16
+ [systemd](https://systemd.io). This Python script will report a degraded
17
+ system to your monitoring solution. It can also be used to monitor
18
+ individual systemd services (with the `-u, --unit` parameter) and timers
19
+ units (with the `-t, --dead-timers` parameter). The only dependency the
20
+ plugin needs is the Python library
21
+ [nagiosplugin](https://nagiosplugin.readthedocs.io/en/stable).
24
22
 
25
23
  ## Installation
26
24
 
@@ -28,13 +26,18 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
28
26
  pip3 install check_systemd
29
27
  ```
30
28
 
29
+ ## Packages
30
+
31
+ * Debian ([package](https://ftp-master.debian.org/new/monitoring-plugins-systemd_2.3.0+ds-1.html), [source code](https://salsa.debian.org/python-team/packages/monitoring-plugins-systemd/-/tree/debian/master/debian)): work in progress
32
+ * NixOS ([package](https://search.nixos.org/packages?channel=unstable&query=check_systemd), [source code](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/servers/monitoring/nagios/plugins/check_systemd.nix)): `nix-env -iA nixos.check_systemd`
33
+
31
34
  ## Command line interface
32
35
 
33
36
  ```
34
37
  usage: check_systemd [-h] [-u UNIT | -e UNIT] [-n] [-w SECONDS] [-c SECONDS]
35
38
  [-t] [-W SECONDS] [-C SECONDS] [-i] [-v] [-V]
36
39
 
37
- Copyright (c) 2014-18 Andrea Briganti a.k.a 'Kbyte' <kbytesys@gmail.com>
40
+ Copyright (c) 2014-18 Andrea Briganti <kbytesys@gmail.com>
38
41
  Copyright (c) 2019-21 Josef Friedrich <josef@friedrich.rocks>
39
42
 
40
43
  Nagios / Icinga monitoring plugin to check systemd.
@@ -97,9 +100,9 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
97
100
 
98
101
  ## Project pages
99
102
 
100
- * https://github.com/Josef-Friedrich/check_systemd
101
- * https://exchange.icinga.com/joseffriedrich/check_systemd
102
- * https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details
103
+ * on [github.com](https://github.com/Josef-Friedrich/check_systemd)
104
+ * on [icinga.com](https://exchange.icinga.com/joseffriedrich/check_systemd)
105
+ * on [nagios.org](https://exchange.nagios.org/directory/Plugins/System-Metrics/Processes/check_systemd/details)
103
106
 
104
107
  ## Behind the scenes
105
108
 
@@ -127,6 +130,12 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
127
130
  systemctl list-timers --all
128
131
  ```
129
132
 
133
+ To learn how `systemd` produces the text output on the command line, it
134
+ is worthwhile to take a look at `systemd`’s source
135
+ code. Files relevant for text output are:
136
+ [basic/time-util.c](https://github.com/systemd/systemd/blob/main/src/basic/time-util.c),
137
+ [analyze/analyze.c](https://github.com/systemd/systemd/blob/main/src/analyze/analyze.c).
138
+
130
139
  ## Testing
131
140
 
132
141
  ```
@@ -139,10 +148,11 @@ Description: [![pypi.org](http://img.shields.io/pypi/v/check_systemd.svg)](https
139
148
 
140
149
  ## Deploying
141
150
 
142
- Edit version number in check_systemd.py (without `v`)
151
+ Edit the version number in check_systemd.py (without `v`). Use the `-s`
152
+ option to sign the tag (required for the Debian package).
143
153
 
144
154
  ```
145
- git tag v2.0.11
155
+ git tag -s v2.0.11
146
156
  git push --tags
147
157
  ```
148
158
 
@@ -1,11 +1,18 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
3
  """
4
- ``check_system`` is a Nagios / Icinga monitoring plugin to check systemd.
4
+ ``check_system`` is a `Nagios <https://www.nagios.org>`_ / `Icinga
5
+ <https://icinga.com>`_ monitoring plugin to check systemd. This Python script
6
+ will report a degraded system to your monitoring solution. It can also be used
7
+ to monitor individual systemd services (with the ``-u, --unit`` parameter) and
8
+ timers units (with the ``-t, --dead-timers`` parameter).
9
+
10
+ To lern more about the project, please visit the repository on `Github
11
+ <https://github.com/Josef-Friedrich/check_systemd>`_.
5
12
 
6
13
  This plugin is based on a Python package named `nagiosplugin
7
14
  <https://pypi.org/project/nagiosplugin/>`_. ``nagiosplugin`` has a fine-grained
8
- class model to separate concerns. A Nagios / Icinga plugin need to perform
15
+ class model to separate concerns. A Nagios / Icinga plugin must perform these
9
16
  three steps: data `acquisition`, `evaluation` and `presentation`.
10
17
  ``nagiosplugin`` provides for this three steps three classes: ``Resource``,
11
18
  ``Context``, ``Summary``. ``check_systemd`` extends this three model classes in
@@ -39,7 +46,7 @@ import re
39
46
  import nagiosplugin
40
47
  from nagiosplugin import Metric
41
48
 
42
- __version__ = '2.3.0'
49
+ __version__ = '2.3.1'
43
50
 
44
51
 
45
52
  class SystemctlListUnitsResource(nagiosplugin.Resource):
@@ -418,6 +425,7 @@ class UnitContext(nagiosplugin.Context):
418
425
  :param metric: associated metric that is to be evaluated
419
426
  :param resource: resource that produced the associated metric
420
427
  (may optionally be consulted)
428
+
421
429
  :returns: :class:`~.result.Result`
422
430
  """
423
431
  if metric.value:
@@ -450,6 +458,7 @@ class DeadTimersContext(nagiosplugin.Context):
450
458
  :param metric: associated metric that is to be evaluated
451
459
  :param resource: resource that produced the associated metric
452
460
  (may optionally be consulted)
461
+
453
462
  :returns: :class:`~.result.Result`
454
463
  """
455
464
  return self.result_cls(metric.value, metric=metric, hint=metric.name)
@@ -474,6 +483,9 @@ class PerformanceDataContext(nagiosplugin.Context):
474
483
 
475
484
 
476
485
  class SystemdSummary(nagiosplugin.Summary):
486
+ """Format the different status lines. A subclass of `nagiosplugin.Summary
487
+ <https://github.com/mpounsett/nagiosplugin/blob/master/nagiosplugin/summary.py>`_.
488
+ """
477
489
 
478
490
  def ok(self, results):
479
491
  """Formats status line when overall state is ok.
@@ -490,6 +502,7 @@ class SystemdSummary(nagiosplugin.Summary):
490
502
  """Formats status line when overall state is not ok.
491
503
 
492
504
  :param results: :class:`~.result.Results` container
505
+
493
506
  :returns: status line
494
507
  """
495
508
  summary = []
@@ -502,6 +515,7 @@ class SystemdSummary(nagiosplugin.Summary):
502
515
  """Provides extra lines if verbose plugin execution is requested.
503
516
 
504
517
  :param results: :class:`~.result.Results` container
518
+
505
519
  :returns: list of strings
506
520
  """
507
521
  summary = []
@@ -516,7 +530,7 @@ def get_argparser():
516
530
  prog='check_systemd', # To get the right command name in the README.
517
531
  formatter_class=lambda prog: argparse.RawDescriptionHelpFormatter(prog, width=80), # noqa: E501
518
532
  description= # noqa: E251
519
- 'Copyright (c) 2014-18 Andrea Briganti a.k.a \'Kbyte\' <kbytesys@gmail.com>\n' # noqa: E501
533
+ 'Copyright (c) 2014-18 Andrea Briganti <kbytesys@gmail.com>\n'
520
534
  'Copyright (c) 2019-21 Josef Friedrich <josef@friedrich.rocks>\n'
521
535
  '\n'
522
536
  'Nagios / Icinga monitoring plugin to check systemd.\n', # noqa: E501
@@ -638,13 +652,25 @@ def get_argparser():
638
652
 
639
653
 
640
654
  def main():
641
- """The main function"""
655
+ """The main entry point of the monitoring plugin. First the command line
656
+ arguments are read into the variable ``args``. The configuration of this
657
+ ``args`` object decides which instances of the `Resource
658
+ <https://github.com/mpounsett/nagiosplugin/blob/master/nagiosplugin/resource.py>`_,
659
+ `Context
660
+ <https://github.com/mpounsett/nagiosplugin/blob/master/nagiosplugin/context.py>`_
661
+ and `Summary
662
+ <https://github.com/mpounsett/nagiosplugin/blob/master/nagiosplugin/summary.py>`_
663
+ subclasses are assembled in a list called ``tasks``. This list is passed
664
+ the main class of the ``nagiosplugin`` library: the `Check
665
+ <https://nagiosplugin.readthedocs.io/en/stable/api/core.html#nagiosplugin-check>`_
666
+ class.
667
+ """
642
668
  args = get_argparser().parse_args()
643
669
 
644
- objects = []
670
+ tasks = []
645
671
 
646
672
  if args.dead_timers:
647
- objects += [
673
+ tasks += [
648
674
  SystemctlListTimersResource(
649
675
  excludes=args.exclude,
650
676
  warning=args.dead_timers_warning,
@@ -654,9 +680,9 @@ def main():
654
680
  ]
655
681
 
656
682
  if args.unit:
657
- objects.append(SystemctlIsActiveResource(unit=args.unit))
683
+ tasks.append(SystemctlIsActiveResource(unit=args.unit))
658
684
  else:
659
- objects += [
685
+ tasks += [
660
686
  SystemctlListUnitsResource(excludes=args.exclude),
661
687
  PerformanceDataContext(),
662
688
  ]
@@ -668,15 +694,15 @@ def main():
668
694
  )
669
695
  # systemd-analyze: boot not finshed exits with 1
670
696
  if analyse.returncode == 0:
671
- objects.append(SystemdAnalyseResource())
697
+ tasks.append(SystemdAnalyseResource())
672
698
 
673
- objects += [
699
+ tasks += [
674
700
  UnitContext(args),
675
701
  SystemdSummary()
676
702
  ]
677
703
 
678
704
  if not args.no_startup_time:
679
- objects.append(
705
+ tasks.append(
680
706
  nagiosplugin.ScalarContext(
681
707
  name='startup_time',
682
708
  warning=args.warning,
@@ -684,13 +710,13 @@ def main():
684
710
  )
685
711
  )
686
712
  else:
687
- objects.append(
713
+ tasks.append(
688
714
  nagiosplugin.ScalarContext(
689
715
  name='startup_time'
690
716
  )
691
717
  )
692
718
 
693
- check = nagiosplugin.Check(*objects)
719
+ check = nagiosplugin.Check(*tasks)
694
720
  check.main(args.verbose)
695
721
 
696
722
 
File without changes
File without changes
File without changes