Monitoring systemd services using Metricbeat

I was wondering if there is a way to monitor Centos services like kubelet, keepalived, even a custom service that I wrote, using Metricbeat or any other Elastic service. i.e. is there a way to have metricbeat run a command like:

service myService status

and see if the results is running.

Thank you

Hi @Mohammad_Etemad,

while not directly related to systemd services, the built-in system module of metricbeat has a process metricset that can be enabled. It supports filtering down the reported processes. It also integrates with cgroups, which are the primary process tracking mechanism systemd uses. Since systemd names the cgroups after the units, it should be easy to query the metricbeat results for the processes belonging to a specific service.

Thank you for the quick reply @weltenwort . I tried this and I do get entries based on the service. But the problem is when the service stops, the entries stop. Is there any way that a field can show the status of the service? So something like the equivalent of heartbeat but instead of tcp/http/... for systemd.

1 Like

Good point, depending on the way the results are being queried this might be a problem. Sometimes it is possible to deal with that using the missing configuration of the aggregation when querying.

There is an enhancement proposal at https://github.com/elastic/beats/issues/11846. Any input you can provide on that issue would help the metricbeat developers to judge the demand and scope for this feature.

In the meantime there might be an improvised way to achieve the same thing using the execbeat community beat.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.