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

Save with UNIX line endings

This commit is contained in:
Stig Sandbeck Mathisen 2014-10-04 21:52:28 +02:00
parent c03cd065c2
commit da59e03cf2
2 changed files with 109 additions and 109 deletions

View file

@ -1,92 +1,92 @@
#!/bin/bash #!/bin/bash
# #
#healthcheck on munin #healthcheck on munin
#check process and alert. #check process and alert.
# #
#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti #programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti
#LICENSE: NYSL (public domain) #LICENSE: NYSL (public domain)
# #
#config file #config file
# /etc/munin/plugin-conf.d/munin-node # /etc/munin/plugin-conf.d/munin-node
# #
#example minimum config #example minimum config
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#--------------------------------------------------- #---------------------------------------------------
# #
#chcek two process #chcek two process
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#env.process_2 samba #env.process_2 samba
#--------------------------------------------------- #---------------------------------------------------
# #
#chcek three process #chcek three process
#--------------------------------------------------- #---------------------------------------------------
#[healthcheck_process] #[healthcheck_process]
#env.process_1 httpd #env.process_1 httpd
#env.process_2 samba #env.process_2 samba
#env.process_3 mysqld #env.process_3 mysqld
#--------------------------------------------------- #---------------------------------------------------
# #
# #
# #
#edakari speed up. #edakari speed up.
CHECKMAX=`env | grep process_ | wc -l` CHECKMAX=`env | grep process_ | wc -l`
let CHECKMAX="$CHECKMAX + 1" let CHECKMAX="$CHECKMAX + 1"
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ $CHECKMAX -le 1 ]; then if [ $CHECKMAX -le 1 ]; then
echo no echo no
exit 1 exit 1
fi fi
echo yes echo yes
exit 0 exit 0
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo 'graph_title process memory Usage(MB)' echo 'graph_title process memory Usage(MB)'
echo "graph_args --base 1000 -l 0 --vertical-label MB" echo "graph_args --base 1000 -l 0 --vertical-label MB"
echo 'graph_scale no' echo 'graph_scale no'
echo 'graph_vlabel process memory' echo 'graph_vlabel process memory'
echo 'graph_category healthcheck' echo 'graph_category healthcheck'
echo 'graph_info This graph shows the Memory used by process' echo 'graph_info This graph shows the Memory used by process'
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval process=\$process_${I} eval process=\$process_${I}
eval alertmemory=\$alertmemory_${I} eval alertmemory=\$alertmemory_${I}
if [ "x${process}" = "x" ]; then if [ "x${process}" = "x" ]; then
continue continue
fi fi
echo "$process.label $process" echo "$process.label $process"
echo "$process.info Memory used by $process" echo "$process.info Memory used by $process"
echo "$process.draw LINE2" echo "$process.draw LINE2"
echo "$process.min -10" echo "$process.min -10"
echo "$process.critical 0:" echo "$process.critical 0:"
done done
exit 0 exit 0
fi fi
for(( I = 1; I < $CHECKMAX; ++I )) for(( I = 1; I < $CHECKMAX; ++I ))
do do
eval process=\$process_${I} eval process=\$process_${I}
if [ "x${process}" = "x" ]; then if [ "x${process}" = "x" ]; then
continue continue
fi fi
vrets=(`ps u --no-headers -C $process | awk 'BEGIN { count = 0 ; sum = 0; } { count ++ ; sum += $6/1024 ; } END { printf("%d %d\n",count,sum); }'`) vrets=(`ps u --no-headers -C $process | awk 'BEGIN { count = 0 ; sum = 0; } { count ++ ; sum += $6/1024 ; } END { printf("%d %d\n",count,sum); }'`)
count=${vrets[0]} count=${vrets[0]}
value=${vrets[1]} value=${vrets[1]}
if [ $count -le 0 ]; then if [ $count -le 0 ]; then
echo "$process.value -10" echo "$process.value -10"
echo "$process.extinfo process down" echo "$process.extinfo process down"
else else
echo "$process.value $value" echo "$process.value $value"
fi fi
done done

View file

@ -1,17 +1,17 @@
#!/bin/sh #!/bin/sh
RID=${0##*trafic_ro_} RID=${0##*trafic_ro_}
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo graph_title $V 24h visitors for $RID echo graph_title $V 24h visitors for $RID
echo 'graph_args --base 1000' echo 'graph_args --base 1000'
echo 'graph_vlabel vizitatori_ultimele_24_ore' echo 'graph_vlabel vizitatori_ultimele_24_ore'
echo 'graph_category Trafic_ro' echo 'graph_category Trafic_ro'
echo 'graph_info 24h visitors.' echo 'graph_info 24h visitors.'
echo "24h_visitors.label $RID" echo "24h_visitors.label $RID"
echo "24h_visitors.info 24H visitors for $RID" echo "24h_visitors.info 24H visitors for $RID"
echo '24h_visitors.draw LINE2' echo '24h_visitors.draw LINE2'
exit 0 exit 0
fi fi
VISITORS="$(echo '<doc><item>munin</item></doc>' | curl curl --silent -X POST -H 'Content-type: text/xml' -d @- http://api.trafic.ro/rest/0.01/sumar-site/$RID | xmlstarlet sel -t -m "/sumar-site/vizitatori_ultimele_24_ore" -v ".")" VISITORS="$(echo '<doc><item>munin</item></doc>' | curl curl --silent -X POST -H 'Content-type: text/xml' -d @- http://api.trafic.ro/rest/0.01/sumar-site/$RID | xmlstarlet sel -t -m "/sumar-site/vizitatori_ultimele_24_ore" -v ".")"
echo "24h_visitors.value" $VISITORS; echo "24h_visitors.value" $VISITORS;