From 9d47ae264dd27de7415b203043ca4c3042689d65 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Fri, 28 Dec 2018 04:20:36 -0500 Subject: start configuring munin --- manifests/tozt.pp | 1 + modules/certbot/files/bootstrap-certbot | 11 +++++-- modules/munin/files/master.conf | 1 + modules/munin/files/munin.conf | 1 + modules/munin/manifests/conf.pp | 5 +++ modules/munin/manifests/init.pp | 18 +++++++++++ modules/munin/manifests/node.pp | 12 +++++++ modules/munin/manifests/plugin.pp | 7 ++++ modules/munin/templates/node.conf | 3 ++ modules/tozt/files/nginx/munin-tls.conf | 15 +++++++++ modules/tozt/files/nginx/munin.conf | 10 ++++++ modules/tozt/manifests/munin.pp | 57 +++++++++++++++++++++++++++++++++ 12 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 modules/munin/files/master.conf create mode 100644 modules/munin/files/munin.conf create mode 100644 modules/munin/manifests/conf.pp create mode 100644 modules/munin/manifests/init.pp create mode 100644 modules/munin/manifests/node.pp create mode 100644 modules/munin/manifests/plugin.pp create mode 100644 modules/munin/templates/node.conf create mode 100644 modules/tozt/files/nginx/munin-tls.conf create mode 100644 modules/tozt/files/nginx/munin.conf create mode 100644 modules/tozt/manifests/munin.pp diff --git a/manifests/tozt.pp b/manifests/tozt.pp index cf84b6c..03ab460 100644 --- a/manifests/tozt.pp +++ b/manifests/tozt.pp @@ -10,6 +10,7 @@ node 'tozt', 'tozt.localdomain' { include tozt::backups include tozt::git + include tozt::munin include tozt::pass include tozt::paste include tozt::services diff --git a/modules/certbot/files/bootstrap-certbot b/modules/certbot/files/bootstrap-certbot index 5a563b2..1bfedac 100755 --- a/modules/certbot/files/bootstrap-certbot +++ b/modules/certbot/files/bootstrap-certbot @@ -62,6 +62,13 @@ http { root /tmp; } } + server { + listen 80; + server_name munin.tozt.net; + location / { + root /tmp; + } + } } EOF @@ -70,7 +77,7 @@ if [ -z "$is_running" ]; then fi if [ -z "$config_dir" ]; then - /usr/bin/certbot -n --agree-tos -m doy@tozt.net --nginx -d tozt.net -d blog.tozt.net -d paste.tozt.net -d git.tozt.net -d rss.tozt.net + /usr/bin/certbot -n --agree-tos -m doy@tozt.net --nginx -d tozt.net -d blog.tozt.net -d paste.tozt.net -d git.tozt.net -d rss.tozt.net -d munin.tozt.net else - /usr/bin/certbot -n --agree-tos -m doy@tozt.net --nginx -d tozt.net -d blog.tozt.net -d paste.tozt.net -d git.tozt.net -d rss.tozt.net --config-dir "$config_dir" + /usr/bin/certbot -n --agree-tos -m doy@tozt.net --nginx -d tozt.net -d blog.tozt.net -d paste.tozt.net -d git.tozt.net -d rss.tozt.net -d munin.tozt.net --config-dir "$config_dir" fi diff --git a/modules/munin/files/master.conf b/modules/munin/files/master.conf new file mode 100644 index 0000000..2f42957 --- /dev/null +++ b/modules/munin/files/master.conf @@ -0,0 +1 @@ +htmldir /srv/http/munin diff --git a/modules/munin/files/munin.conf b/modules/munin/files/munin.conf new file mode 100644 index 0000000..16d4983 --- /dev/null +++ b/modules/munin/files/munin.conf @@ -0,0 +1 @@ +includedir /etc/munin/munin-conf.d diff --git a/modules/munin/manifests/conf.pp b/modules/munin/manifests/conf.pp new file mode 100644 index 0000000..182d065 --- /dev/null +++ b/modules/munin/manifests/conf.pp @@ -0,0 +1,5 @@ +class munin::conf { + file { '/etc/munin/munin.conf': + source => 'puppet:///modules/munin/munin.conf'; + } +} diff --git a/modules/munin/manifests/init.pp b/modules/munin/manifests/init.pp new file mode 100644 index 0000000..26672d3 --- /dev/null +++ b/modules/munin/manifests/init.pp @@ -0,0 +1,18 @@ +class munin { + include munin::conf + + package { 'munin': + before => Class['munin::conf']; + } + + file { + '/srv/http/munin': + ensure => directory, + owner => 'munin', + group => 'munin', + require => Package['munin']; + '/etc/munin/munin-conf.d/master': + source => 'puppet:///modules/munin/master.conf', + require => Package['munin']; + } +} diff --git a/modules/munin/manifests/node.pp b/modules/munin/manifests/node.pp new file mode 100644 index 0000000..eca2080 --- /dev/null +++ b/modules/munin/manifests/node.pp @@ -0,0 +1,12 @@ +class munin::node { + include munin::conf + + package { 'munin-node': + before => Class['munin::conf']; + } + + file { '/etc/munin/munin-conf.d/node': + content => template('munin/node.conf'), + require => Package['munin-node']; + } +} diff --git a/modules/munin/manifests/plugin.pp b/modules/munin/manifests/plugin.pp new file mode 100644 index 0000000..09c2677 --- /dev/null +++ b/modules/munin/manifests/plugin.pp @@ -0,0 +1,7 @@ +define munin::plugin($source=$name) { + file { "/etc/munin/plugins/$name": + ensure => link, + target => "/usr/lib/munin/plugins/$source", + require => Package['munin-node']; + } +} diff --git a/modules/munin/templates/node.conf b/modules/munin/templates/node.conf new file mode 100644 index 0000000..12297d0 --- /dev/null +++ b/modules/munin/templates/node.conf @@ -0,0 +1,3 @@ +[<%= @hostname %>] + address 127.0.0.1 + use_node_name yes diff --git a/modules/tozt/files/nginx/munin-tls.conf b/modules/tozt/files/nginx/munin-tls.conf new file mode 100644 index 0000000..d73a602 --- /dev/null +++ b/modules/tozt/files/nginx/munin-tls.conf @@ -0,0 +1,15 @@ +server { + listen 443; + server_name munin.tozt.net; + + access_log /var/log/nginx/munin.access.log; + error_log /var/log/nginx/munin.error.log; + + include ssl; + + location / { + root /srv/http/munin; + try_files /site$uri /site$uri/index.html /public_html$uri =404; + } +} +# vim:ft=nginx diff --git a/modules/tozt/files/nginx/munin.conf b/modules/tozt/files/nginx/munin.conf new file mode 100644 index 0000000..982fe68 --- /dev/null +++ b/modules/tozt/files/nginx/munin.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name munin.tozt.net; + + access_log /var/log/nginx/munin.access.log; + error_log /var/log/nginx/munin.error.log; + + rewrite ^(.*) https://$host$1 permanent; +} +# vim:ft=nginx diff --git a/modules/tozt/manifests/munin.pp b/modules/tozt/manifests/munin.pp new file mode 100644 index 0000000..6a7eb22 --- /dev/null +++ b/modules/tozt/manifests/munin.pp @@ -0,0 +1,57 @@ +class tozt::munin { + include munin + include munin::node + + munin::plugin { + [ + 'cpu', + 'df', + 'df_inode', + 'entropy', + 'forks', + 'fw_packets', + 'interrupts', + 'irqstats', + 'load', + 'memory', + 'munin_stats', + 'ntp_kernel_err', + 'ntp_kernel_pll_freq', + 'ntp_kernel_pll_off', + 'ntp_offset', + 'open_files', + 'open_inodes', + 'proc_pri', + 'processes', + 'swap', + 'threads', + 'uptime', + 'users', + 'vmstat', + ]: + } + + munin::plugin { + [ + 'if_algo', + 'if_eth0', + ]: + source => 'if_', + } + + munin::plugin { + [ + 'if_err_algo', + 'if_err_eth0', + ]: + source => 'if_err_', + } + + nginx::site { + "munin-tls": + source => 'puppet:///modules/tozt/nginx/munin-tls.conf', + require => Class['certbot']; + "munin": + source => 'puppet:///modules/tozt/nginx/munin.conf'; + } +} -- cgit v1.2.3-54-g00ecf