mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Update unicorn_
- Fixed memory and average giving same results - Fixed error in average graphing
This commit is contained in:
parent
2812f751f0
commit
8ff6e0fdf2
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com)
|
# Copyright (c) 2013 Gareth Davies (shaolintiger@gmail.com www.shaolintiger.com)
|
||||||
# License GPLv2
|
# License GPLv2
|
||||||
@ -14,15 +13,23 @@ fi
|
|||||||
|
|
||||||
if [ "$mode" = "memory" ]; then
|
if [ "$mode" = "memory" ]; then
|
||||||
if [ "$1" = "config" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo "graph_title Unicorn Memory"
|
echo "graph_title Total Unicorn Memory"
|
||||||
echo "graph_vlabel RAM"
|
echo "graph_vlabel Total RAM"
|
||||||
echo "graph_category Unicorn"
|
echo "graph_category Unicorn"
|
||||||
echo "graph_args --base 1024"
|
echo "graph_args --base 1024"
|
||||||
echo "ram.label RAM"
|
echo "ram.label Total RAM"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo -n "ram.value "
|
|
||||||
ps awwwux | grep 'unicorn worker' | grep -v grep | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}'
|
memory_array=(`ps auwx | grep "unicorn worker" | grep -v grep | awk '{print $6 }'`)
|
||||||
|
|
||||||
|
for i in "${memory_array[@]}"
|
||||||
|
do
|
||||||
|
sum=$(( $sum + $i ))
|
||||||
|
done
|
||||||
|
echo -n "ram.value "
|
||||||
|
echo $sum
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$mode" = "processes" ]; then
|
elif [ "$mode" = "processes" ]; then
|
||||||
@ -38,14 +45,14 @@ elif [ "$mode" = "processes" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
elif [ "$mode" = "average" ]; then
|
elif [ "$mode" = "average" ]; then
|
||||||
if [ "$1" = "average" ]; then
|
if [ "$1" = "config" ]; then
|
||||||
echo 'graph_title Unicorn Average Process Size'
|
echo 'graph_title Unicorn Average Process Size'
|
||||||
echo 'graph_args --base 1024 -l 0 '
|
echo 'graph_args --base 1024 -l 0 '
|
||||||
echo 'graph_vlabel Unicorn Average Process Size'
|
echo 'graph_vlabel Unicorn Average Process Size'
|
||||||
echo 'graph_category Unicorn'
|
echo 'graph_category Unicorn'
|
||||||
echo 'php_average.label Unicorn Average Proccess Size'
|
echo 'unicorn_average.label Unicorn Average Proccess Size'
|
||||||
echo 'php_average.draw LINE2'
|
echo 'unicorn_average.draw LINE2'
|
||||||
echo 'php_average.info The average process size for Unicorn'
|
echo 'unicorn_average.info The average process size for Unicorn'
|
||||||
else
|
else
|
||||||
echo -n "average.value "
|
echo -n "average.value "
|
||||||
ps awwwux | grep 'unicorn worker' | grep -v grep | grep -v master | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}'
|
ps awwwux | grep 'unicorn worker' | grep -v grep | grep -v master | awk '{total_mem = $6 * 1024 + total_mem; total_proc++} END{printf("%d\n", total_mem / total_proc)}'
|
||||||
@ -54,3 +61,4 @@ elif [ "$mode" = "average" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user