Skip to content

Commit

Permalink
Use puppet internals to determine the state of the alert_manager
Browse files Browse the repository at this point in the history
When the PATH has not been set up system wide to include puppet, thhe
prometheus_alert_manager_running fact throws errors in the logs. By
using puppet internals, we get the same information without going
through an 'external' execution.
  • Loading branch information
vStone committed Dec 15, 2017
1 parent 02ff32a commit 996a64b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/facter/alert_manager_running.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
require 'puppet'

service = Puppet::Type.type(:service).new(name: 'alert_manager')

Facter.add('prometheus_alert_manager_running') do
setcode do
Facter::Core::Execution.execute('puppet resource service alert_manager 2>&1').scan('running')[0]
service.provider.status == :running
end
end

0 comments on commit 996a64b

Please sign in to comment.