Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement systemd daemons state gatherer #69

Merged
merged 1 commit into from
Aug 9, 2022
Merged

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Aug 4, 2022

systemd states gatherer. I have decide to go with the golang systemd pacakge together with dbus. Maybe it is a bit of a overkill, as we could simply run the systemctl is-active command, but this options makes it more extensible, as we can easily gather other fields of the daemon state in the future.

Here the api of dbus for additional help: https://pkg.go.dev/github.com/coreos/go-systemd/v22/dbus

Example:

./trento-agent facts gather --gatherer systemd --argument corosync
INFO[2022-08-04 15:14:56] Starting systemd state facts gathering process 
INFO[2022-08-04 15:14:56] Requested systemd state facts gathered       
INFO[2022-08-04 15:14:56] Gathered fact for "systemd" with argument "corosync": 
INFO[2022-08-04 15:14:56] {
  "name": "corosync",
  "value": "inactive",
  "check_id": ""
} 

./trento-agent facts gather --gatherer systemd --argument k3s
INFO[2022-08-04 15:15:12] Starting systemd state facts gathering process 
INFO[2022-08-04 15:15:12] Requested systemd state facts gathered       
INFO[2022-08-04 15:15:12] Gathered fact for "systemd" with argument "k3s": 
INFO[2022-08-04 15:15:12] {
  "name": "k3s",
  "value": "active",
  "check_id": ""
} 

Copy link
Member

@nelsonkopliku nelsonkopliku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty clear ✔️

@dottorblaster
Copy link
Contributor

Maybe it is a bit of a overkill

I think this is the correct approach instead, good shot.

Copy link
Contributor

@dottorblaster dottorblaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@arbulu89 arbulu89 merged commit 1942db2 into main Aug 9, 2022
@stefanotorresi stefanotorresi deleted the systemd-gatherer branch August 17, 2022 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants