Zitat von Herr Salami
Zitat von xSlay
Zitat von Herr Salami
Geil, ich bin selig, selig sein ftw! \/
@adi:
String actionName = request.getParameter(ACTION_KEY);
String actionName_2 = request.getParameter(ACTION_KEY_2);
String actionName_3 = request.getParameter(ACTION_KEY_3);
String destinationPage = ERROR_PAGE;
// perform action
de.bam.SNMPRequest snmpRequest_ups1 = new de.bam.SNMPRequest(host_ups1);
de.bam.SNMPRequest snmpRequest_ups2 = new de.bam.SNMPRequest(host_ups2);
List ups1 = new ArrayList();
List ups2 = new ArrayList();
List name_ups1 = new ArrayList();
List name_ups2 = new ArrayList();
List details_ups1 = new ArrayList();
List details_ups2 = new ArrayList();
String[] items = new String[100];
// Name for the items
String[] synoym = new String[100];
String[] units = new String[100];
items[0] = "upsAlarmsPresent.0";
synoym[0] = "Active Alarms";
items[1] = "upsOutputPower.1";
synoym[1] = "Power (Phase 1)";
items[2] = "upsOutputPower.2";
synoym[2] = "Power (Phase 2)";
items[3] = "upsOutputPower.3";
synoym[3] = "Power (Phase 3)";
items[4] = "upsBatteryTemperature.0";
synoym[4] = "Battery Temperature";
items[5] = "upsEstimatedChargeRemaining.0";
synoym[5] = "Estimated Charge Remaining";
items[6] = "upsEstimatedMinutesRemaining.0";
synoym[6] = "Estimated Minutes Remaining";
items[7] = "sysUpTime.0";
synoym[7] = "SystemUpTime";
items[8] = "sysName.0";
synoym[8] = "Systemname";
items[9] = "sysLocation.0";
synoym[9] = "Location";
items[10] = "upsIdentManufacturer.0";
synoym[10] = "Manufacturer";
items[11] = "upsIdentModel.0";
synoym[11] = "Model";
items[12] = "sysContact.0";
synoym[12] = "Contact persons";
synoym[13] = "Power (All Phases)";
String temp = " ";
units[1] = "kW";
units[2] = "°C";
units[3] = "%";
units[4] = "min";
if (VIEW_SERVER_LIST_ACTION.equals(actionName)) {
//
// Server
//
// Row 1 - Left
List l31 = new ArrayList();
List l32 = new ArrayList();
List l33 = new ArrayList();
List l34 = new ArrayList();
List l35 = new ArrayList();
List l36 = new ArrayList();
List l37 = new ArrayList();
List l38 = new ArrayList();
// Row 1 - Right
List r31 = new ArrayList();
List r32 = new ArrayList();
List r33 = new ArrayList();
List r34 = new ArrayList();
List r35 = new ArrayList();
List r36 = new ArrayList();
List r37 = new ArrayList();
// Row 2 - Left
List l21 = new ArrayList();
List l22 = new ArrayList();
List l25 = new ArrayList();
List l26 = new ArrayList();
List l27 = new ArrayList();
List l28 = new ArrayList();
// Row 2 - Right
List r21 = new ArrayList();
List r22 = new ArrayList();
List r23 = new ArrayList();
List r24 = new ArrayList();
List r25 = new ArrayList();
List r26 = new ArrayList();
List r27 = new ArrayList();
// Row 1 - Left
List l11 = new ArrayList();
List l12 = new ArrayList();
List l15 = new ArrayList();
List l16 = new ArrayList();
List l17 = new ArrayList();
List l18 = new ArrayList();
// Row 1 - Right
List r11 = new ArrayList();
List r12 = new ArrayList();
List r13 = new ArrayList();
List r14 = new ArrayList();
List r15 = new ArrayList();
List r16 = new ArrayList();
List r17 = new ArrayList();
//
// L31
//
l31.add(new ServerBean("sv3729", "10", "10", "10", "1000",
temp("10"
, temp("10"
, temp("10"
, fan("1000"
, warning(
"10", "10", "10", "1000"
));
l31.add(new ServerBean("sv2100", "50", "50", "50", "50",
temp("50"
, temp("50"
, temp("50"
, fan("50"
, warning(
"50", "50", "50", "50"
));
l31.add(new ServerBean("ws2771", "70", "70", "70", "0", temp("70"
,
temp("70"
, temp("70"
, fan("0"
, warning("70", "70", "70",
"0"
));
l31.add(new ServerBean("ws7002", "45", "45", "80", "1200",
temp("45"
, temp("45"
, temp("80"
, fan("1200"
, warning(
"45", "45", "80", "1200"
));
l31.add(new ServerBean("sv1234", "45", "80", "45", "950",
temp("45"
, temp("80"
, temp("45"
, fan("950"
, warning(
"45", "80", "45", "950"
));
//
// L32
//
l32.add(new ServerBean("ws1234", "80", "45", "45", "1000",
temp("80"
, temp("45"
, temp("45"
, fan("1000"
, warning(
"80", "45", "45", "1000"
));
l32.add(new ServerBean("ws2345", "45", "45", "45", "0", temp("45"
,
temp("45"
, temp("45"
, fan("0"
, warning("45", "45", "45",
"0"
));
l32.add(new ServerBean("ws6534", "45", "68", "56", "1211",
temp("45"
, temp("68"
, temp("56"
, fan("1211"
, warning(
"45", "68", "56", "1211"
));
l32.add(new ServerBean("ws5865", "14", "56", "34", "850",
temp("14"
, temp("56"
, temp("34"
, fan("850"
, warning(
"14", "56", "34", "850"
));
l32.add(new ServerBean("ws4503", "45", "78", "65", "34",
temp("45"
, temp("78"
, temp("65"
, fan("34"
, warning(
"45", "78", "65", "34"
));
r11.add(new ServerBean("ws6521", "78", "45", "67", "900",
temp("78"
, temp("45"
, temp("67"
, fan("900"
, warning(
"78", "45", "67", "900"
));
r35.add(new ServerBean("sv2001", "60", "66", "55", "950",
temp("60"
, temp("66"
, temp("55"
, fan("950"
, warning(
"60", "66", "55", "950"
));
r35.add(new ServerBean("sv2002", "65", "63", "61", "750",
temp("65"
, temp("63"
, temp("61"
, fan("750"
, warning(
"65", "63", "61", "750"
));
r31.add(new ServerBean("sv3729", "10", "10", "10", "1000",
temp("10"
, temp("10"
, temp("10"
, fan("1000"
, warning(
"10", "10", "10", "1000"
));
r31.add(new ServerBean("sv2100", "50", "50", "50", "50",
temp("50"
, temp("50"
, temp("50"
, fan("50"
, warning(
"50", "50", "50", "50"
));
r31.add(new ServerBean("ws2771", "70", "70", "70", "0", temp("70"
,
temp("70"
, temp("70"
, fan("0"
, warning("70", "70", "70",
"0"
));
r31.add(new ServerBean("ws7002", "45", "45", "80", "1200",
temp("45"
, temp("45"
, temp("80"
, fan("1200"
, warning(
"45", "45", "80", "1200"
));
r31.add(new ServerBean("sv1234", "45", "80", "45", "950",
temp("45"
, temp("80"
, temp("45"
, fan("950"
, warning(
"45", "80", "45", "950"
));
//
// UPS
//
String value_OutPower1_ups1 = snmpRequest_ups1.get(items[1]);
String value_OutPower2_ups1 = snmpRequest_ups1.get(items[2]);
String value_OutPower3_ups1 = snmpRequest_ups1.get(items[3]);
int power1_ups1 = Integer.parseInt(value_OutPower1_ups1);
int power2_ups1 = Integer.parseInt(value_OutPower2_ups1);
int power3_ups1 = Integer.parseInt(value_OutPower3_ups1);
int power_ups1 = power1_ups1 + power2_ups1 + power3_ups1;
// int power_ups1 = 40;
String value_power_ups1 = Integer.toString(power_ups1);
String value_Batterytemp_ups1 = snmpRequest_ups1.get(items[4]);
String value_Name_ups1 = snmpRequest_ups1.get(items[8]);
temp = Power(power_ups1);
ups1.add(new UPS(synoym[13], value_power_ups1, units[1], temp));
temp = Battery(value_Batterytemp_ups1);
ups1
.add(new UPS(synoym[4], value_Batterytemp_ups1, units[2],
temp));
name_ups1.add(new UPS(synoym[8], value_Name_ups1, null, null));
String value_OutPower1_ups2 = snmpRequest_ups2.get(items[1]);
String value_OutPower2_ups2 = snmpRequest_ups2.get(items[2]);
String value_OutPower3_ups2 = snmpRequest_ups2.get(items[3]);
int power1_ups2 = Integer.parseInt(value_OutPower1_ups2);
int power2_ups2 = Integer.parseInt(value_OutPower2_ups2);
int power3_ups3 = Integer.parseInt((value_OutPower3_ups2));
int power_ups2 = power1_ups2 + power2_ups2 + power3_ups3;
String value_Name_ups2 = snmpRequest_ups2.get(items[8]);
String value_Batterytemp_ups2 = snmpRequest_ups2.get(items[4]);
String value_power_ups2 = Integer.toString(power_ups2);
temp = Battery(value_Batterytemp_ups2);
ups2
.add(new UPS(synoym[4], value_Batterytemp_ups2, units[2],
temp));
temp = Power(power_ups2);
ups2.add(new UPS(synoym[13], value_power_ups2, units[1], temp));
name_ups2.add(new UPS(synoym[8], value_Name_ups2, null, null));
request.setAttribute("l31", l31);
request.setAttribute("l32", l32);
request.setAttribute("r11", r11);
request.setAttribute("r35", r35);
request.setAttribute("r31", r31);
request.setAttribute("ups1", ups1);
request.setAttribute("ups2", ups2);
request.setAttribute("name_ups1", name_ups1);
request.setAttribute("name_ups2", name_ups2);
request.setAttribute("details_ups2", details_ups2);
destinationPage = "/rz.jsp";
} else if (VIEW_UPS_1_ACTION.equals(actionName_2)) {
String value_AlarmsPresent_ups1 = snmpRequest_ups1.get(items[0]);
String value_OutPower1_ups1 = snmpRequest_ups1.get(items[1]);
String value_OutPower2_ups1 = snmpRequest_ups1.get(items[2]);
String value_OutPower3_ups1 = snmpRequest_ups1.get(items[3]);
String value_ecr_ups1 = snmpRequest_ups1.get(items[5]);
String value_emr_ups1 = snmpRequest_ups1.get(items[6]);
String value_sysUpTime_ups1 = snmpRequest_ups1.get(items[7]);
String value_Location_ups1 = snmpRequest_ups1.get(items[9]);
String value_Name_ups1 = snmpRequest_ups1.get(items[8]);
String value_Manu_ups1 = snmpRequest_ups1.get(items[10]);
String value_Model_ups1 = snmpRequest_ups1.get(items[11]);
String value_Contact_ups1 = snmpRequest_ups1.get(items[12]);
name_ups1.add(new UPS(items[8], value_Name_ups1, null, null));
details_ups1
.add(new UPS(synoym[9], value_Location_ups1, null, null));
details_ups1
.add(new UPS(synoym[12], value_Contact_ups1, null, null));
details_ups1.add(new UPS(synoym[10], value_Manu_ups1, null, null));
details_ups1.add(new UPS(synoym[11], value_Model_ups1, null, null));
temp = Power_Phase(value_OutPower1_ups1);
details_ups1.add(new UPS(synoym[1], value_OutPower1_ups1, units[1],
temp));
temp = Power_Phase(value_OutPower2_ups1);
details_ups1.add(new UPS(synoym[2], value_OutPower2_ups1, units[1],
temp));
temp = Power_Phase(value_OutPower3_ups1);
details_ups1.add(new UPS(synoym[3], value_OutPower3_ups1, units[1],
temp));
details_ups1
.add(new UPS(synoym[5], value_ecr_ups1, units[3], null));
details_ups1
.add(new UPS(synoym[6], value_emr_ups1, units[4], null));
details_ups1.add(new UPS(synoym[7], value_sysUpTime_ups1, null,
null));
temp = AlarmPresent(value_AlarmsPresent_ups1);
details_ups1.add(new UPS(synoym[0], value_AlarmsPresent_ups1, null,
temp));
request.setAttribute("details_ups1", details_ups1);
request.setAttribute("name_ups1", name_ups1);
destinationPage = "/ups1_detail.jsp";
} else if (VIEW_UPS_2_ACTION.equals(actionName_3)) {
String value_Location_ups2 = snmpRequest_ups2.get(items[9]);
String value_Name_ups2 = snmpRequest_ups2.get(items[8]);
String value_Manu_ups2 = snmpRequest_ups2.get(items[10]);
String value_Model_ups2 = snmpRequest_ups2.get(items[11]);
String value_Contact_ups2 = snmpRequest_ups2.get(items[12]);
String value_OutPower1_ups2 = snmpRequest_ups2.get(items[1]);
String value_OutPower2_ups2 = snmpRequest_ups2.get(items[2]);
String value_OutPower3_ups2 = snmpRequest_ups2.get(items[3]);
String value_AlarmsPresent_ups2 = snmpRequest_ups2.get(items[0]);
String value_ecr_ups2 = snmpRequest_ups2.get(items[5]);
String value_emr_ups2 = snmpRequest_ups2.get(items[6]);
String value_sysUpTime_ups2 = snmpRequest_ups2.get(items[7]);
name_ups2.add(new UPS(synoym[8], value_Name_ups2, null, null));
details_ups2
.add(new UPS(synoym[9], value_Location_ups2, null, null));
details_ups2
.add(new UPS(synoym[12], value_Contact_ups2, null, null));
details_ups2.add(new UPS(synoym[10], value_Manu_ups2, null, null));
details_ups2.add(new UPS(synoym[11], value_Model_ups2, null, null));
temp = Power_Phase(value_OutPower1_ups2);
details_ups2.add(new UPS(synoym[1], value_OutPower1_ups2, units[1],
temp));
temp = Power_Phase(value_OutPower1_ups2);
details_ups2.add(new UPS(synoym[2], value_OutPower2_ups2, units[1],
temp));
temp = Power_Phase(value_OutPower1_ups2);
details_ups2.add(new UPS(synoym[3], value_OutPower3_ups2, units[1],
temp));
temp = AlarmPresent(value_AlarmsPresent_ups2);
details_ups2.add(new UPS(synoym[0], value_AlarmsPresent_ups2,
units[0], temp));
details_ups2
.add(new UPS(synoym[5], value_ecr_ups2, units[3], null));
details_ups2
.add(new UPS(synoym[6], value_emr_ups2, units[4], null));
details_ups2.add(new UPS(synoym[7], value_sysUpTime_ups2, null,
null));
request.setAttribute("details_ups2", details_ups2);
request.setAttribute("name_ups2", name_ups2);
destinationPage = "/ups2_detail.jsp";