forked from KrisBuytaert/puppet-graphite
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:nhuff/puppet-graphite into develop
- Loading branch information
Showing
10 changed files
with
181 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
name 'KrisBuytaert-graphite' | ||
version '0.98.14' | ||
version '0.98.15' | ||
source 'github' | ||
author 'Kris Buytaert' | ||
license 'GPL' | ||
summary 'This module installs and configures graphite' | ||
project_page '' | ||
|
||
## Add dependencies, if any: | ||
# dependency 'username/name', '>= 1.2.0' | ||
dependency 'ripienaar/concat', '>= 0.1.0' |
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 |
---|---|---|
@@ -1,9 +1,24 @@ | ||
define graphite::carbon::storage ( $pattern,$retentions){ | ||
# Define: graphite::carbon::storage | ||
# | ||
# Add a storage schema entry to carbon | ||
# | ||
# Parameters: | ||
# pattern : Metric pattern to match (required) | ||
# retentions: Retention rules for the metric as a string (required) | ||
# order : Order the rules appear in the schema file (default=10) | ||
# | ||
# Example: | ||
# | ||
# graphite::carbon::storage{'default_1min_for_1day': | ||
# pattern => '.*', | ||
# retentions => '60s:1d', | ||
# } | ||
# | ||
define graphite::carbon::storage ( $pattern,$retentions,$order=10){ | ||
concat::fragment {$name: | ||
target => '/etc/carbon/storage-schemas.conf', | ||
order => 10, | ||
target => $graphite::r_schema_file, | ||
order => $order, | ||
content => template('graphite/storage-schemas.erb'), | ||
notify => Service['carbon'] | ||
} | ||
|
||
} |
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
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,42 @@ | ||
require 'spec_helper' | ||
|
||
describe 'graphite' do | ||
let(:facts) {{:concat_basedir => '/var/lib/puppet/concat'}} | ||
context 'Default' do | ||
it { | ||
should contain_package('carbon') | ||
should contain_package('whisper') | ||
should contain_package('graphite-web') | ||
should contain_file('local_settings.py'). | ||
with_content(/#TIME_ZONE = 'America\/Los_Angeles'/). | ||
with_path('/etc/graphite-web/local_settings.py') | ||
should contain_concat('/etc/carbon/storage-schemas.conf') | ||
} | ||
end | ||
|
||
context 'With local_settings_file =>' do | ||
let(:params) {{ | ||
:local_settings_file => '/opt/graphite/webapp/graphite/local_settings.py' | ||
}} | ||
it { | ||
should contain_file('local_settings.py'). | ||
with_path('/opt/graphite/webapp/graphite/local_settings.py') | ||
} | ||
end | ||
context 'with schema_file =>' do | ||
let(:params) {{ | ||
:schema_file => '/opt/graphite/conf/storage-schemas.conf' | ||
}} | ||
it { | ||
should contain_concat('/opt/graphite/conf/storage-schemas.conf') | ||
} | ||
end | ||
context 'with time_zone =>' do | ||
let (:params) {{ :time_zone => 'America/Chicago' }} | ||
|
||
it { | ||
should contain_file('local_settings.py'). | ||
with_content(/TIME_ZONE = 'America\/Chicago/) | ||
} | ||
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,52 @@ | ||
require 'spec_helper' | ||
|
||
describe 'graphite::carbon::storage' do | ||
let (:facts) {{ :concat_basedir => '/var/lib/puppet/concat' }} | ||
context 'Default' do | ||
let (:pre_condition) {'include graphite'} | ||
let (:title) {'graphite-default'} | ||
let (:params) {{ | ||
:pattern => '.*', | ||
:retentions => '60s:1d' | ||
}} | ||
|
||
it { | ||
should contain_concat__fragment('graphite-default').with( | ||
'target' => '/etc/carbon/storage-schemas.conf', | ||
'content' => /\[graphite-default\]\s+pattern = \.\*\s+retentions = 60s:1d/m, | ||
'order' => 10 | ||
) | ||
} | ||
end | ||
context 'with schema_file =>' do | ||
let (:pre_condition) {"class {'graphite': schema_file => '/storage-schemas.conf'}"} | ||
let (:title) {'graphite-default'} | ||
let (:params) {{ | ||
:pattern => '.*', | ||
:retentions => '60s:1d' | ||
}} | ||
|
||
it { | ||
should contain_concat__fragment('graphite-default').with( | ||
'target' => '/storage-schemas.conf', | ||
'content' => /\[graphite-default\]\s+pattern = \.\*\s+retentions = 60s:1d/m | ||
) | ||
} | ||
end | ||
context 'with order =>' do | ||
let (:pre_condition) {'include graphite'} | ||
let (:title) {'graphite-default'} | ||
let (:params) {{ | ||
:pattern => '.*', | ||
:retentions => '60s:1d', | ||
:order => 99, | ||
}} | ||
|
||
it { | ||
should contain_concat__fragment('graphite-default').with( | ||
'order' => 99 | ||
) | ||
} | ||
end | ||
|
||
end |