728x90
반응형
#!/bin/bash

CUR_YMD=`date '+%Y-%m-%d'`
LOG_DIR=/home/test/logs
LOG_FILE=play.$CUR_YMD.log

LINE_LIMIT=30000
SUB_YMD_HM_0=`date '+%Y-%m-%d %H:%M'`
SUB_YMD_HM_1=`date --date '-1 min' '+%Y-%m-%d %H:%M'`
SUB_YMD_HM_2=`date --date '-2 min' '+%Y-%m-%d %H:%M'`
SUB_YMD_HM_3=`date --date '-3 min' '+%Y-%m-%d %H:%M'`
SUB_YMD_HM_4=`date --date '-4 min' '+%Y-%m-%d %H:%M'`
SUB_YMD_HM_5=`date --date '-5 min' '+%Y-%m-%d %H:%M'`


TOTAL=`tail -n $LINE_LIMIT $LOG_DIR/$LOG_FILE | grep -e "ERROR\|Exception" | grep -e "$SUB_YMD_HM_0\|$SUB_YMD_HM_1\|$SUB_YMD_HM_2\|$SUB_YMD_HM_3\|$SUB_YMD_HM_4\|$SUB_YMD_HM_5" | wc -l`

CATEGORY="Apps"
TITLE="ERROR or Exception"

if [ "$1" = "autoconf" ]; then
        if [ -n ${TOTAL} ] ; then
                echo yes
                exit 0
        else
                echo no
                exit 0
        fi
fi


if [ "$1" = "config" ]; then
    echo "graph_title $TITLE";
    echo "graph_args -r --lower-limit 0"
    echo "graph_vlabel threads";
    echo "graph_category $CATEGORY";
    echo "graph_order total";
    echo "total.label total";
    echo "total.draw LINE2";
    exit 0;
fi


if [ -n ${TOTAL} ] ; then
    echo "total.value $TOTAL";
else
    echo "total.value U";
fi
728x90
300x250

'IT > Munin' 카테고리의 다른 글

Couchbase Munin Plugin 설정  (0) 2021.08.19
Munin Application RTA 체크 스크립트  (0) 2021.07.30
Munin 플러그인 설정  (0) 2021.07.29
Connections-through-firewall 유효화  (0) 2021.07.29
Munin 노드 설치 및 구성  (0) 2021.07.07

+ Recent posts