Skip to content

Commit

Permalink
Merge pull request #54 from vrtdev/feature/report_puppet_transaction_…
Browse files Browse the repository at this point in the history
…completed

Feature/report puppet transaction completed
  • Loading branch information
zipkid committed Jun 24, 2020
2 parents 67febd5 + a74d796 commit eb48c4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -92,6 +92,7 @@ puppet_report_events{name="Failure",environment="production",host="node.example.
puppet_report_events{name="Success",environment="production",host="node.example.com"} 0
puppet_report_events{name="Total",environment="production",host="node.example.com"} 0
puppet_report{environment="production",host="node.example.com"} 1477054915347
puppet_transaction_completed{environment="production",host="node.example.com"} 1
```

## Contributors
Expand Down
9 changes: 9 additions & 0 deletions lib/puppet/reports/prometheus.rb
Expand Up @@ -89,6 +89,15 @@ def process
# TYPE puppet_report gauge
EOS

if defined?(transaction_completed) && ([true, false].include? transaction_completed)
completed = transaction_completed == true ? 1 : 0
new_metrics["puppet_transaction_completed{#{common_values.join(',')}}"] = completed
definitions << <<-EOS
# HELP puppet_transaction_completed transaction completed status of the last puppet run
# TYPE puppet_transaction_completed gauge
EOS
end

File.open(filename, 'w') do |file|
file.write(definitions)
if File.exist?(yaml_filename)
Expand Down

0 comments on commit eb48c4d

Please sign in to comment.