Showing with 35 additions and 42 deletions.
  1. +1 −1 .fixtures.yml
  2. +1 −1 README.md
  3. +1 −1 manifests/config.pp
  4. +10 −11 manifests/daemon.pp
  5. +12 −14 manifests/install.pp
  6. +3 −3 manifests/params.pp
  7. +3 −3 metadata.json
  8. +2 −4 spec/classes/haproxy_exporter_spec.rb
  9. +2 −4 spec/classes/node_exporter_spec.rb
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fixtures:
repositories:
archive: "https://github.com/voxpupuli/puppet-archive"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib"
staging: "https://github.com/voxpupuli/puppet-staging"
symlinks:
"prometheus": "#{source_dir}"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ On the server (for prometheus version >= 1.0.0):
class { 'prometheus':
version => '1.0.0',
scrape_configs => [ {'job_name'=>'prometheus','scrape_interval'=> '30s','scrape_timeout'=>'30s','static_configs'=> [{'targets'=>['localhost:9090'], 'labels'=> { 'alias'=>'Prometheus'}}]}],
extra_options => '-alertmanager.url http://localhost:9093 -web.console.templates=/opt/staging/prometheus-1.0.0.linux-amd64/consoles -web.console.libraries=/opt/staging/prometheus-1.0.0.linux-amd64/console_libraries',
extra_options => '-alertmanager.url http://localhost:9093 -web.console.templates=/opt/prometheus-1.0.0.linux-amd64/consoles -web.console.libraries=/opt/prometheus-1.0.0.linux-amd64/console_libraries',
localstorage => '/prometheus/prometheus',
}
```
Expand Down
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
}
'systemd' : {
file { '/lib/systemd/system/prometheus.service':
file { '/etc/systemd/system/prometheus.service':
mode => '0644',
owner => 'root',
group => 'root',
Expand Down
21 changes: 10 additions & 11 deletions manifests/daemon.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,24 @@

case $install_method {
'url': {
include ::staging
$staging_file = "${name}-${version}.${download_extension}"
$binary = "${::staging::path}/${name}-${version}.${os}-${arch}/${name}"
staging::file { $staging_file:
source => $real_download_url,
archive { "/tmp/${name}-${version}.${download_extension}":
ensure => present,
extract => true,
extract_path => '/opt',
source => $real_download_url,
checksum_verify => false,
creates => "/opt/${name}-${version}.${os}-${arch}/${name}",
cleanup => true,
} ->
staging::extract { $staging_file:
target => $::staging::path,
creates => $binary,
} ->
file { $binary:
file { "/opt/${name}-${version}.${os}-${arch}/${name}":
owner => 'root',
group => 0, # 0 instead of root because OS X uses "wheel".
mode => '0555',
} ->
file { "${bin_dir}/${name}":
ensure => link,
notify => $notify_service,
target => $binary,
target => "/opt/${name}-${version}.${os}-${arch}/${name}",
}
}
'package': {
Expand Down
26 changes: 12 additions & 14 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,24 @@
}
case $::prometheus::install_method {
'url': {
include ::staging
staging::file { "prometheus-${prometheus::version}.${prometheus::download_extension}":
source => $prometheus::real_download_url,
} ->
file { "${::staging::path}/prometheus-${prometheus::version}":
ensure => directory,
} ->
staging::extract { "prometheus-${prometheus::version}.${prometheus::download_extension}":
target => $::staging::path,
creates => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus",
archive { "/tmp/prometheus-${prometheus::version}.${prometheus::download_extension}":
ensure => present,
extract => true,
extract_path => '/opt',
source => $prometheus::real_download_url,
checksum_verify => false,
creates => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus",
cleanup => true,
} ->
file {
"${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus":
"/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus":
owner => 'root',
group => 0, # 0 instead of root because OS X uses "wheel".
mode => '0555';
"${::prometheus::bin_dir}/prometheus":
ensure => link,
notify => $::prometheus::notify_service,
target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus";
target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/prometheus";
$::prometheus::shared_dir:
ensure => directory,
owner => $::prometheus::user,
Expand All @@ -43,11 +41,11 @@
"${::prometheus::shared_dir}/consoles":
ensure => link,
notify => $::prometheus::notify_service,
target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/consoles";
target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/consoles";
"${::prometheus::shared_dir}/console_libraries":
ensure => link,
notify => $::prometheus::notify_service,
target => "${::staging::path}/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/console_libraries";
target => "/opt/prometheus-${prometheus::version}.${prometheus::os}-${prometheus::arch}/console_libraries";
}
}
'package': {
Expand Down
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$alertmanager_storage_path='/var/lib/alertmanager'
$alertmanager_templates = [ "${alertmanager_config_dir}/*.tmpl" ]
$alertmanager_user = 'alertmanager'
$alertmanager_version = '0.3.0'
$alertmanager_version = '0.5.1'
$alerts = []
$bin_dir = '/usr/local/bin'
$config_dir = '/etc/prometheus'
Expand Down Expand Up @@ -68,7 +68,7 @@
$node_exporter_package_ensure = 'latest'
$node_exporter_package_name = 'node_exporter'
$node_exporter_user = 'node-exporter'
$node_exporter_version = '0.13.0'
$node_exporter_version = '0.14.0'
$package_ensure = 'latest'
$package_name = 'prometheus'
$rule_files = [ "${config_dir}/alert.rules" ]
Expand All @@ -85,7 +85,7 @@
$statsd_exporter_user = 'statsd-exporter'
$statsd_exporter_version = '0.3.0'
$user = 'prometheus'
$version = '1.0.1'
$version = '1.5.2'
case $::architecture {
'x86_64', 'amd64': { $arch = 'amd64' }
'i386': { $arch = '386' }
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-prometheus",
"version": "0.2.4",
"version": "1.0.0",
"author": "Vox Pupuli",
"summary": "This module installs, configures and manages the Prometheus service.",
"license": "Apache-2.0",
Expand All @@ -9,8 +9,8 @@
"issue_url": "https://github.com/voxpupuli/puppet-prometheus/issues",
"dependencies": [
{
"name":"puppet/staging",
"version_requirement":">=1.0.7 <3.0.0"
"name":"puppet/archive",
"version_requirement":">=1.3.0 <2.0.0"
},
{
"name":"puppetlabs/stdlib",
Expand Down
6 changes: 2 additions & 4 deletions spec/classes/haproxy_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge(
staging_http_get: 'curl'
)
facts
end

context 'with version specified' do
Expand All @@ -18,7 +16,7 @@
}
end
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/staging/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') }
it { is_expected.to contain_file('/usr/local/bin/haproxy_exporter').with('target' => '/opt/haproxy_exporter-0.7.1.linux-amd64/haproxy_exporter') }
end
end
end
Expand Down
6 changes: 2 additions & 4 deletions spec/classes/node_exporter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts.merge(
staging_http_get: 'curl'
)
facts
end

context 'with version specified' do
Expand All @@ -18,7 +16,7 @@
}
end
describe 'install correct binary' do
it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/staging/node_exporter-0.13.0.linux-amd64/node_exporter') }
it { is_expected.to contain_file('/usr/local/bin/node_exporter').with('target' => '/opt/node_exporter-0.13.0.linux-amd64/node_exporter') }
end
end
end
Expand Down