String getParameters() { String s = I18N.toDefaultEncoding(getProperty("_parameters")); if (TextUtils.isSubstituteExpression(s)) { s = TextUtils.substitute(s); } s = createFromTemplate(s); if (TextUtils.hasChars(s, "`;&|<>")) { LogManager.log( "Error", "Removed illegal characters from script monitor parameters \"" + s + "\"" + " for monitor " + getProperty(pName)); s = TextUtils.removeChars(s, "`;&|<>"); } return s; }
protected boolean update() throws SiteViewException { StringBuffer stringbuffer = new StringBuffer(); Vector vector = new Vector(); int i = 0; do { if (i >= nMaxCounters) { break; } String s = getProperty(PROPERTY_NAME_COUNTER_ID + (i + 1)); if (s.length() == 0) { break; } vector.add(s); i++; } while (true); Vector vector1 = getUniqueSensorsIdsFromCounters(vector); Integer integer; synchronized (machineMap) { integer = (Integer) machineMap.get(getProperty(pHostName)); if (integer == null) { integer = new Integer(0); machineMap.put(getProperty(pHostName), integer); } } HashMap hashmap1 = null; synchronized (integer) { // hashmap1 = readSensors(vector1); } if (hashmap1 == null) { LogManager.log("error", "Failed to update monitor status"); setProperty(pStateString, "n/a - Failed to update monitor status"); return false; } Vector vector2 = getChassisIdsFromCounters(vector); // com.dragonflow.IPMI.Commands.Chassis.ChassisStatus chassisstatus = null; // if (vector2.size() > 0) { // synchronized (integer) { // chassisstatus = readChassisStatus(); // } // if (chassisstatus == null) { // LogManager.log("error", "Failed to read chassis status"); // setProperty(pStateString, "n/a -Failed to read chassis status"); // return false; // } // } int j = 0; int k = 0; if (stillActive()) { synchronized (this) { String s1 = ""; if (stringbuffer.length() > 0) { for (int l = 0; l < nMaxCounters; l++) { setProperty(PROPERTY_NAME_COUNTER_VALUE + (l + 1), "n/a"); } setProperty(getPropertyObject(PROPERTY_NAME_COUNTERS_IN_ERROR), nMaxCounters); s1 = stringbuffer.toString(); } else { for (int i1 = 0; i1 < vector.size(); i1++) { String s2 = getProperty(PROPERTY_NAME_COUNTER_NAME + (i1 + 1)); String s3 = (String) vector.get(i1); CounterReading counterreading = null; String s4 = getSensorIdForCounter(s3); String s5 = (String) chassisMericsMap.get(s3); if (s4 != null) { // SensorReadingRecord sensorreadingrecord = // (SensorReadingRecord) hashmap1.get(s4); // counterreading = updateSensorCounter(s3, // sensorreadingrecord); } else if (s5 != null) { // counterreading = updateChassisCounter(s3, // chassisstatus); } if (counterreading == null) { LogManager.log("log", "Failed to read counter"); continue; } setProperty( PROPERTY_NAME_COUNTER_VALUE + (i1 + 1), TextUtils.removeChars(counterreading.value, ",")); s1 = s1 + s2 + " = " + counterreading.value; if (i1 != vector.size() - 1) { s1 = s1 + ", "; } if (counterreading.isError()) { j++; } if (counterreading.isWarning()) { k++; } } setProperty(getPropertyObject(PROPERTY_NAME_COUNTERS_IN_ERROR), j); if (j > 0) { setProperty(pStatus, "Error"); } else if (k > 0) { setProperty(pStatus, "Warning"); } else { setProperty(pStatus, "OK"); } } setProperty(pStateString, s1); } } return true; }