-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
verify whether alert_manager is running #101
verify whether alert_manager is running #101
Conversation
lib/facter/alert_manager_running.rb
Outdated
@@ -0,0 +1,6 @@ | |||
Facter.add('prometheus_alert_manager_running') do | |||
setcode do | |||
svc_status = Facter::Core::Execution.exec('puppet resource service alert_manager | grep ensure') |
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.
do you have experience with calling puppet in a fact? Are there situations where it could deadlock? I am a bit scared that this will slow down all puppet run on each system in a environment.
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 is just puppet resource, not puppet apply or puppet agent. I tested the fact on some systems without any difficulties. I prefer to use puppet resource service as this is generic to all platforms. We can of course confine this to only run on linux platforms.
I am happy to accept any other, more smart idea.
Besides this: I was about to change this on Monday to puppet resource --yaml service ... to allow smarter data parsing.
Tests are green (after hitting the restart job button several times). @bastelfreak @scottybrisbane @skarip please review |
@@ -0,0 +1,6 @@ | |||
Facter.add('prometheus_alert_manager_running') do | |||
setcode do | |||
svc_status = YAML.load(Facter::Core::Execution.exec('puppet resource service alert_manager --to_yaml')) |
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.
awesome, I wasn't aware of --to_yaml takes notes
manifests/alertmanager.pp
Outdated
# This is here to stop the previous alertmanager that was installed in version 0.1.14 | ||
service { 'alert_manager': | ||
ensure => 'stopped', | ||
if $::prometheus_alert_manager_running == 'running' { |
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.
Please use the new facts hash here. $facts['prometheus_alert_manager_running']
Thanks for the PR! |
Thanks for the fix @tuxmea! |
verify whether alert_manager is running
verify whether alert_manager is running
fixes #55