CollCTIServer.java
11.1 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
package com.sitech.ismp.coll.i2000;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import org.apache.log4j.Logger;
import com.sitech.ismp.coll.basic.TblATO_KPIDETAIL;
import com.sitech.ismp.coll.i2000.db.nmsguest.CTIIVDNINF;
import com.sitech.ismp.coll.i2000.db.nmsguest.CTIIVDNINFDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.CTINECONNECT;
import com.sitech.ismp.coll.i2000.db.nmsguest.CTINECONNECTDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_AIP_OFDINC;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_AIP_OFDINCDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_AGCTR;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_AGCTRDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_AGHPSUM;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_AGHPSUMDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_IVRCINF;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_IVRCINFDao;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_RUNINF;
import com.sitech.ismp.coll.i2000.db.nmsguest.TBL_PERF_CTI_RUNINFDao;
public class CollCTIServer implements CollCTIServerMBean{
Logger logger = Logger.getLogger("I2000");
//private String current_unit_id = "test_unit_id";
private String current_unit_id = "01-17-11";
public Vector getPerformance_One_Hour(HashMap params)throws Exception
{
Vector collResult = new Vector();
String DevIPAddr = (String)params.get("DevIPAddr");
Integer devip = new Integer(Integer.parseInt(DevIPAddr));
HashMap params1 = new HashMap();
params1.put("devip",devip);
logger.info("= CollCTIServer getPerformance_One_Hour = ");
//PM-02-17-011-02 �����Ŷӻ�ĺ����� ��һ�����������ڽ����Ŷӻ���ĺ�������� 1Сʱ
//tbl_perf_aip_ofdinc��seiz
//PM-02-17-011-03 ������ ��һ����������������ͷ�ϵͳ�Ŷӻ���ĺ�����ռ�����������İٷֱȣ�100%�� 1Сʱ
//tbl_perf_aip_ofdinc����100*intcgcl/seiz,��λΪ%
//lianlian 2006-11-13
TBL_PERF_AIP_OFDINCDao tbl_perf_aip_ofdincdao = new TBL_PERF_AIP_OFDINCDao();
List list_ofdincdao = tbl_perf_aip_ofdincdao.getCOLLINFO();
if(list_ofdincdao==null||list_ofdincdao.size()==0)
{
logger.error("@i2000 error, no getCOLLINFO info got by i2000 in CollCTIServer "+new Date());
}
else
{
int intvalue = 0;
for(int i=0;i<list_ofdincdao.size();i++)
{
TBL_PERF_AIP_OFDINC obj = (TBL_PERF_AIP_OFDINC)list_ofdincdao.get(i);
int intdevip = obj.getDEVIP();
int incofd = obj.getINCOFD();
int seiz = obj.getSEIZ();
int intcgcl = obj.getINTCGCL();
Date time = obj.getTIME();
if(seiz>0)
{
intvalue = 100*intcgcl/seiz;
}
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + incofd,"PM-02-17-011-02",String.valueOf(seiz),time);
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + incofd,"PM-02-17-011-03",String.valueOf(intvalue),time);
}
}
//PM-02-17-011-04 �Զ������� ��һ������������·�ɵ�IVR���̵ĺ��и������ 1Сʱ
//tbl_perf_cti_ivrcinf��incallnum
//lianlian 2006-11-13
TBL_PERF_CTI_IVRCINFDao tbl_perf_cti_ivrcinfdao = new TBL_PERF_CTI_IVRCINFDao();
List list_ivrcinfdao = tbl_perf_cti_ivrcinfdao.getAUTOCALLCOUNT();
if(list_ivrcinfdao==null||list_ivrcinfdao.size()==0)
{
logger.error("@i2000 error, no getAUTOCALLCOUNT info got by i2000 in CollCTIServer "+new Date());
}
else
{
for(int i=0;i<list_ivrcinfdao.size();i++)
{
TBL_PERF_CTI_IVRCINF obj = (TBL_PERF_CTI_IVRCINF)list_ivrcinfdao.get(i);
int intdevip = obj.getDEVIP();
int vdnid = obj.getVDNID();
int subccno = obj.getSUBCCNO();
int incallnum = obj.getINCALLNUM();
Date time = obj.getTIME();
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + vdnid + "-" + subccno,"PM-02-17-011-04",String.valueOf(incallnum),time);
}
}
//PM-02-17-011-05 �˹������� ��һ������������·�ɵ��˹���ϯ�ĺ��и������ 1Сʱ
//tbl_perf_cti_agctr��connectednum+calllostnum
//lianlian 2006-11-13
TBL_PERF_CTI_AGCTRDao tbl_perf_cti_agctrdao = new TBL_PERF_CTI_AGCTRDao();
List list_agctrdao = tbl_perf_cti_agctrdao.getMANUALCALLCOUNT();
if(list_agctrdao==null||list_agctrdao.size()==0)
{
logger.error("@i2000 error, no getMANUALCALLCOUNT info got by i2000 in CollCTIServer "+new Date());
}
else
{
int intvalue = 0;
for(int i=0;i<list_agctrdao.size();i++)
{
TBL_PERF_CTI_AGCTR obj = (TBL_PERF_CTI_AGCTR)list_agctrdao.get(i);
int intdevip = obj.getDEVIP();
int vdnid = obj.getVDNID();
int subccno = obj.getSUBCCNO();
int connectednum = obj.getCONNECTEDNUM();
int calllostnum = obj.getCALLLOSTNUM();
Date time = obj.getTIME();
intvalue = connectednum+calllostnum;
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + vdnid + "-" + subccno,"PM-02-17-011-05",String.valueOf(intvalue),time);
}
}
return collResult;
}
public Vector getPerformance_One_Minute(HashMap params)throws Exception
{
Vector collResult = new Vector();
String DevIPAddr = (String)params.get("DevIPAddr");
Integer devip = new Integer(Integer.parseInt(DevIPAddr));
HashMap params1 = new HashMap();
params1.put("devip",devip);
logger.info("= CollCTIServer getPerformance_One_Minute = ");
//PM-02-17-011-01 CTI LINK����״̬ �ڲ����ʱCTI���������Ŷӻ�֮�������״̬ 1����
//CTINeConnect��cnstat�ֶ�,������豸nodeid��Ϣ���Դ�nodeid�л�ȡ
//lianlian 2006-11-13
CTINECONNECTDao ctineconnectdao = new CTINECONNECTDao();
List list_ctineconnectdao = ctineconnectdao.getCTILINKSTATUS();
if(list_ctineconnectdao==null||list_ctineconnectdao.size()==0)
{
System.out.println("@i2000 error, no getCTILINKSTATUS info got by i2000 in CollCTIServer "+new Date());
}
else
{
for(int i=0;i<list_ctineconnectdao.size();i++)
{
CTINECONNECT obj = (CTINECONNECT)list_ctineconnectdao.get(i);
String nodeid = obj.getNODEID();
String cnnodeid = obj.getCNNODEID();
String cnstat = obj.getCNSTAT();
this.setResult(collResult,current_unit_id + ":" + nodeid + "-" + cnnodeid,"PM-02-17-011-01",cnstat,new Date());
}
}
//PM-02-17-011-07 ǩ����ϯ�� �ڲ����ʱǩ�뵽CTI�������е���ϯ������� 1����
//tbl_perf_cti_aghpsum��agentloginnums
//PM-02-17-011-08 ������ϯ�� �ڲ����ʱCTI�������п�����ϯ�ĸ������ 1����
//tbl_perf_cti_aghpsum��agentidlenums
//lianlian 2006-11-13
TBL_PERF_CTI_AGHPSUMDao tbl_perf_cti_aghpsumdao = new TBL_PERF_CTI_AGHPSUMDao();
List list_aghpsumdao = tbl_perf_cti_aghpsumdao.getAGENT_LOGIN_IDLE_NUMS();
if(list_aghpsumdao==null||list_aghpsumdao.size()==0)
{
logger.error("@i2000 error, no getAGENT_LOGIN_IDLE_NUMS info got by i2000 in CollCTIServer "+new Date());
}
else
{
for(int i=0;i<list_aghpsumdao.size();i++)
{
TBL_PERF_CTI_AGHPSUM obj = (TBL_PERF_CTI_AGHPSUM)list_aghpsumdao.get(i);
int intdevip = obj.getDEVIP();
int vdnid = obj.getVDNID();
int subccno = obj.getSUBCCNO();
int agentloginnums = obj.getAGENTLOGINNUMS();
int agentidlenums = obj.getAGENTIDLENUMS();
Date time = obj.getTIME();
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + vdnid + "-" + subccno,"PM-02-17-011-07",String.valueOf(agentloginnums),time);
this.setResult(collResult,current_unit_id + ":" + intdevip + "-" + vdnid + "-" + subccno,"PM-02-17-011-08",String.valueOf(agentidlenums),time);
}
}
//PM-02-17-011-09 CPU������ �ڲ����ʱ���������ڵĻ�����CPU�����ʣ�100%�� 1����
//tbl_perf_cti_runinf��cpur
//PM-02-17-011-10 �ڴ������� �ڲ����ʱ���������ڵĻ������ڴ������ʣ�100%�� 1����
//tbl_perf_cti_runinf��memr
//lianlian 2006-11-13
TBL_PERF_CTI_RUNINFDao tbl_perf_runinfdao = new TBL_PERF_CTI_RUNINFDao();
List list_runinfdao = tbl_perf_runinfdao.getCPUR_AND_MEMR();
//û��selectȨ�ޣ�������Ȩ��ֱ��ʹ��
if(list_runinfdao==null||list_runinfdao.size()==0)
{
logger.error("@i2000 error, no getCPUR_AND_MEMR info got by i2000 in CollCTIServer "+new Date());
}
else
{
for(int i=0;i<list_runinfdao.size();i++)
{
TBL_PERF_CTI_RUNINF obj = (TBL_PERF_CTI_RUNINF)list_runinfdao.get(i);
int intdevip = obj.getDEVIP();
int cpur = obj.getCPUR();
int memr = obj.getMEMR();
Date time = obj.getTIME();
this.setResult(collResult,current_unit_id + ":" + intdevip + "-total","PM-02-17-011-09",String.valueOf(cpur),time);
this.setResult(collResult,current_unit_id + ":" + intdevip + "-total","PM-02-17-011-10",String.valueOf(memr),time);
}
}
return collResult;
}
public Vector getConfiguration(HashMap params)throws Exception
{
Vector collResult = new Vector();
logger.info("= CollCTIServer getConfiguration = ");
//CM-02-17-011-01 ������ ϵͳ�Ľ����루��1860��1861�� һ��
//CTIIVDNINF�е�inno�ֶ�
CTIIVDNINFDao ctiivdninfdao = new CTIIVDNINFDao();
List list_ctiivdninfdao = ctiivdninfdao.getINNUM();
if(list_ctiivdninfdao==null||list_ctiivdninfdao.size()==0)
{
logger.error("@i2000 error, no getINNUM info got by i2000 in CollCTIServer "+new Date());
}
else
{
for(int i=0;i<list_ctiivdninfdao.size();i++)
{
CTIIVDNINF obj = (CTIIVDNINF)list_ctiivdninfdao.get(i);
String ccid = obj.getCCID();
String vdnid = obj.getVDNID();
String innoid = obj.getINNOID();
String inno = obj.getINNO();
this.setResult(collResult,current_unit_id + ":" + ccid + "-" + vdnid + "-" + innoid,"CM-02-17-011-01",inno,new Date());
}
}
return collResult;
}
private void setResult(Vector result, String unitID, String kpiID , String value,Date cll_time) {
try {
TblATO_KPIDETAIL record;
record = new TblATO_KPIDETAIL();
record.setCLL_TIME(new Date());
record.setKPI_ID(kpiID);
record.setKPI_VALUE(value);
record.setUNIT_ID(unitID);
record.setCLL_TIME(cll_time);
result.add(record);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String args[])throws Exception
{
String DevIPAddr = "1000";
HashMap params = new HashMap();
params.put("DevIPAddr",DevIPAddr);
Vector collResult = new Vector();
CollCTIServerMBean MBean = new CollCTIServer();
collResult.addAll(MBean.getConfiguration(params));
collResult.addAll(MBean.getPerformance_One_Minute(params));
collResult.addAll(MBean.getPerformance_One_Hour(params));
String temp[][]=CheckKPIHelper.CheckCTIServerKPI(collResult);
for(int i=0;i<temp.length;i++)
{
System.out.println("KPI_ID : " + temp[i][0] + "---" + temp[i][1]);
}
//String filename = "CTIServerKPIValue.xls";
//CheckKPIHelper.WriteKPIValue2File(collResult,filename);
}
}