Page MenuHomeSoftware Heritage

No OneTemporary

diff --git a/manifests/node.pp b/manifests/node.pp
index 819422d..1b3d4ac 100644
--- a/manifests/node.pp
+++ b/manifests/node.pp
@@ -1,69 +1,73 @@
# munin::node - Configure a munin node, and export configuration a
# munin master can collect.
#
# Parameters:
#
# - allow: List of IPv4 and IPv6 addresses and networks to allow to
# connect.
#
+include munin::params
+
class munin::node (
$allow=['127.0.0.1'],
$nodeconfig=[],
$masterconfig=[],
$mastergroup='',
$plugins={},
$address=$::fqdn,
$config_root='/etc/munin',
$service_name='munin-node',
+ $log_file = $munin::params::log_file,
)
{
validate_array($allow)
validate_array($nodeconfig)
validate_array($masterconfig)
validate_string($mastergroup)
validate_hash($plugins)
validate_string($address)
validate_absolute_path($config_root)
validate_string($service_name)
if $mastergroup {
$fqn = "${mastergroup};${::fqdn}"
}
else {
$fqn = $::fqdn
}
# Defaults
File {
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
}
package { 'munin-node':
ensure => installed,
}
service { $service_name:
enable => true,
require => Package['munin-node'],
}
+
file { "${config_root}/munin-node.conf":
content => template('munin/munin-node.conf.erb'),
require => Package['munin-node'],
notify => Service[$service_name],
}
# Export a node definition to be collected by the munin master
@@munin::master::node_definition{ $fqn:
address => $address,
config => $masterconfig,
}
# Generate plugin resources from hiera or class parameter.
create_resources(munin::plugin, $plugins, {})
}
diff --git a/manifests/node_params.pp b/manifests/node_params.pp
new file mode 100644
index 0000000..e0b9d4e
--- /dev/null
+++ b/manifests/node_params.pp
@@ -0,0 +1,15 @@
+# Class: munin::node::params
+#
+class munin::node::params {
+ case $::osfamily {
+ RedHat: {
+ $logfile = '/var/log/munin-node/munin-node.log'
+ }
+ Debian: {
+ $logfile = '/var/log/munin/munin-node.log'
+ }
+ default: {
+ fail("Unsupported osfamily: ${::osfamily} The munin:node module only supports osfamily Debian or RedHat (slaves only).")
+ }
+ }
+}
diff --git a/manifests/params.pp b/manifests/params.pp
new file mode 100644
index 0000000..9833b7b
--- /dev/null
+++ b/manifests/params.pp
@@ -0,0 +1,15 @@
+# Class: munin::params
+#
+class munin::params {
+ case $::osfamily {
+ RedHat: {
+ $log_file = '/var/log/munin-node/munin-node.log'
+ }
+ Debian: {
+ $log_file = '/var/log/munin/munin-node.log'
+ }
+ default: {
+ fail("Unsupported osfamily: ${::osfamily} The munin:params module only supports osfamily Debian or RedHat (slaves only).")
+ }
+ }
+}
diff --git a/templates/munin-node.conf.erb b/templates/munin-node.conf.erb
index cfb2e35..cc97d2d 100644
--- a/templates/munin-node.conf.erb
+++ b/templates/munin-node.conf.erb
@@ -1,40 +1,40 @@
# /etc/munin/munin-node.conf - config-file for munin-node
#
# This file is handled by puppet, any local changes will be lost
#
host_name <%= fqdn %>
log_level 4
-log_file /var/log/munin/munin-node.log
+log_file <%= log_file %>
port 4949
pid_file /var/run/munin/munin-node.pid
background 1
setsid 1
# Which port to bind to;
user root
group root
# Regexps for files to ignore
ignore_file ~$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.puppet-bak$
# Hosts to allow
<% Array(allow).flatten.each do |line| -%>
<% if line.match(/^\d+\.\d+\.\d+\.\d+$/) -%>
<%= line.gsub(".", "\\.").sub(/^/, "allow ^").sub(/$/, "$") %>
<% elsif line.match(/^\d+\.\d+\.\d+\.\d+\/\d+$/) -%>
<%= line.sub(/^/, "cidr_allow ") %>
<% end -%>
<% end -%>
<% Array(nodeconfig).each do |line| -%>
<%= line %>
<% end -%>

File Metadata

Mime Type
text/x-diff
Expires
Mon, Aug 18, 7:38 PM (6 d, 8 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3327147

Event Timeline