summaryrefslogtreecommitdiff
path: root/script/shell/proxy_maat_stat.sh
blob: 602675748e477d5ac8108d934a56e4c5264489ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash

ARGC=$#
EXPORTER=/opt/tsg/framework/bin/fieldstat_exporter.py
TARGET=/opt/tsg/tfe/log/pangu_scan.fs2

case $1 in
    -h|--help)
        echo "$0"
        echo "Usage: [exporter] [target]"
        echo "  exporter: path of exporter, default is $EXPORTER"
        echo "  target: path of target file, default is $TARGET"
        exit 0
        ;;
esac

case $ARGC in
  	1)
		EXPORTER=$1
	  ;;
  	2)
		EXPORTER=$1
		TARGET=$2
	  ;;
esac

 python3 $EXPORTER local -j $TARGET -e -t '
    {{ 
        print_tables
        ( 
            "TBL", 
                [   
                    "rule", 
                    "reg/v6",
                    "scan_times",
                    "hit_times",
                    "scan_bytes",
                    "scan_cpu_time",
                    "hit_item_num",
                    "hit_pat_num",
                    "#Name<IN_Bps>#Ratio<scan_bytes,scan_cpu_time,100>",
                    "#Name<hit_rate>#Ratio<hit_times,scan_times,1>"
                ],
                False
        )
    }}
'