1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 18:07:20 +00:00

Plugin-Gallery: get better 2nd level headings

This commit is contained in:
dipohl 2017-02-23 19:53:57 +01:00
parent 8481ea1566
commit f5b816df9e
25 changed files with 11 additions and 7 deletions

View file

@ -0,0 +1,54 @@
#!/bin/bash
#
# evaluate the current cpu usage of every vm running on this host
# separated by time spend in user mode and kernel mode
#
# Date: 2011-09-09
# Author: Gerald Schnabel ger@ldschnabel.de
#
# Usage: Place in /etc/munin/plugins (or link it there using ln -s)
#
# This plugin has to run with the same user like the VirtualBox Server rans
# Update munin plugin-conf.d/munin-node file with
# [virtualbox_*]
# user VIRTUAL_BOX_SERVER_USER
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Versions
# 2013-05-25 robi fix for handling vm names with dots and dashes; separate Kernel and User CPU graphs
# 2011-09-22 ger@ldschnabel.de fix for handling vm names with spaces and setup metric period to get values
# 2011-09-09 ger@ldschnabel.de initial version
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Kernel CPU used by virtual machines'
echo "graph_args --base 1000 -r --lower-limit 0 "
echo 'graph_vlabel %'
echo 'graph_scale no'
echo 'graph_info This graph shows the percentage of processor time spent in kernel mode by the every single VM process.'
echo 'graph_category Virtualization'
echo 'graph_period second'
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
echo "${VM_NAME_PRINT}_kernel.label ${VM_NAME}"
done
exit 0
fi
vboxmanage metrics setup --period 5 --samples 3
sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
vboxmanage metrics query "${VM_NAME}" CPU/Load/Kernel | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'''${VM_NAME_PRINT}'''_kernel.value \1/'
done

View file

@ -0,0 +1,54 @@
#!/bin/bash
#
# evaluate the current cpu usage of every vm running on this host
# separated by time spend in user mode and kernel mode
#
# Date: 2011-09-09
# Author: Gerald Schnabel ger@ldschnabel.de
#
# Usage: Place in /etc/munin/plugins (or link it there using ln -s)
#
# This plugin has to run with the same user like the VirtualBox Server rans
# Update munin plugin-conf.d/munin-node file with
# [virtualbox_cpu]
# user VIRTUAL_BOX_SERVER_USER
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Versions
# 2013-05-25 robi fix for handling vm names with dots and dashes; separate Kernel and User CPU graphs
# 2011-09-22 ger@ldschnabel.de fix for handling vm names with spaces and setup metric period to get values
# 2011-09-09 ger@ldschnabel.de initial version
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title User CPU used by virtual machines'
echo "graph_args --base 1000 -r --lower-limit 0 "
echo 'graph_vlabel %'
echo 'graph_scale no'
echo 'graph_info This graph shows the percentage of processor time spent in user mode by the every single VM process.'
echo 'graph_category Virtualization'
echo 'graph_period second'
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
echo "${VM_NAME_PRINT}_user.label ${VM_NAME}"
done
exit 0
fi
vboxmanage metrics setup --period 5 --samples 3
sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
vboxmanage metrics query "${VM_NAME}" CPU/Load/User | grep -E "^${VM_NAME}" | sed -r 's/^.*([0-9]+\.[0-9]+)%/'''${VM_NAME_PRINT}'''_user.value \1/'
done

View file

@ -0,0 +1,66 @@
#!/bin/bash
#
# evaluate the current ram usage of every vm running on this host
#
# Date: 2011-09-09
# Author: Gerald Schnabel ger@ldschnabel.de
#
# Usage: Place in /etc/munin/plugins (or link it there using ln -s)
#
# This plugin has to run with the same user like the VirtualBox Server rans
# Update munin plugin-conf.d/munin-node file with
# [virtualbox_ram]
# user VIRTUAL_BOX_SERVER_USER
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Versions
# 2013-05-25 robi fix for handling vm names with dots and dashes; scale graph size by the max memory available; display GB on scales and legend
# 2011-09-22 ger@ldschnabel.de fix for handling vm names with spaces and setup metric period to get values
# 2011-09-09 ger@ldschnabel.de initial version
# Todo: sort
# readarray -t sorted < <(printf '%s\0' "${array[@]}" | sort -z | xargs -0n1)
# see http://stackoverflow.com/questions/7442417/how-to-sort-an-array-in-bash
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
RAMTOT=`free -b | grep Mem | awk '{print $2}'`
echo 'graph_title Memory usage of virtual machines'
echo "graph_args --base 1024 -r --lower-limit 0 --upper-limit $RAMTOT --units-exponent 9"
echo 'graph_vlabel GB'
echo 'graph_info This graph shows the ram usage of every single VM process.'
echo 'graph_category Virtualization'
echo 'graph_period second'
I=0
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'`
echo "${VM_NAME_PRINT}.label ${VM_NAME}"
echo "${VM_NAME_PRINT}.cdef ${VM_NAME_PRINT},1024,*"
if [ ${I} -eq 0 ]; then
echo "${VM_NAME_PRINT}.draw AREA"
else
echo "${VM_NAME_PRINT}.draw STACK"
fi
I=$(( I + 1 ))
done
exit 0
fi
vboxmanage metrics setup --period 5 --samples 3
sleep 5
vboxmanage list vms | sed -r 's/^\"(.*)\" \{.*\}$/\1/' | while read VM_NAME; do
VM_NAME_PRINT=`echo -e "${VM_NAME}" | sed 's/[^A-Za-z0-9_]/_/g'` # s/[.]/_/g;s/[ ]/_/g;s/[-]/_/g
vboxmanage metrics query "${VM_NAME}" RAM/Usage/Used | grep -E "^${VM_NAME}" | sed -r 's/^.* ([0-9]+) kB$/'''${VM_NAME_PRINT}'''.value \1/'
done