这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Conversation

@alienth
Copy link
Contributor

@alienth alienth commented Oct 5, 2015

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 of processes_windows collector).

It writes metric information to linux.systemd.unit, and to os.service.running. The systemd metric tracks each possible ActiveState of a systemd service unit. The os metric simply tracks whether the service is running or not.

If WatchProc was set to true in the config, it also attempts to lookup the service process and sends process metrics via the processes_linux collector methods.

Example config:

[[SystemdService]]
   Name = "scollector"
   WatchProc = true

[[SystemdService]]
   Name = "redis-.*"

@alienth alienth force-pushed the systemd branch 9 times, most recently from 81e6264 to c48af03 Compare October 6, 2015 16:42
Copy link
Contributor

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

@alienth alienth force-pushed the systemd branch 7 times, most recently from fdb46d4 to b65072f Compare October 6, 2015 20:17
Copy link
Contributor

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.

@gbrayut
Copy link
Contributor

gbrayut commented Oct 7, 2015

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")

@alienth
Copy link
Contributor Author

alienth commented Oct 8, 2015

@captncraig / @gbrayut Requested changes made.

I pushed the followup commits as-is to make review easier. I plan to squash things down before merge.

@gbrayut
Copy link
Contributor

gbrayut commented Oct 8, 2015

LGTM... will try and test it tomorrow.

@alienth
Copy link
Contributor Author

alienth commented Oct 8, 2015

Squished down. I left the NameMatches change separate because my changes no longer require it, but it should still be done.

gbrayut added a commit that referenced this pull request Oct 21, 2015
Add collector for systemd service status.
@gbrayut gbrayut merged commit 8df4809 into bosun-monitor:master Oct 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants