1
+ #include " .\_include_nhn\_util.au3"
2
+ #include < date.au3>
3
+ #Include < Array.au3>
4
+
5
+
6
+ ; global $_sErrorSumarryFile = "D:\_Autoit\guitar\report\errorsummary2.txt"
7
+ ; global $sScriptName = "26_샘플서비스_SUS_IE_REAL"
8
+ ; local $a =_getErrorSumarry($sScriptName, "2,6")
9
+ ; local $b, $c
10
+ ; $c= _getErrorSumarryInfo("서버aa", $a,False,"http://", $b)
11
+ ; debug($c, $b)
12
+ ; deleteSuccessListFormErrorSumarry($sScriptName)
13
+
14
+ ; 타입별로 메세지를 생성함
15
+ func _getErrorSumarryInfo($sServerName , $aErrorInfo , $sDashBoardReport , byref $sEmailContents )
16
+
17
+ local $sRet
18
+
19
+ $sEmailContents = " "
20
+ local $iCount = ubound ($aErrorInfo ) - 1
21
+
22
+ if $iCount < = 0 then return " "
23
+
24
+ $sRet = " [GUITAR] 누적오류, " & $aErrorInfo [1 ][1 ]
25
+ if $iCount > 1 then $sRet = $sRet & " 외 " & $iCount - 1 & " 건"
26
+ $sRet = $sRet & " (@" & $sServerName & " )"
27
+
28
+ $sEmailContents = " "
29
+ $sEmailContents = $sEmailContents & " 서버 : " & $sServerName & @crlf
30
+ $sEmailContents = $sEmailContents & " 실행 스크립트 : " & $aErrorInfo [1 ][1 ] & @crlf
31
+ $sEmailContents = $sEmailContents & " 리포트 : " & $sDashBoardReport & @crlf
32
+ $sEmailContents = $sEmailContents & @crlf
33
+ $sEmailContents = $sEmailContents & " 총 " & $iCount & " 건" & @crlf
34
+
35
+ for $i = 1 to ubound ($aErrorInfo ) - 1
36
+ $sEmailContents = $sEmailContents & " 누적 " & $aErrorInfo [$i ][0 ] & " 회 (" & $aErrorInfo [$i ][3 ] & @tab & $aErrorInfo [$i ][4 ] & @tab & $aErrorInfo [$i ][5 ] & " )" & @crlf
37
+ next
38
+
39
+ return $sRet
40
+
41
+ endfunc
42
+
43
+
44
+ ; 특정 횟수 이상 오류가 발생된 경우 배열로 리턴하도록 함
45
+ Func _getErrorSumarry($sCount , $sScriptName , $sTestTime )
46
+
47
+ ; 26_샘플서비스_SUS_IE_REAL1,2014/07/17 17:34:15,샘플서비스_SUS_010,샘플SUS_TC002,8
48
+
49
+ local $aFile
50
+ local $aNewList [1 ][10 ]
51
+ local $aRetList
52
+ local $i
53
+ local $aLine
54
+ local $iSearchIndex
55
+ local $bFound
56
+ local $aCount
57
+
58
+
59
+ $aCount = StringSplit ($sCount ," ," )
60
+ $aRetList = $aNewList
61
+
62
+ _FileReadToArray ($_sErrorSumarryFile , $aFile ,0 )
63
+ $aFile = _ArrayUnique($aFile ,1 )
64
+
65
+ for $i = 0 to ubound ($aFile ) - 1
66
+
67
+ $aLine = StringSplit ($aFile [$i ]," ," )
68
+ $bFound = False
69
+
70
+ for $j = 1 to ubound ($aNewList ) - 1
71
+ ; 실행된 스크립트 기준으로
72
+ ; 기존에 있을 경우 Count 만 추가
73
+
74
+ if $sScriptName = $aLine [1 ] then
75
+ if $aLine [1 ] = $aNewList [$j ][1 ] and $aLine [3 ] = $aNewList [$j ][3 ] and $aLine [4 ] = $aNewList [$j ][4 ] and $aLine [5 ] = $aNewList [$j ][5 ] then
76
+ $bFound = True
77
+ $aNewList [$j ][0 ] = $aNewList [$j ][0 ] + 1
78
+ if $sTestTime = $aLine [2 ] then $aNewList [$j ][2 ] = $sTestTime
79
+ exitloop
80
+ endif
81
+ endif
82
+ next
83
+
84
+ ; 신규 추가
85
+ if $bFound = False then
86
+
87
+ $iSearchIndex = ubound ($aNewList )
88
+ redim $aNewList [$iSearchIndex + 1 ][ubound ($aNewList ,2 )]
89
+
90
+ for $j = 1 to ubound ($aLine ) - 1
91
+ $aNewList [$iSearchIndex ][0 ] = 1
92
+ $aNewList [$iSearchIndex ][$j ] = $aLine [$j ]
93
+ next
94
+
95
+ endif
96
+
97
+ next
98
+
99
+
100
+ for $i = 1 to ubound ($aNewList ) - 1
101
+
102
+ for $j = 1 to ubound ($aCount ) - 1
103
+
104
+ if $aNewList [$i ][0 ] = Number ($aCount [$j ]) and ($sTestTime = $aNewList [$i ][2 ])then
105
+
106
+ $iSearchIndex = ubound ($aRetList )
107
+ redim $aRetList [$iSearchIndex + 1 ][ubound ($aRetList ,2 )]
108
+
109
+ for $j = 0 to ubound ($aRetList ,2 ) - 1
110
+ $aRetList [$iSearchIndex ][$j ] = $aNewList [$i ][$j ]
111
+ next
112
+
113
+ endif
114
+ next
115
+
116
+ next
117
+
118
+
119
+ return $aRetList
120
+
121
+ EndFunc
122
+
123
+
124
+ ; 메인스크립트 명을 기준으로 해당 스크립트 로그 내용을 모두 삭제함
125
+ func deleteSuccessListFormErrorSumarry($sScriptName )
126
+
127
+ local $aFile
128
+ local $i
129
+
130
+ _FileReadToArray ($_sErrorSumarryFile , $aFile ,0 )
131
+
132
+ for $i = 0 to ubound ($aFile ) - 1
133
+
134
+ if StringInStr ($aFile [$i ], $sScriptName & " ," ) = 1 then
135
+ $aFile [$i ] = " "
136
+ endif
137
+
138
+ next
139
+
140
+ $aFile = _ArrayUnique($aFile ,1 )
141
+ ; _msg($aFile)
142
+ _FileWriteFromArray($_sErrorSumarryFile , $aFile ,1 )
143
+
144
+ endfunc
0 commit comments