blob: 6903949156c641e86e5bf56e4e9d61f97a62676e (
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
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
|
BEGIN{
where=0;
n_hosts=0;
n_api=0;
n_ndb=0;
n_mgm=0;
n_ports=0;
}
/COMPUTERS/ {
where=1;
}
/\[[ \t]*COMPUTER[ \t]*\]/ {
where=1;
}
/PROCESSES/ {
where=2;
}
/Type: MGMT/ {
if(where!=1){
where=2;
n_mgm++;
}
}
/\[[ \t]*MGM[ \t]*\]/ {
where=2;
n_mgm++;
}
/Type: DB/ {
if(where!=1){
where=3;
n_ndb++;
}
}
/\[[ \t]*DB[ \t]*\]/ {
where=3;
n_ndb++;
}
/Type: API/ {
if(where!=1){
where=4;
n_api++;
}
}
/\[[ \t]*API[ \t]*\]/ {
where=4;
n_api++;
}
/HostName:/ {
host_names[host_ids[n_hosts]]=$2;
}
/FileSystemPath:/ {
if (where==3){
ndb_fs[ndb_ids[n_ndb]]=$2;
}
}
/Id:/{
if(where==1){
n_hosts++;
host_ids[n_hosts]=$2;
}
if(where==2){
mgm_ids[n_mgm]=$2;
}
if(where==3){
ndb_ids[n_ndb]=$2;
}
if(where==4){
api_ids[n_api]=$2;
}
}
/ExecuteOnComputer:/{
if(where==2){
mgm_hosts[mgm_ids[n_mgm]]=host_names[$2];
}
if(where==3){
ndb_hosts[ndb_ids[n_ndb]]=host_names[$2];
}
if(where==4){
api_hosts[api_ids[n_api]]=host_names[$2];
}
}
END {
for(i=1; i<=n_mgm; i++){
printf("mgm_%d=%s\n", mgm_ids[i], mgm_hosts[mgm_ids[i]]);
}
for(i=1; i<=n_ndb; i++){
printf("ndb_%d=%s\n", ndb_ids[i], ndb_hosts[ndb_ids[i]]);
printf("ndbfs_%d=%s\n", ndb_ids[i], ndb_fs[ndb_ids[i]]);
}
for(i=1; i<=n_api; i++){
printf("api_%d=%s\n", api_ids[i], api_hosts[api_ids[i]]);
}
printf("mgm_nodes=%d\n", n_mgm);
printf("ndb_nodes=%d\n", n_ndb);
printf("api_nodes=%d\n", n_api);
}
|