From f78cff225b8d736385cafb84df4c12e0c51c226c Mon Sep 17 00:00:00 2001 From: Norman Date: Wed, 28 Jan 2015 16:10:44 +0100 Subject: [PATCH 1/4] Add Munin removed testing source fixed typo & dns oh cat more fixes forgot root more nginx stuff nginx munin.conf fix more fixes set dns record --- setup/munin.sh | 68 +++++++++++++++++++++++++++++++++++++++++++ setup/start.sh | 4 +++ tools/munin_update.sh | 22 ++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 setup/munin.sh create mode 100644 tools/munin_update.sh diff --git a/setup/munin.sh b/setup/munin.sh new file mode 100644 index 00000000..83cbb710 --- /dev/null +++ b/setup/munin.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Munin: resource monitoring tool +################################################# + +source setup/functions.sh # load our functions +source /etc/mailinabox.conf # load global vars + +# install Munin +apt_install munin munin-plugins-extra + +# edit config +cat > /etc/munin/munin.conf < /etc/nginx/conf.d/munin.conf </etc/nginx/htpasswd + +# write user:password +for i in "${!users_array[@]}"; do + echo "${users_array[i]}:${passwords_array[i]:14}" >> /etc/nginx/htpasswd +done From a9ed9ae93643170bd1bc9557e4dcab3d0c8fb4f3 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Mon, 25 May 2015 17:01:53 +0000 Subject: [PATCH 2/4] more work on munin * install the munin-node package * don't install munin-plugins-extra (if the user wants it they can add it) * expose the munin www directory via the management daemon so that it can handle authorization, rather than manintaining a separate password file --- conf/nginx-primaryonly.conf | 1 + management/daemon.py | 13 ++++++- setup/munin.sh | 68 +++++++++---------------------------- tools/munin_update.sh | 22 ------------ 4 files changed, 29 insertions(+), 75 deletions(-) mode change 100644 => 100755 setup/munin.sh delete mode 100644 tools/munin_update.sh diff --git a/conf/nginx-primaryonly.conf b/conf/nginx-primaryonly.conf index 2ad5d7d3..2b74b684 100644 --- a/conf/nginx-primaryonly.conf +++ b/conf/nginx-primaryonly.conf @@ -2,6 +2,7 @@ # Proxy /admin to our Python based control panel daemon. It is # listening on IPv4 only so use an IP address and not 'localhost'. rewrite ^/admin$ /admin/; + rewrite ^/admin/munin$ /admin/munin redirect; location /admin/ { proxy_pass http://127.0.0.1:10222/; proxy_set_header X-Forwarded-For $remote_addr; diff --git a/management/daemon.py b/management/daemon.py index 71159672..2cf0ec76 100755 --- a/management/daemon.py +++ b/management/daemon.py @@ -4,7 +4,7 @@ import os, os.path, re, json from functools import wraps -from flask import Flask, request, render_template, abort, Response +from flask import Flask, request, render_template, abort, Response, send_from_directory import auth, utils from mailconfig import get_mail_users, get_mail_users_ex, get_admins, add_mail_user, set_mail_password, remove_mail_user @@ -384,6 +384,17 @@ def backup_status(): from backup import backup_status return json_response(backup_status(env)) +# MUNIN + +@app.route('/munin/') +@app.route('/munin/') +@authorized_personnel_only +def munin(filename=""): + # Checks administrative access (@authorized_personnel_only) and then just proxies + # the request to static files. + if filename == "": filename = "index.html" + return send_from_directory("/var/cache/munin/www", filename) + # APP if __name__ == '__main__': diff --git a/setup/munin.sh b/setup/munin.sh old mode 100644 new mode 100755 index 83cbb710..8ee0ae5b --- a/setup/munin.sh +++ b/setup/munin.sh @@ -6,63 +6,27 @@ source setup/functions.sh # load our functions source /etc/mailinabox.conf # load global vars # install Munin -apt_install munin munin-plugins-extra +apt_install munin munin-node # edit config cat > /etc/munin/munin.conf < /etc/nginx/conf.d/munin.conf </etc/nginx/htpasswd - -# write user:password -for i in "${!users_array[@]}"; do - echo "${users_array[i]}:${passwords_array[i]:14}" >> /etc/nginx/htpasswd -done From 31d26a7badf9dc75a36caa17cf63c66c1929aa40 Mon Sep 17 00:00:00 2001 From: Norman Stanke Date: Tue, 26 May 2015 13:06:50 +0200 Subject: [PATCH 3/4] remove unnecessary source call --- setup/start.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup/start.sh b/setup/start.sh index a283335e..43a2e242 100755 --- a/setup/start.sh +++ b/setup/start.sh @@ -158,9 +158,6 @@ tools/web_update # If there aren't any mail users yet, create one. source setup/firstuser.sh -# Grant admins access to Munin -source tools/munin_update.sh - # Done. echo echo "-----------------------------------------------" From 9857db96cdc5badf55b4de6ce882fd20093b0b07 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sat, 6 Jun 2015 12:52:16 +0000 Subject: [PATCH 4/4] add a link to the /admin/munin page from the control panel nav bar --- management/templates/index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/templates/index.html b/management/templates/index.html index 4eceb2ed..78e2365f 100644 --- a/management/templates/index.html +++ b/management/templates/index.html @@ -98,9 +98,10 @@
  • SSL Certificates
  • Backup Status
  • - +
  • Custom DNS
  • External DNS
  • +
  • Munin Monitoring