Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9696290
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
11 KB
Subscribers
None
View Options
diff --git a/manifests/master.pp b/manifests/master.pp
index 5134264..e687996 100644
--- a/manifests/master.pp
+++ b/manifests/master.pp
@@ -1,135 +1,141 @@
# munin::master - Define a munin master
#
# The munin master will install munin, and collect all exported munin
# node definitions as files into /etc/munin/munin-conf.d/.
#
# Parameters:
#
# - node_definitions: A hash of node definitions used by
# create_resources to make static node definitions.
#
# - host_name: A host name for this munin master, matched with
# munin::node::mastername for collecting nodes. Defaults to $::fqdn
#
# - graph_strategy: 'cgi' (default) or 'cron'
# Controls if munin-graph graphs all services ('cron') or if graphing is done
# by munin-cgi-graph (which must configured seperatly)
#
# - html_strategy: 'cgi' (default) or 'cron'
# Controls if munin-html will recreate all html pages every run interval
# ('cron') or if html pages are generated by munin-cgi-graph (which must
# configured seperatly)
#
# - config_root: the root directory of the munin master configuration.
# Default: /etc/munin on most platforms.
#
# - collect_nodes: 'enabled' (default), 'disabled', 'mine' or
# 'unclaimed'. 'enabled' makes the munin master collect all exported
# node_definitions. 'disabled' disables it. 'mine' makes the munin
# master collect nodes matching $munin::master::host_name, while
# 'unclaimed' makes the munin master collect nodes not tagged with a
# host name.
#
# - dbdir: Path to the munin dbdir, where munin stores everything
#
# - htmldir: Path to where munin will generate HTML documents and
# graphs, used if graph_strategy is cron.
#
# - rundir: Path to directory munin uses for pid and lock files.
#
# - tls: 'enabled' or 'disabled' (default). Controls the use of TLS
# globally for master to node communications.
#
# - tls_certificate: Path to a file containing a TLS certificate. No
# default. Required if tls is enabled.
#
# - tls_private_key: Path to a file containing a TLS key. No default.
# Required if tls is enabled.
#
# - tls_verify_certificate: 'yes' (default) or 'no'.
#
# - extra_config: Extra lines of config to put in munin.conf.
class munin::master (
$node_definitions = $munin::params::master::node_definitions,
$graph_strategy = $munin::params::master::graph_strategy,
$html_strategy = $munin::params::master::html_strategy,
$config_root = $munin::params::master::config_root,
$collect_nodes = $munin::params::master::collect_nodes,
$dbdir = $munin::params::master::dbdir,
$htmldir = $munin::params::master::htmldir,
$logdir = $munin::params::master::logdir,
$rundir = $munin::params::master::rundir,
$tls = $munin::params::master::tls,
$tls_certificate = $munin::params::master::tls_certificate,
$tls_private_key = $munin::params::master::tls_private_key,
$tls_verify_certificate = $munin::params::master::tls_verify_certificate,
$host_name = $munin::params::master::host_name,
+ $file_group = $munin::params::master::file_group,
+ $munin_server_pkg = $munin::params::master::munin_server_pkg,
$extra_config = $munin::params::master::extra_config,
) inherits munin::params::master {
if $node_definitions {
validate_hash($node_definitions)
}
if $graph_strategy {
validate_re($graph_strategy, [ '^cgi$', '^cron$' ])
}
if $html_strategy {
validate_re($html_strategy, [ '^cgi$', '^cron$' ])
}
validate_re($collect_nodes, [ '^enabled$', '^disabled$', '^mine$',
'^unclaimed$' ])
validate_absolute_path($config_root)
validate_re($tls, [ '^enabled$', '^disabled$' ])
if $tls == 'enabled' {
validate_re($tls_verify_certificate, [ '^yes$', '^no$' ])
validate_absolute_path($tls_private_key)
validate_absolute_path($tls_certificate)
}
if $host_name {
validate_string($host_name)
if ! is_domain_name($host_name) {
fail('host_name should be a valid domain name')
}
}
+ validate_string($file_group)
+
+ validate_string($munin_server_pkg)
+
validate_array($extra_config)
# The munin package and configuration
- package { 'munin':
+ package { $munin_server_pkg:
ensure => latest,
}
File {
owner => 'root',
- group => 'root',
+ group => $file_group,
mode => '0644',
- require => Package['munin'],
+ require => Package[$munin_server_pkg],
}
file { "${config_root}/munin.conf":
content => template('munin/munin.conf.erb'),
}
file { "${config_root}/munin-conf.d":
ensure => directory,
recurse => true,
purge => true,
force => true,
}
if $collect_nodes != 'disabled' {
class { '::munin::master::collect':
collect_nodes => $collect_nodes,
host_name => $host_name,
}
}
# Create static node definitions
if $node_definitions {
create_resources(munin::master::node_definition, $node_definitions, {})
}
}
diff --git a/manifests/master/node_definition.pp b/manifests/master/node_definition.pp
index cc1d582..ea6c50e 100644
--- a/manifests/master/node_definition.pp
+++ b/manifests/master/node_definition.pp
@@ -1,35 +1,42 @@
# munin::master::node_definition - A node definition for the munin
# master.
#
# - title: The title of the defined resource should be a munin FQN,
# ('hostname', 'group;hostname', 'group;subgroup;hostname'). If a
# group is not set, munin will by default use the domain of the node
# as a group.
#
# Parameters
#
# - address: The address of the munin node. A hostname, an IP address,
# or a ssh:// uri for munin-async node. Required.
#
# - mastername: The name of the munin master server which will collect
# the node definition.
#
# - config: An array of configuration lines to be added to the node
# definition. Default is an empty array.
#
define munin::master::node_definition (
$address,
$mastername='',
$config=[],
)
{
+
+ include munin::params::master
+
+ $config_root = $munin::params::master::config_root
+
validate_string($address)
validate_array($config)
+ validate_string($config_root)
- $filename=sprintf('/etc/munin/munin-conf.d/node.%s.conf',
+ $filename=sprintf('%s/munin-conf.d/node.%s.conf',
+ $config_root,
regsubst($name, '[^[:alnum:]\.]', '_', 'IG'))
file { $filename:
content => template('munin/master/node.definition.conf.erb'),
}
}
diff --git a/manifests/params/master.pp b/manifests/params/master.pp
index 6590fdd..a819782 100644
--- a/manifests/params/master.pp
+++ b/manifests/params/master.pp
@@ -1,37 +1,43 @@
# Parameters for the munin::master class. Add support for new OS
# families here.
class munin::params::master {
$message = "Unsupported osfamily ${::osfamily}"
$graph_strategy = 'cgi'
$html_strategy = 'cgi'
$node_definitions = {}
$collect_nodes = 'enabled'
$dbdir = undef
$htmldir = undef
$logdir = undef
$rundir = undef
$tls = 'disabled'
$tls_certificate = undef
$tls_private_key = undef
$tls_verify_certificate = 'yes'
$extra_config = []
$host_name = $::fqdn
case $::osfamily {
'Archlinux',
'Debian',
'RedHat': {
- $config_root = '/etc/munin'
+ $config_root = '/etc/munin'
+ $file_group = 'root'
+ $munin_server_pkg = 'munin'
}
'Solaris': {
- $config_root = '/opt/local/etc/munin'
+ $config_root = '/opt/local/etc/munin'
+ $file_group = 'root'
+ $munin_server_pkg = 'munin'
}
- 'FreeBSD': {
- $config_root = '/usr/local/etc/munin'
+ 'DragonFly', 'FreeBSD': {
+ $config_root = '/usr/local/etc/munin'
+ $file_group = 'wheel'
+ $munin_server_pkg = 'munin-master'
}
default: {
fail($message)
}
}
}
diff --git a/manifests/params/node.pp b/manifests/params/node.pp
index 729ad97..2af6a0b 100644
--- a/manifests/params/node.pp
+++ b/manifests/params/node.pp
@@ -1,80 +1,78 @@
# Parameters for the munin::node class. Add support for new OS
# families here.
class munin::params::node {
$message = "Unsupported osfamily: ${::osfamily}"
$address = $::fqdn
$host_name = $::fqdn
$bind_address = '*'
$bind_port = 4949
$allow = []
$masterconfig = []
$mastergroup = undef
$mastername = undef
$nodeconfig = []
$plugins = {}
$service_ensure = undef
$export_node = 'enabled'
$log_file = 'munin-node.log'
$log_destination = 'file'
$syslog_facility = undef
$purge_configs = false
$timeout = undef
case $::osfamily {
'Archlinux',
'RedHat': {
$config_root = '/etc/munin'
$log_dir = '/var/log/munin-node'
$service_name = 'munin-node'
$package_name = 'munin-node'
$plugin_share_dir = '/usr/share/munin/plugins'
$file_group = 'root'
}
'Debian': {
$config_root = '/etc/munin'
$log_dir = '/var/log/munin'
$service_name = 'munin-node'
$package_name = 'munin-node'
$plugin_share_dir = '/usr/share/munin/plugins'
$file_group = 'root'
}
'Solaris': {
case $::operatingsystem {
'SmartOS': {
$config_root = '/opt/local/etc/munin'
$log_dir = '/var/opt/log/munin'
$service_name = 'smf:/munin-node'
$package_name = 'munin-node'
$plugin_share_dir = '/opt/local/share/munin/plugins'
$file_group = 'root'
}
default: {
fail("Unsupported operatingsystem ${::operatingsystem} for osfamily ${::osfamily}")
}
}
}
'FreeBSD', 'DragonFly': {
$config_root = '/usr/local/etc/munin'
$log_dir = '/var/log/munin'
$service_name = 'munin-node'
$package_name = 'munin-node'
$plugin_share_dir = '/usr/local/share/munin/plugins'
$file_group = 'wheel'
}
'OpenBSD': {
$config_root = '/etc/munin'
$log_dir = '/var/log/munin'
$service_name = 'munin_node'
$package_name = 'munin-node'
$plugin_share_dir = '/usr/local/libexec/munin/plugins'
$file_group = 'wheel'
}
default: {
fail($message)
}
}
}
-
-
diff --git a/templates/munin.conf.erb b/templates/munin.conf.erb
index 29f47de..2ae7ff2 100644
--- a/templates/munin.conf.erb
+++ b/templates/munin.conf.erb
@@ -1,37 +1,37 @@
# /etc/munin/munin.conf - Configuration file for the munin master
#
# This file is handled by puppet, all local modifications will be lost
<% if @dbdir -%>
dbdir <%= @dbdir %>
<% end -%>
<% if @htmldir -%>
htmldir <%= @htmldir %>
<% end -%>
<% if @logdir -%>
logdir <%= @logdir %>
<% end -%>
<% if @rundir -%>
rundir <%= @rundir %>
<% end -%>
<% if @html_strategy -%>
html_strategy <%= @html_strategy %>
<% end -%>
<% if @graph_strategy -%>
graph_strategy <%= @graph_strategy %>
<% end -%>
<% if @tls == 'enabled' -%>
tls = <%= @tls %>
tls_certificate = <%= @tls_certificate %>
tls_private_key = <%= @tls_private_key %>
tls_verify_certificate = <%= @tls_verify_certificate %>
<% end -%>
<% if @extra_config -%>
<% @extra_config.each do |this| -%>
<%= this %>
<% end -%>
<% end -%>
# Where to look for puppet generated munin master configuration.
-includedir /etc/munin/munin-conf.d
+includedir <%= @config_root -%>/munin-conf.d
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Aug 18, 7:43 PM (1 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3325683
Attached To
rSPMUN puppet-ssm-munin
Event Timeline
Log In to Comment