Skip to content

Commit

Permalink
service: Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
markuslf committed Jul 9, 2024
1 parent f5d9f34 commit 8c1abef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
13 changes: 8 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ and this project does NOT adhere to [Semantic Versioning](https://semver.org/spe

## [Unreleased]

### Breaking Changes

Monitoring Plugins:

* service: Implement `--starttype`, as code was missing (parameter is now appending); implement unit-tests


### Fixed ("bug")

Icinga Director:

* crypto-policy: New defaults according to LFOps crypto_policy role
* mysql-query: fix director basket

Monitoring Plugins:

* service: Implement `--starttype` as code was missing; implement unit-tests
* mysql-query: Fix director basket


## 2024060401
Expand Down
9 changes: 5 additions & 4 deletions check-plugins/service/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ Example:
Hints:

* For use in Icinga Director: If the service name contains a ``$``, this dollar sign must be escaped with another dollar sign. Since the plugin is capable of regular expressions, this character must also be escaped with a backslash. So if you want to check ``my$service``, you have to specify ``my\$$service``.
* On the command line: If you want to check ``my$service``, you have to specify ``my\$service``.
* On the Windows command line: If you want to check ``my$service``, you have to specify ``my\$service``.
* On the Windows command line: Only use double quotes to provide regexes to ``--service``; if running unit tests on Linux, use single quotes instead.


Fact Sheet
Expand Down Expand Up @@ -74,7 +75,7 @@ Check that exactly one service named "BFE" (exact match) is running, otherwise W

.. code-block:: bash
service --service='^bfe$' --status=running --warning=1:1
service --service="^bfe$" --status=running --warning=1:1
Output:

Expand All @@ -90,7 +91,7 @@ Check that there are at least 10 but not more than 20 Windows Services named "my

.. code-block:: bash
service --service='^myapp[0-9]{4}$' --starttype=automatic --status=running --warning=10:19
service --service="^myapp[0-9]{4}$" --starttype=automatic --status=running --warning=10:19
Output:

Expand All @@ -107,7 +108,7 @@ Check that ALL services with startup type "automatic" are running, except for a

.. code-block:: bash
service --service='^(?!DPS|MSDTC|MapsBroker|UsoSvc|Dnscache|gpsvc$).*$' --starttype=automatic --status=continue_pending --status=pause_pending --status=paused --status=start_pending --status=stop_pending --status=stopped --warning 0
service --service="^(?!DPS|MSDTC|MapsBroker|UsoSvc|Dnscache|gpsvc$).*$" --starttype=automatic --status=continue_pending --status=pause_pending --status=paused --status=start_pending --status=stop_pending --status=stopped --warning 0
Output (shortened):

Expand Down
6 changes: 4 additions & 2 deletions check-plugins/service/service
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ except ImportError:


__author__ = 'Linuxfabrik GmbH, Zurich/Switzerland'
__version__ = '2024070901'
__version__ = '2024070902'

DESCRIPTION = '''Checks the state of one or more Windows services. You have to provide the
case-insensitive "Service Name", not the "Display Name". Supports Python regular
Expand Down Expand Up @@ -192,8 +192,10 @@ def main():
except re.error as rerr:
lib.base.cu('Invalid regex "{}": {}'.format(args.SERVICE, rerr))
except psutil.NoSuchProcess:
lib.base.cu('Service `{}` not found'.format(args.SERVICE))
lib.base.cu('r`{}` does not match any service name.'.format(args.SERVICE))

if not table_data:
lib.base.cu('r`{}` does not match any service name.'.format(args.SERVICE))
svc_cnt = len(table_data)

# build the message
Expand Down

0 comments on commit 8c1abef

Please sign in to comment.