-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56ed0d0
commit 5c7a36e
Showing
10 changed files
with
155 additions
and
4 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
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,62 @@ | ||
# Class: prometheus::pushgateway | ||
# | ||
# This module manages prometheus pushgateway | ||
# | ||
# Parameters: | ||
# | ||
# [*package_name*] | ||
# pushgateway package name | ||
# | ||
# [*package_ensure*] | ||
# If package, then use this for package ensurel default 'latest' | ||
# | ||
# [*pushgateway_user*] | ||
# User under which pushgateway will run | ||
# Default prometheus | ||
# | ||
# [*pushgateway_group*] | ||
# Group under which pushgateway will run | ||
# Default prometheus | ||
# | ||
# == CONFIG == | ||
# | ||
# [*log_format*] | ||
# If set use a syslog logger or JSON logging. Example: logger:syslog?appname=bob&local=7 or logger:stdout?json=true. Defaults to | ||
# stderr. | ||
# | ||
# [*log_level*] | ||
# Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal]. (default info) | ||
# | ||
# [*persistence_file*] | ||
# File to persist metrics. If empty, metrics are only kept in memory. | ||
# | ||
# [*persistence_interval*] | ||
# The minimum interval at which to write out the persistence file. (default 5m0s) | ||
# | ||
# [*web_listen_address*] | ||
# Address to listen on for the web interface and API. (default ":9093") | ||
# | ||
# [*extra_options*] | ||
# Extra options added to alertmanager startup command | ||
# | ||
class prometheus::pushgateway ( | ||
$package_name = $::prometheus::pushgateway::params::package_name, | ||
$package_ensure = $::prometheus::pushgateway::params::package_ensure, | ||
$pushgateway_user = $::prometheus::pushgateway::params::pushgateway_user, | ||
$pushgateway_group = $::prometheus::pushgateway::params::pushgateway_group, | ||
$log_format = $::prometheus::pushgateway::params::log_format, | ||
$log_level = $::prometheus::pushgateway::params::log_level, | ||
$persistence_file = $::prometheus::pushgateway::params::persistence_file, | ||
$persistence_interval = $::prometheus::pushgateway::params::persistence_interval, | ||
$web_listen_address = $::prometheus::pushgateway::params::web_listen_address, | ||
$web_telemetry_path = $::prometheus::pushgateway::params::web_telemetry_path, | ||
$extra_options = $::prometheus::pushgateway::params::extra_options, | ||
) inherits prometheus::pushgateway::params { | ||
contain '::prometheus::pushgateway::install' | ||
contain '::prometheus::pushgateway::config' | ||
contain '::prometheus::pushgateway::service' | ||
|
||
Class['prometheus::pushgateway::install'] -> | ||
Class['prometheus::pushgateway::config'] ~> | ||
Class['prometheus::pushgateway::service'] | ||
} |
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,17 @@ | ||
# Class prometheus::pushgateway::config | ||
# | ||
class prometheus::pushgateway::config { | ||
file { $::prometheus::pushgateway::persistence_file: | ||
ensure => 'file', | ||
mode => '0644', | ||
owner => $::prometheus::pushgateway::pushgateway_user, | ||
group => $::prometheus::pushgateway::pushgateway_group, | ||
} | ||
|
||
file { '/etc/sysconfig/pushgateway': | ||
mode => '0644', | ||
owner => 'root', | ||
group => 'root', | ||
content => template("${module_name}/sysconfig/pushgateway"), | ||
} | ||
} |
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,5 @@ | ||
# Class prometheus::pushgateway::install | ||
# | ||
class prometheus::pushgateway::install { | ||
package { $::prometheus::pushgateway::package_name: ensure => $::prometheus::pushgateway::package_ensure, } | ||
} |
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,17 @@ | ||
# Class prometheus::pushgateway::params | ||
# | ||
class prometheus::pushgateway::params { | ||
$package_name = 'pushgateway' | ||
$package_ensure = 'installed' | ||
$pushgateway_user = 'prometheus' | ||
$pushgateway_group = 'prometheus' | ||
|
||
$log_format = 'logger:stdout?json=true' | ||
$log_level = undef | ||
$persistence_file = '/etc/prometheus/pushgateway.persistance' | ||
$persistence_interval = undef | ||
$web_listen_address = ':9091' | ||
$web_telemetry_path = undef | ||
|
||
$extra_options = undef | ||
} |
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,8 @@ | ||
# == Class prometheus::pushgateway::service | ||
# | ||
class prometheus::pushgateway::service { | ||
service { 'pushgateway': | ||
ensure => 'running', | ||
enable => true, | ||
} | ||
} |
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,17 @@ | ||
require 'spec_helper' | ||
|
||
describe 'prometheus::pushgateway' do | ||
on_supported_os.each do |os, facts| | ||
context "with defaults on #{os}" do | ||
let(:facts) do | ||
facts.merge({:puppetmaster => 'localhost.localdomain'}) | ||
end | ||
|
||
it { should compile.with_all_deps } | ||
it { should contain_class('prometheus::pushgateway') } | ||
it { should contain_class('prometheus::pushgateway::config') } | ||
it { should contain_class('prometheus::pushgateway::install') } | ||
it { should contain_class('prometheus::pushgateway::service') } | ||
end | ||
end | ||
end |
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,25 @@ | ||
# File managed by puppet | ||
# | ||
ARGS="<% -%> | ||
<% if @log_format -%> | ||
-log.format=<%= scope['prometheus::pushgateway::log_format'] -%> | ||
<% end -%> | ||
<% if @log_level -%> | ||
-log.level=<%= scope['prometheus::pushgateway::log_level'] -%> | ||
<% end -%> | ||
<% if @persistence_file -%> | ||
-persistence.file=<%= scope['prometheus::pushgateway::persistence_file'] -%> | ||
<% end -%> | ||
<% if @persistence_interval -%> | ||
-persistence.interval=<%= scope['prometheus::pushgateway::persistence_interval'] -%> | ||
<% end -%> | ||
<% if @web_listen_address -%> | ||
-web.listen-address=<%= scope['prometheus::pushgateway::web_listen_address'] -%> | ||
<% end -%> | ||
<% if @web_telemetry_path -%> | ||
-web.telemetry-path=<%= scope['prometheus::pushgateway::web_telemetry_path'] -%> | ||
<% end -%> | ||
<% if @extra_options -%> | ||
<%= scope['prometheus::pushgateway::extra_options'] -%> | ||
<% end -%> | ||
" |