-
-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding class to create alerts * fix puppet syntax in alert class * fix puppet syntax in alert class * fix name Value in Labels
- Loading branch information
Showing
6 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Class: prometheus::alerts | ||
# | ||
# This module manages prometheus alerts for prometheus | ||
# | ||
# [*location*] | ||
# Whether to create the alert file for prometheus | ||
# | ||
# [*alerts*] | ||
# Array of alerts (see README) | ||
# | ||
class prometheus::alerts ( | ||
String $location, | ||
Array $alerts, | ||
String $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"), | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% $prometheus::alerts::alerts.each |$alert| { -%> | ||
ALERT <%= $alert['name'] %> | ||
IF <%= $alert['condition'] %> | ||
FOR <%= $alert['timeduration'] %> | ||
LABELS { | ||
<% $alert['labels'].each |$label| { -%> | ||
<%= $label['name'] %> = "<%= $label['content'] %>", | ||
<% } -%> | ||
} | ||
ANNOTATIONS { | ||
<% $alert['annotations'].each |$annotation| { -%> | ||
<%= $annotation['name'] %> = "<%= $annotation['content'] %>", | ||
<% } -%> | ||
} | ||
<% } -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include prometheus | ||
include prometheus::node_exporter | ||
include prometheus::alert_manager | ||
include prometheus::alerts |