feature to create/add graphitewriter configurtion
Signed-off-by: Nick Chappell <nick@intronic.org> Taken from: https://github.com/Icinga/puppet-icinga2/pull/24
This commit is contained in:
parent
8671d25f98
commit
2e8770f9cb
3 changed files with 62 additions and 0 deletions
17
README.md
17
README.md
|
@ -472,6 +472,23 @@ icinga2::object::hostgroup { 'admins':
|
|||
}
|
||||
</pre>
|
||||
|
||||
####[`icinga2::object::graphitewriter`](id:object_graphitewriter)
|
||||
|
||||
This defined type creates an **GraphiteWriter** object
|
||||
|
||||
Though you can create the file anywhere and with any name via the target_dir and target_file_name parameters, you should set the target_dir parameter to /etc/icinga2/features-enabled, as that's where Icinga 2 will look for graphitewriter connection objects by default.
|
||||
|
||||
Example Usage:
|
||||
|
||||
````
|
||||
icinga2::object::graphitewriter { 'graphite_relay':
|
||||
target_dir => '/etc/icinga2/features-enabled',
|
||||
target_file_name => 'graphite.conf',
|
||||
graphite_host => '127.0.0.1',
|
||||
graphite_port => 2003,
|
||||
}
|
||||
````
|
||||
|
||||
[Reference](id:reference)
|
||||
---------
|
||||
|
||||
|
|
23
manifests/object/graphitewriter.pp
Normal file
23
manifests/object/graphitewriter.pp
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Configure GraphiteWriter Feature .conf file
|
||||
define icinga2::object::graphitewriter (
|
||||
$graphite_host = '127.0.0.1',
|
||||
$graphite_port = 2003,
|
||||
$target_dir = '/etc/icinga2/features-available',
|
||||
$target_file_name = "${name}.conf",
|
||||
$target_file_owner = 'root',
|
||||
$target_file_group = 'root',
|
||||
$target_file_mode = '0644'
|
||||
) {
|
||||
|
||||
#Do some validation
|
||||
validate_string($host)
|
||||
|
||||
file {"${target_dir}/${target_file_name}":
|
||||
ensure => file,
|
||||
owner => $target_file_owner,
|
||||
group => $target_file_group,
|
||||
mode => $target_file_mode,
|
||||
content => template('icinga2/object_graphitewriter.conf.erb'),
|
||||
notify => Service['icinga2'],
|
||||
}
|
||||
}
|
22
templates/object_graphitewriter.conf.erb
Normal file
22
templates/object_graphitewriter.conf.erb
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
* WARNING: This GraphiteWriter definition is automatically generated by Puppet.
|
||||
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||
*/
|
||||
|
||||
/**
|
||||
* The GraphiteWriter type writes check result metrics and
|
||||
* performance data to a graphite tcp socket.
|
||||
*/
|
||||
|
||||
library "perfdata"
|
||||
|
||||
object GraphiteWriter "graphite" {
|
||||
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||
<%- if @graphite_host -%>
|
||||
<%#- Otherwise, include the parameter: -%>
|
||||
host = "<%= @graphite_host -%>"
|
||||
<%- end -%>
|
||||
<%- if @graphite_port -%>
|
||||
port = <%= @graphite_port %>
|
||||
<%- end -%>
|
||||
}
|
Loading…
Reference in a new issue