57 lines
1.8 KiB
Bash
Executable file
57 lines
1.8 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_category system'
|
|
echo 'graph_title Munin'
|
|
echo 'graph_args --base 1000 --lower-limit 0 --rigid'
|
|
echo 'graph_vlabel Temps de traitement (s)'
|
|
echo 'update.label update'
|
|
echo 'update.draw AREA'
|
|
echo 'limits.label limits'
|
|
echo 'limits.draw STACK'
|
|
echo 'graph.label graph'
|
|
echo 'graph.draw STACK'
|
|
echo 'html.label html'
|
|
echo 'html.draw STACK'
|
|
echo 'total.label Total'
|
|
echo 'max.label Maximum'
|
|
echo 'total.warning 0:300'
|
|
echo 'update.critical 0:240'
|
|
exit 0
|
|
fi
|
|
|
|
LOGDIR="/var/log/munin/"
|
|
LOGBASE=$LOGDIR"munin-"
|
|
|
|
# Munin-update
|
|
echo -n "update.value "
|
|
time_update=$(grep -i finished $LOGBASE"update.log" | tail -n 1 | awk -F '(' '{print $2}' | awk '{print $1}' | bc -l)
|
|
echo $time_update
|
|
|
|
begin_limits=$(grep -i finished /var/log/munin/munin-update.log | tail -n 1 | awk '{print "date -d \""$1" "$2" "$3"\" +%s"}' | sh)
|
|
|
|
# Munin-limits
|
|
echo -n "limits.value "
|
|
end_limits=$(grep -i finished $LOGBASE"limits.log" | tail -n 1 | awk '{print "date -d \""$1" "$2" "$3"\" +%s"}' | sh)
|
|
time_limits=$(echo $end_limits"-"$begin_limits | bc -l)
|
|
echo $time_limits
|
|
|
|
# Munin-graph
|
|
echo -n "graph.value "
|
|
time_graph=$(grep -i finished $LOGBASE"graph.log" | tail -n 1 | awk -F '(' '{print $2}' | awk '{print $1}' | bc -l)
|
|
echo $time_graph
|
|
|
|
begin_html=$(grep -i finished /var/log/munin/munin-graph.log | tail -n 1 | awk '{print "date -d \""$1" "$2" "$3"\" +%s"}' | sh)
|
|
|
|
# Munin-html
|
|
echo -n "html.value "
|
|
end_html=$(grep -i finished $LOGBASE"html.log" | tail -n 1 | awk '{print "date -d \""$1" "$2" "$3"\" +%s"}' | sh)
|
|
time_html=$(echo $end_html"-"$begin_html | bc -l)
|
|
echo $time_html
|
|
|
|
echo -n "total.value "
|
|
echo $time_update"+"$time_limits"+"$time_graph"+"$time_html | bc -l
|
|
|
|
# Le temps de rafraîchissement de munin est de 5 minutes
|
|
echo "max.value 300"
|