Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to remove graphite_prefix and graphite_suffix from config file #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
# String. The config file's group. Should be pe_puppet for Puppet Enterprise.
# Default: puppet
#
# [*graphite_prefix*]
# String. Prefix added to the metric name before hostname.
# When set to undef of 'absent' it's not added to config file.
# Default: undef
#
# [*graphite_suffix*]
# String. Suffix added to the metric name after hostname.
# When set to undef of 'absent' it's not added to config file.
# Default: 'puppet'
#
# [*graphite_reverse_hostname*]
# Boolean. When true the hostname is reversed in metric name.
# Default: true
#
#
# === Examples
#
Expand Down
4 changes: 4 additions & 0 deletions templates/graphite.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
:graphite_server: <%= scope.lookupvar('graphite_host') %>
:graphite_port: <%= scope.lookupvar('graphite_port') %>
<% if ![nil, :undef, 'absent'].include?(scope.lookupvar('graphite_prefix')) -%>
:graphite_prefix: <%= scope.lookupvar('graphite_prefix') %>
<% end -%>
<% if ![nil, :undef, 'absent'].include?(scope.lookupvar('graphite_suffix')) -%>
:graphite_suffix: <%= scope.lookupvar('graphite_suffix') %>
<% end -%>
:graphite_reverse_hostname: <%= scope.lookupvar('graphite_reverse_hostname') %>