Änderungen

Wechseln zu: Navigation, Suche

Munin - memory-easy

1.234 Byte hinzugefügt, 08:29, 21. Sep. 2014
[[Datei:Memory easy-day.png]]

== Code ==

<pre>#!/bin/bash
#
# Plugin for Memory
#
# by Marvin Huebel
# http://www.nevakee.de
#
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log$
#
#%# family=auto
#%# capabilities=autoconf

ALL=`free -o -b | tail -n 2 | head -1 | awk '{print $2}'`
USED=`free -b | tail -n 2 | head -1 | awk '{print $3}'`
FREE=`free -b | tail -n 2 | head -1 | awk '{print $4}'`
SWAP=`free -o -b | tail -n 1 | head -1 | awk '{print $3}'`

if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi

if [ "$1" = "config" ]; then
echo "graph_args --base 1024k -l 0 --upper-limit $ALL";
echo "graph_vlabel Bytes";
echo "graph_title Memory usage";
echo "graph_category system";
echo "graph_info This graph shows what the machine uses memory for.";

echo "used.label used";
echo "used.draw AREA";
echo "used.info Memory used.";

echo "free.label free";
echo "free.draw STACK";
echo "free.info Free memory.";

echo "swap.label swap";
echo "swap.draw STACK";
echo "swap.info swap used.";

exit 0
fi
echo "used.value $USED";
echo "free.value $FREE";
echo "swap.value $SWAP";

exit 0
</pre>

[[Kategorie:Software]]
495
Bearbeitungen