Skip to content

systemd-units-failed: Add option to include failed unit names in first output line #967

@metrax

Description

@metrax

Describe the solution you'd like

Currently, the plugin /usr/lib64/nagios/plugins/systemd-units-failed only reports a generic message in the first output line, e.g.:

There is 1 failed unit.

When monitoring multiple systems, this message is not very helpful, as it requires opening the plugin’s extended output or performance data to see which service actually failed.

I propose adding an optional parameter, for example --include-unit-names (or similar), that changes the first output line to include the failed unit names directly when there are only a few of them.

Example desired output:

1 failed unit: letsencrypt-wrapper.service

or if multiple:

2 failed units: letsencrypt-wrapper.service, postfix.service

This would make it easier to immediately identify failed units from dashboards or SMS alerts without needing to expand the plugin details.

Additional context

The feature should be optional to maintain backward compatibility with existing parsing or alerting setups.
Example command for new behavior:

/usr/lib64/nagios/plugins/systemd-units-failed --include-unit-names

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions