From da59e03cf2433110434ec9bb7bda39434045b74e Mon Sep 17 00:00:00 2001 From: Stig Sandbeck Mathisen Date: Sat, 4 Oct 2014 21:52:28 +0200 Subject: [PATCH] Save with UNIX line endings --- plugins/healthcheck/healthcheck_process | 184 ++++++++++++------------ plugins/trafic_ro/trafic_ro_24h | 34 ++--- 2 files changed, 109 insertions(+), 109 deletions(-) diff --git a/plugins/healthcheck/healthcheck_process b/plugins/healthcheck/healthcheck_process index 1d8863bd..7e5edc3d 100755 --- a/plugins/healthcheck/healthcheck_process +++ b/plugins/healthcheck/healthcheck_process @@ -1,92 +1,92 @@ -#!/bin/bash -# -#healthcheck on munin -#check process and alert. -# -#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti -#LICENSE: NYSL (public domain) -# -#config file -# /etc/munin/plugin-conf.d/munin-node -# -#example minimum config -#--------------------------------------------------- -#[healthcheck_process] -#env.process_1 httpd -#--------------------------------------------------- -# -#chcek two process -#--------------------------------------------------- -#[healthcheck_process] -#env.process_1 httpd -#env.process_2 samba -#--------------------------------------------------- -# -#chcek three process -#--------------------------------------------------- -#[healthcheck_process] -#env.process_1 httpd -#env.process_2 samba -#env.process_3 mysqld -#--------------------------------------------------- -# -# -# - -#edakari speed up. -CHECKMAX=`env | grep process_ | wc -l` -let CHECKMAX="$CHECKMAX + 1" - -if [ "$1" = "autoconf" ]; then - if [ $CHECKMAX -le 1 ]; then - echo no - exit 1 - fi - echo yes - exit 0 -fi - -if [ "$1" = "config" ]; then - - echo 'graph_title process memory Usage(MB)' - echo "graph_args --base 1000 -l 0 --vertical-label MB" - echo 'graph_scale no' - echo 'graph_vlabel process memory' - echo 'graph_category healthcheck' - echo 'graph_info This graph shows the Memory used by process' - - for(( I = 1; I < $CHECKMAX; ++I )) - do - eval process=\$process_${I} - eval alertmemory=\$alertmemory_${I} - if [ "x${process}" = "x" ]; then - continue - fi - - echo "$process.label $process" - echo "$process.info Memory used by $process" - echo "$process.draw LINE2" - echo "$process.min -10" - echo "$process.critical 0:" - done - - exit 0 -fi - -for(( I = 1; I < $CHECKMAX; ++I )) -do - eval process=\$process_${I} - if [ "x${process}" = "x" ]; then - continue - 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); }'`) - count=${vrets[0]} - value=${vrets[1]} - if [ $count -le 0 ]; then - echo "$process.value -10" - echo "$process.extinfo process down" - else - echo "$process.value $value" - fi -done +#!/bin/bash +# +#healthcheck on munin +#check process and alert. +# +#programed by rti (hiroyuki fujie) super.rti@gmail.com @super_rti +#LICENSE: NYSL (public domain) +# +#config file +# /etc/munin/plugin-conf.d/munin-node +# +#example minimum config +#--------------------------------------------------- +#[healthcheck_process] +#env.process_1 httpd +#--------------------------------------------------- +# +#chcek two process +#--------------------------------------------------- +#[healthcheck_process] +#env.process_1 httpd +#env.process_2 samba +#--------------------------------------------------- +# +#chcek three process +#--------------------------------------------------- +#[healthcheck_process] +#env.process_1 httpd +#env.process_2 samba +#env.process_3 mysqld +#--------------------------------------------------- +# +# +# + +#edakari speed up. +CHECKMAX=`env | grep process_ | wc -l` +let CHECKMAX="$CHECKMAX + 1" + +if [ "$1" = "autoconf" ]; then + if [ $CHECKMAX -le 1 ]; then + echo no + exit 1 + fi + echo yes + exit 0 +fi + +if [ "$1" = "config" ]; then + + echo 'graph_title process memory Usage(MB)' + echo "graph_args --base 1000 -l 0 --vertical-label MB" + echo 'graph_scale no' + echo 'graph_vlabel process memory' + echo 'graph_category healthcheck' + echo 'graph_info This graph shows the Memory used by process' + + for(( I = 1; I < $CHECKMAX; ++I )) + do + eval process=\$process_${I} + eval alertmemory=\$alertmemory_${I} + if [ "x${process}" = "x" ]; then + continue + fi + + echo "$process.label $process" + echo "$process.info Memory used by $process" + echo "$process.draw LINE2" + echo "$process.min -10" + echo "$process.critical 0:" + done + + exit 0 +fi + +for(( I = 1; I < $CHECKMAX; ++I )) +do + eval process=\$process_${I} + if [ "x${process}" = "x" ]; then + continue + 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); }'`) + count=${vrets[0]} + value=${vrets[1]} + if [ $count -le 0 ]; then + echo "$process.value -10" + echo "$process.extinfo process down" + else + echo "$process.value $value" + fi +done diff --git a/plugins/trafic_ro/trafic_ro_24h b/plugins/trafic_ro/trafic_ro_24h index 0e4ab979..9200fc5f 100755 --- a/plugins/trafic_ro/trafic_ro_24h +++ b/plugins/trafic_ro/trafic_ro_24h @@ -1,17 +1,17 @@ -#!/bin/sh -RID=${0##*trafic_ro_} - -if [ "$1" = "config" ]; then - echo graph_title $V 24h visitors for $RID - echo 'graph_args --base 1000' - echo 'graph_vlabel vizitatori_ultimele_24_ore' - echo 'graph_category Trafic_ro' - echo 'graph_info 24h visitors.' - echo "24h_visitors.label $RID" - echo "24h_visitors.info 24H visitors for $RID" - echo '24h_visitors.draw LINE2' - exit 0 -fi - -VISITORS="$(echo 'munin' | 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; +#!/bin/sh +RID=${0##*trafic_ro_} + +if [ "$1" = "config" ]; then + echo graph_title $V 24h visitors for $RID + echo 'graph_args --base 1000' + echo 'graph_vlabel vizitatori_ultimele_24_ore' + echo 'graph_category Trafic_ro' + echo 'graph_info 24h visitors.' + echo "24h_visitors.label $RID" + echo "24h_visitors.info 24H visitors for $RID" + echo '24h_visitors.draw LINE2' + exit 0 +fi + +VISITORS="$(echo 'munin' | 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;