Internal Configuring munin-node

From GrandCare Systems
Jump to navigation Jump to search

Installation

# apt-get install munin-node munin-plugins-extra

Client Configuration

Shorewall

Edit /etc/shorewall/rules

Add the following lines:

# Munin Master
ACCEPT net:184.106.169.5        $FW     tcp     4949

Restart shorewall:

# /etc/init.d/shorewall restart

Munin-node

Edit /etc/munin/munin-node.conf

Change the allow ACL to

allow ^184\.106\.169\.5$

Symlink any additional plugins in /usr/share/munin/plugins to /etc/munin/plugins

Restart munin-node:

# /etc/init.d/munin-node restart

Server Configuration

Edit /etc/munin/munin.conf on cloud-www and add a host block:

[host.name.com]
   address host.name.com
   use_node_name yes

Plugins

MySQL

  1. symlink /usr/share/munin/plugins/mysql_* to /etc/munin/plugins
  2. remove /etc/munin/plugins/mysql_isam*
  3. Edit /etc/munin/plugin-conf.d/munin-node and add:
[mysql_innodb]
env.warning 0
env.critical 0

Apache

This plugin is enabled by default. Make sure ExtendedStatus On' is set in /etc/apache/mods-enabled/status.conf

OpenVPN on GCManage Servers

Save below as /etc/munin/plugins/openvpn and make executable

#!/usr/bin/perl
use strict;

my $statuslogfile = $ENV{'statusfile'} || '/etc/openvpn/openvpn-status-1.log';

if($ARGV[0] and $ARGV[0] eq "autoconf" ) {
  if(-f $statuslogfile) {
	if(-r $statuslogfile) {
	    print "yes\n";
	    exit 0;
	} else {
	    print "no (logfile not readable)\n";
	}
    } else {
	print "no (logfile not found)\n";
    }
    exit 0;
}

if ($ARGV[0] and $ARGV[0] eq "config" ){
    print "graph_title OpenVpn\n";
    print "graph_args --base 1000 -l 0\n";
    print "graph_scale yes\n";
    print "graph_vlabel users\n";
    print "graph_category network\n";
    print "graph_info This graph shows the numbers of users connected to openvpn servers.\n";
    print "server1.label users port 11194\n";
    print "server1.info The number of users connected to openvpn server at port 11194\n";
    print "server1.draw AREASTACK\n";
    print "server2.label users port 11195\n";
    print "server2.info The number of users connected to openvpn server at port 11195\n";
    print "server2.draw AREASTACK\n";
    print "server3.label users port 11196\n";
    print "server3.info The number of users connected to openvpn server at port 11196\n";
    print "server3.draw AREASTACK\n";
    print "server4.label users port 11197\n";
    print "server4.info The number of users connected to openvpn server at port 11197\n";
    print "server4.draw AREASTACK\n";

    exit 0;
}

for(my $i = 1; $i <= 4; $i++) {
	my $users = 0;
	if (-f "$statuslogfile") {
	    open(IN, "/etc/openvpn/openvpn-status-" . $i . ".log") or exit 4;
	    my $flagu = 0;
	    while(<IN>) {
		if(/^ROUTING TABLE$/) {
		    $flagu = 0;
		}
		if ($flagu) {
		    $users = $users + 1;
		}
		if(/^Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since$/) {
		    $flagu = 1;
		}
	    }
	    close(IN);
	}

	print "server" . $i . ".value " . $users."\n";
}

Then add:

[openvpn]
user root

to /etc/munin/plugin-conf.d/munin-node