-
Notifications
You must be signed in to change notification settings - Fork 492
Add collector for systemd service status. #1374
Conversation
81e6264 to
c48af03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is missing a "bosun.org/util" import. Adding that should fix travis ci builds
fdb46d4 to
b65072f
Compare
cmd/scollector/main.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a new way to do this kind of init stuff, but unfortunately didn't convert all these old ones in main. See what I did to the haproxy one here: https://github.com/bosun-monitor/bosun/blob/master/cmd/scollector/collectors/haproxy_unix.go#L16
That should make the collectors more self contained.
|
I would add osServiceRunningDesc = "0: active, 1: inactive" as a const in scollector/collectors/collecors.go and use that for the os.service.running description. That way it can be shared with windows. You can also move the metric name to a const in that same file (ex: osServiceRunning = "os.service.running") |
|
@captncraig / @gbrayut Requested changes made. I pushed the followup commits as-is to make review easier. I plan to squash things down before merge. |
|
LGTM... will try and test it tomorrow. |
|
Squished down. I left the NameMatches change separate because my changes no longer require it, but it should still be done. |
Add collector for systemd service status.
Utilizes dbus API to determine state of services managed by systemd. It will track the state of services listed under
[[SystemdService]]entries in the config (modeled off ofprocesses_windowscollector).It writes metric information to
linux.systemd.unit, and toos.service.running. Thesystemdmetric tracks each possibleActiveStateof a systemd service unit. Theosmetric simply tracks whether the service is running or not.If
WatchProcwas set totruein the config, it also attempts to lookup the service process and sends process metrics via theprocesses_linuxcollector methods.Example config: