forked from jdeubel/cfme_support_scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gawk.txt
137 lines (134 loc) · 7.47 KB
/
gawk.txt
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
BEGIN {
OFS = ","
HOUR = 0
log_date = 0
datehour = ""
new_datehour = ""
errors = 0
warnings = 0
info = 0
debug = 0
server_start =0
worker_start =0
workers_killed = 0
has_not_responded = 0
full_vc_refreshes_started = 0
full_vc_refreshes_ended = 0
max_VC_refresh_time = 0
ems_refresh = 0
db_errors = 0
refresh_timeouts = 0
workermonitor_starts = 0
vm_collections = 0
gt_600 = 0
events_caught = 0
events_queued = 0
VC_ID = ""
vcid_last_refresh_started = ""
print "datehour,errors,warnings,info,debug,server starts,worker monitor starts,worker starts,workers killed,has not responded count,ems refresh completed,full VC refresh started,full VC refresh completed,max VC refresh duration,VC id,db errors,refresh timeouts,vmid of last VC refresh started,C&U VM collection count,VM C&U Wait > 600 seconds,C&U host collection count, C&U host wait > 600 seconds,C&U storage collection count,C&U storage wait > 600 seconds,events caught,events queued"
}
$1 !~ /\[\-\-\-\-\]/ {next}
$2 ~ /E,/ {errors++ }
$2 ~ /W,/ {warnings++}
$2 ~ /I,/ {info++ }
$2 ~ /D,/ {debug++}
$3 ~ /(.*?)T(.*)/ { #print $0
datehour_array_count = split($3,date_array,":")
# print date_array[1]
new_datehour = date_array[1]
if (new_datehour != datehour) { #print "new datehour value is '" datehour "'"
old_datehour = datehour
datehour = new_datehour
datehour_display = substr(old_datehour,7,2) "/" substr(old_datehour,10,2) "/" substr(old_datehour,2,4) " " substr(old_datehour,13,3) ":00:00" ; # print datehour_display
if ( length(datehour_display) > 12) { # don't print the initial value since it is malformed and does not represent anything anyway
print datehour_display, errors, warnings,info, debug, server_start,workermonitor_starts,worker_start,workers_killed,has_not_responded,ems_refresh,full_vc_refreshes_started,full_vc_refreshes_ended,max_VC_refresh_time,VC_id,db_errors,refresh_timeouts,vcid_last_refresh_started,vm_collections,vm_gt_600,host_collections,host_gt_600,storage_collections,storage_gt_600,events_caught,events_queued
datehour = new_datehour
errors = 0
warnings = 0
info = 0
debug = 0
server_start =0
worker_start =0
workers_killed = 0
has_not_responded = 0
full_vc_refreshes_started = 0
full_vc_refreshes_ended = 0
ems_refresh = 0
max_VC_refresh_time = 0
db_errors = 0
refresh_timeouts = 0
workermonitor_starts = 0
vm_collections = 0
host_collections = 0
storage_collections = 0
vm_gt_600 = 0
host_gt_600 = 0
storage_gt_600 = 0
VC_id = ""
events_caught = 0
events_queued = 0
vcid_last_refresh_started = ""
#print new_datehour
}
}
}
/Caught event/ {events_caught++}
/Queueing event/ {events_queued++}
/\[VMDB\]/ {server_start++}
/abstract_adapter/ {if ($5 == "ERROR") {db_errors++}} # if the string "abstract_adapter" is found on an ERROR log line then increment counter
/execution expired Method\:\[refresh\]/ {refresh_timeouts++ # this is intended to catch failing vc refresh occurances
}
/started\./ {worker_start++}
/being killed/ {workers_killed++}
/has not responded/ {has_not_responded++}
/Refreshing targets for EMS: (.*?)\.\.\.Complete/ {ems_refresh++}
/MIQ\(VcRefresher\.refresh\) EMS\:(.*?)ExtManagementSystem(.*?)\.\.\.$/ {full_vc_refreshes_started++
_temp = split($(NF),vcid_array,".")
vcid_last_refresh_started = vcid_array[1]
#add code to delete entire array
vcid_array[1] = ""
}
/Refreshing target ExtManagementSystem (.*?)\.\.\.Completed/ {full_vc_refreshes_ended++
refresh_time = $(NF-1) # GET REFRESH TIME IN SECONDS
if (max_VC_refresh_time < refresh_time) {
max_VC_refresh_time = refresh_time
_count = split($(NF-3),vcid_array,".") # split out the vc id by getting first part isolated
VC_id = vcid_array[1]
#add code to delete entire array
vcid_array[1] = ""
}
refresh_time = 0
}
/WorkerMonitor started\./ {workermonitor_starts++}
/\[Vm\.perf_capture\]/ { if ($8 == "MIQ(MiqQueue.get)") {
vm_collections++
wait_time = int(substr($(NF-1),2,length($(NF-1))-2))
if (wait_time > 600)
{vm_gt_600++;
# print $3,wait_time # suspent printing this for now
}
}
}
/\[Host\.perf_capture\]/ { if ($8 == "MIQ(MiqQueue.get)") {
host_collections++
wait_time = int(substr($(NF-1),2,length($(NF-1))-2))
if (wait_time > 600)
{host_gt_600++;
# print $3,wait_time # suspent printing this for now
}
}
}
/\[Storage\.perf_capture\]/ { if ($8 == "MIQ(MiqQueue.get)") {
storage_collections++
wait_time = int(substr($(NF-1),2,length($(NF-1))-2))
if (wait_time > 600)
{storage_gt_600++;
# print $3,wait_time # suspent printing this for now
}
}
}
END {OFS = ","
# need to format the current date time into displayable date time
datehour_display = substr(datehour,7,2) "/" substr(datehour,10,2) "/" substr(datehour,2,4) " " substr(datehour,13,3) ":00:00" ; # print datehour_display
print datehour_display, errors, warnings,info, debug, server_start,workermonitor_starts,worker_start,workers_killed,has_not_responded,ems_refresh,full_vc_refreshes_started,full_vc_refreshes_ended,max_VC_refresh_time,VC_id,db_errors,refresh_timeouts,vcid_last_refresh_started,vm_collections,vm_gt_600,host_collections,host_gt_600,storage_collections,storage_gt_600,events_caught,events_queued
}