disk
This commit is contained in:
parent
531d47d535
commit
c8d0b1dca7
1 changed files with 43 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
# - [ ] doku für munin mit ==HEAD usw.
|
||||
|
||||
|
||||
|
||||
# setze Variablen mit default-Werten
|
||||
ssh_user=${ssh_user:-user}
|
||||
ssh_password=${ssh_password:-password}
|
||||
|
@ -316,7 +317,43 @@ function get_memory_value {
|
|||
echo used_memory.value $(echo $mem_total-$mem_free| bc)
|
||||
}
|
||||
|
||||
#Kibibyte = Mebibyte x (8x1024x1024) / (8x1024)
|
||||
function get_disk_label {
|
||||
while read -r line; do
|
||||
echo $line | awk '/free-hdd-space:/{
|
||||
print "multigraph disk_graph_""'"$name"'";
|
||||
print "graph_title disk " "'"$name"'";
|
||||
print "graph_vlabel KiB";
|
||||
print "graph_category mikrotik";
|
||||
print "graph_args -l 0";
|
||||
print "total_disk.label total disk";
|
||||
print "used_disk.label used disk";
|
||||
print "free_disk.label free disk";
|
||||
print "graph_info Total, Used & free Disk space."}'
|
||||
# warning + crit
|
||||
|
||||
done <<< "$data"
|
||||
}
|
||||
function get_disk_value {
|
||||
if [ "$MUNIN_CAP_DIRTYCONFIG" = "0" ] || [ -z "$MUNIN_CAP_DIRTYCONFIG" ]; then
|
||||
echo multigraph disk_$name
|
||||
fi
|
||||
while read -r line; do
|
||||
echo $line | grep KiB | awk '/(free-hdd-space:)/ {
|
||||
gsub(/KiB/,"",$2)
|
||||
print free_disk.value $2 }'
|
||||
echo $line | grep MiB | awk '/(free-hdd-space:)/ {
|
||||
gsub(/MiB/,"",$2)
|
||||
print free_disk.value $2*1024}'
|
||||
echo $line | grep KiB | awk '/(total-hdd-space:)/ {
|
||||
gsub(/KiB/,"",$2)
|
||||
print total_disk.value $2 }'
|
||||
echo $line | grep MiB | awk '/(total-hdd-space:)/ {
|
||||
gsub(/MiB/,"",$2)
|
||||
print total_disk.value $2*1024}'
|
||||
done <<< "$data"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# rufe funktionen auf, reihenfolge ist wichtig
|
||||
check_sshpass
|
||||
|
@ -363,6 +400,10 @@ if [ "$1" = "config" ]; then
|
|||
if [ "$MUNIN_CAP_DIRTYCONFIG" = "1" ]; then
|
||||
get_memory_value
|
||||
fi
|
||||
get_disk_label
|
||||
if [ "$MUNIN_CAP_DIRTYCONFIG" = "1" ]; then
|
||||
get_disk_value
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
# wird nie aufgerufen wenn dirtyconfig gesetzt ist
|
||||
|
@ -374,6 +415,7 @@ get_write_sect_since_reboot_value
|
|||
get_temperature_value
|
||||
get_cpu_value
|
||||
get_memory_value
|
||||
get_disk_value
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue