FreeBSD Munin und Apache24

FreeBSD Munin + Apache24

Apache 2.4 Config für Munin. Wichtig ist auch das www nach /var/log/munin/munin-cgi-graph.log schreiben darf. Das funktioniert auch in einem Alias (siehe die ausdokumentierte Zeile).

#################################################################
# munin
#################################################################
#Alias "/munin" "/usr/local/www/munin/"

<Directory "/usr/local/www/munin/">
    Require all granted
    Options +Indexes +ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
    ExpiresActive On
    ExpiresDefault M310
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/local/www/cgi-bin/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
    Require all granted
    Options +Indexes +ExecCGI
    SetHandler cgi-script
</Location>

Alias /munin-cgi/static /var/cache/munin/www/static
ScriptAlias /munin-cgi /usr/local/www/cgi-bin/munin-cgi-html
<Location /munin-cgi>
    Require all granted
    Options +Indexes +ExecCGI
    SetHandler cgi-script

    Options +Indexes +ExecCGI
</Location>
</code>

CPU Temperatur

cat /usr/local/etc/munin/plugins/cputemp

#!/bin/sh
case $1 in
    config)
        cat <<'EOM'
graph_title CPU Temperature
graph_vlabel Temerature (C)
graph_scale no
graph_args --base 1000 -l 0
graph_category hardware
EOM
    temps=`sysctl -a | grep cpu | grep temperature | cut -f 1 -d ':' | sed "s/\./_/g" | sort`
    CPU=0
    for t in $temps; do
        echo "${t}.label " CPU ${CPU}
        echo "${t}.warning 90"
        echo "${t}.critical 100"
        CPU=$((${CPU}+1))
    done

    exit 0;;
esac

temps=`sysctl -a | grep cpu | grep temperature | cut -f 1 -d ':' |  sort`
for t in $temps; do
    v=`sysctl ${t} | cut -f 2 -d ':' | sed "s/C//g"`
    t2=`echo ${t} | sed "s/\./_/g"`
    echo "${t2}.value "${v}
done

Netzteil Spannungen mit xmbmon

cat /usr/local/etc/munin/plugins/voltages
#!/bin/sh
case $1 in
    config)
    cat <<'EOM'
graph_title Voltages
graph_vlabel Volt
graph_scale no
graph_args --base 1000 -l 0
graph_category hardware
EOM
    volts=`mbmon -A -c 1 -r | egrep 'V' | sed "s/ //g" | cut -f 1 -d ':' | sort`
    for v in $volts; do
        echo "${v}.label" ${v}
    done

    exit 0;;
esac


volts=`mbmon -A -c 1 -r | egrep 'V' | sed "s/ //g" | sort`
for v in $volts; do
    label=`printf $v | cut -f 1 -d ':'`
    value=`printf $v | cut -f 2 -d ':' | sed "s/+//g"`
    echo "${label}.value ${value}"
done