Provide addition detail to Linux systemd events to indicate if a systemd service is configured to start automatically #22368
Labels
enhancement
Metricbeat
Metricbeat
monitoring
Team:Services
(Deprecated) Label for the former Integrations-Services team
Describe the enhancement:
Add a field to indicate if the Linux systemd service is configured to start automatically, similar to the windows field of
start_type
.Describe a specific use case for the enhancement or feature:
For a generic pattern to monitor all services and filter/alert for services that are configured to start automatically but are not currently running, this is seemingly easy for Windows service Metricbeat events and not so possible for Linux systemd Metricbeat events.
This can be used as a generic recipe to filter/alert on any services that should be running but currently aren't for Windows services.
A similar generic pattern with Linux systemd services seems not so possible due to lack of detail in the resulting systemd Metricbeat event.
For Windows this pattern is made easy by the
start_type
field:https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-windows-service.html
https://www.elastic.co/guide/en/beats/metricbeat/current/exported-fields-windows.html
eg:
So for Windows sevices filtering by
windows.service.start_type:Automatic
andwindows.service.state:Stopped
gives you the list of services that should be running but currently aren't.On Linux we don't seen to surface the detail of if a service is enabled and set to start on boot.
On Windows the key piece of information would map to the "start_type" field.
On Linux, a systemd service can have an "enabled" property for the Loaded state, but even more complex than this, one service that has a disabled property for Loaded state can be triggered by another service that has an enabled property.
For example on my system, I have the
docker.service
systemd service that is currently disabled (though default install suggests it should be enabled according to the "vendor preset", I think I just disabled this myself a while back):But the
docker.socket
service IS enabled, so will start on boot and also triggers the start of thedocker.service
, effectively configuringdocker.service
to start on boot:and the
docker.service
does start on boot successfully with this configuration.So for right now, Linux Metricbeat events would appear to be missing the level of detail to allow a recipe to generically alert on services that "should" be running but are not currently running.
A workaround for now would be to specifically check/filter if a known list of services that should be started are running or not or to check/filter per known service that should be running.
As to how we might enhance this metricset to include this information, it might not even be a simple case of looking across all services to see if one triggers another, because I think you might also have situations where multi-level triggering can be configured, one triggers another that triggers another. The last service in the chain is being started on boot by a service that is enabled but doesn't directly reference it.
Not impossible to determine but also not so simple without jumping through a few hoops.
The result might just be a new field for Linux Metricbeat system service events similar to
start_type
on the Windows service events to indicate if the systemd service starts on boot according to the point in time that configuration was checked when that event was generatedWhether that's directly via an
enabled
property on the current service or via any upstream service indicated in theTriggeredBy
property or any chain of triggered services where there is a necessaryenabled
property to result in the current service starting on boot.The text was updated successfully, but these errors were encountered: