Skip to content

Commit

Permalink
Backport alerts to puppet3
Browse files Browse the repository at this point in the history
  • Loading branch information
vide committed Jun 20, 2017
1 parent acaa7ff commit f945188
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions manifests/alerts.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
# Array of alerts (see README)
#
class prometheus::alerts (
String $location,
Array $alerts,
String $alertfile_name = 'alert.rules'
$alerts,
$location,
$alertfile_name = 'alert.rules',
) inherits prometheus::params {

if $alerts != [] {
file{ "${location}/${alertfile_name}":
ensure => 'file',
owner => $prometheus::user,
group => $prometheus::group,
content => epp("${module_name}/alerts.epp"),
}
if $alerts != [] {
file{ "${location}/${alertfile_name}":
ensure => 'file',
owner => $prometheus::user,
group => $prometheus::group,
content => template("${module_name}/alerts.erb"),
}
}

}
15 changes: 0 additions & 15 deletions templates/alerts.epp

This file was deleted.

15 changes: 15 additions & 0 deletions templates/alerts.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<% @alerts.each do |alert| -%>
ALERT <%= alert['name'] %>
IF <%= alert['condition'] %>
FOR <%= alert['timeduration'] %>
LABELS {
<% alert['labels'].each do |label| -%>
<%= label['name'] %> = "<%= label['content'] %>",
<% end -%>
}
ANNOTATIONS {
<% alert['annotations'].each do |annotation| -%>
<%= annotation['name'] %> = "<%= annotation['content'] %>",
<% end -%>
}
<% end -%>

0 comments on commit f945188

Please sign in to comment.