private static DriveInformation locateDriveRecord(List<DriveInformation> driveInformation, String partition) { if (driveInformation == null) { return null; } for (int i = 0; i < driveInformation.size(); i++) { if (partition.equalsIgnoreCase(driveInformation.get(i).getPartition())) { return driveInformation.get(i); } } return null; }
rs = com.executeQuery(); while (rs.next()) { p = new DriveInformation(); p.setFreespace(rs.getLong("freespace")); p.setId(rs.getString("id")); p.setKilobytespersecondDiskRead(rs.getLong("readKBs")); p.setKilobytespersecondDiskWrite(rs.getLong("writeKBs")); p.setOperationalstatus(rs.getString("statusmsg")); p.setOperational(rs.getBoolean("status")); p.setPartition(rs.getString("driveIdentifier")); p.setSystemid(rs.getString("deviceIdentifier")); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(timestamp); p.setTimestamp((gcal)); ret.add(p);
+ " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ? ,?,?, ?);"); com.setString(1, Utility.truncate(req.getHostname(), MAXTEXT)); com.setString(2, Utility.truncate(req.getMachineData().getDriveInformation().get(i).getPartition(), MAXTEXT)); if (req.getMachineData().getDriveInformation().get(i).getFreespace() != null) { com.setLong(3, req.getMachineData().getDriveInformation().get(i).getFreespace()); } else { com.setLong(3, -1); req.getMachineData().getDriveInformation().get(i).setId(UUID.randomUUID().toString()); req.getMachineData().setId(id.toString()); com.setString(5, id.toString()); if (req.getMachineData().getDriveInformation().get(i).getKilobytespersecondDiskWrite() != null) { com.setLong(6, req.getMachineData().getDriveInformation().get(i).getKilobytespersecondDiskWrite()); } else { com.setNull(6, java.sql.Types.BIGINT); if (req.getMachineData().getDriveInformation().get(i).getKilobytespersecondDiskRead() != null) { com.setLong(7, req.getMachineData().getDriveInformation().get(i).getKilobytespersecondDiskRead()); } else { com.setNull(7, java.sql.Types.BIGINT); com.setString(8, Utility.truncate(req.getMachineData().getDriveInformation().get(i).getSystemid(), MAXTEXT)); com.setBoolean(9, req.getMachineData().getDriveInformation().get(i).isOperational()); com.setString(10, Utility.truncate(req.getMachineData().getDriveInformation().get(i).getOperationalstatus(), MAXTEXT)); com.setString(11, Utility.truncate(req.getDomainname(), MAXTEXT)); com.setString(12, Utility.truncate(req.getMachineData().getUri(), MAXTEXT));
@Override public boolean CheckTransactionalRule(MachinePerformanceData req, List<NameValuePair> params, AtomicReference<String> nullableFaultMsg) { if (nullableFaultMsg == null) { nullableFaultMsg = new AtomicReference<String>(); } NameValuePair partition = Utility.getNameValuePairByName(params, "partition"); NameValuePair value = Utility.getNameValuePairByName(params, "value"); long val = 0; String part = partition.getValue(); if (partition.isEncrypted()) { part = Utility.DE(partition.getValue()); } if (value.isEncrypted()) { val = Long.parseLong(Utility.DE(value.getValue())); } else { val = Long.parseLong((value.getValue())); } for (int i = 0; i < req.getDriveInformation().size(); i++) { if (req.getDriveInformation().get(i).getPartition().equalsIgnoreCase(part)) { if (req.getDriveInformation().get(i).getFreespace() < val) { nullableFaultMsg.set("The partion's freespace, " + req.getDriveInformation().get(i).getFreespace() + " is less than the threshold of " + val + ". " + nullableFaultMsg.get()); } return true; } } return false; }
t2.ResponseTime = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getKilobytespersecondDiskRead(); t2.cal = res.getMachinePerformanceData().get(i).getTimestamp(); if (dataRX.Contains(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition())) { dataRX.get(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition()).add(t2); } else { RateStruct t3 = new RateStruct(); t3.item = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition(); t3.data = new ArrayList<TransactionLogTimeStampStruct>(); t3.data.add(t2); t2.ResponseTime = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getKilobytespersecondDiskWrite(); t2.cal = res.getMachinePerformanceData().get(i).getTimestamp(); if (dataTX.Contains(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition())) { dataTX.get(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition()).add(t2); } else { RateStruct t3 = new RateStruct(); t3.item = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition(); t3.data = new ArrayList<TransactionLogTimeStampStruct>(); t3.data.add(t2);
public String GetPartitionNamesAsHtmlListboxForThroughput(String url, String domain, String machine, PCS pcsport, SecurityWrapper c, List<String> existingItems) { GetProcessesListByMachineRequestMsg req = new GetProcessesListByMachineRequestMsg(); req.setClassification(c); req.setHostname(machine); StringBuilder s = new StringBuilder(); if (res == null) { try { res = pcsport.getProcessesListByMachine(req); } catch (AccessDeniedException ex) { LogHelper.getLog().log(Level.WARN, null, ex); } catch (ServiceUnavailableException ex) { LogHelper.getLog().log(Level.WARN, null, ex); } } if (res != null && res.getMachineInformation() != null) { s = s.append("<select name=\"recorddiskusage\" id=\"recorddiskusage\" multiple=\"multiple\" >"); for (int i = 0; i < res.getMachineInformation().getDriveInformation().size(); i++) { s = s.append(" <option value=\"").append(Utility.encodeHTML(res.getMachineInformation().getDriveInformation().get(i).getSystemid())).append("\""); if (isIn(res.getMachineInformation().getDriveInformation().get(i).getSystemid(), existingItems)) { s = s.append(" selected "); } s = s.append(" >"). append(Utility.encodeHTML(res.getMachineInformation().getDriveInformation().get(i).getSystemid())).append("</option>"); } s = s.append("</select>"); } else { s = s.append("<input type=text name=\"recorddiskusage\" value=\"").append(Utility.encodeHTML(Utility.listStringtoString(existingItems))).append("\" >"); } return s.toString(); }
/** * Create an instance of {@link DriveInformation } * */ public DriveInformation createDriveInformation() { return new DriveInformation(); }
TransactionLogTimeStampStruct t2 = new TransactionLogTimeStampStruct(); t2.cal = res.getMachinePerformanceData().get(i).getTimestamp(); t2.ResponseTime = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getFreespace(); if (dataRX.Contains(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition())) { dataRX.get(res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition()).add(t2); } else { RateStruct t3 = new RateStruct(); t3.item = res.getMachinePerformanceData().get(i).getDriveInformation().get(k).getPartition(); t3.data = new ArrayList<TransactionLogTimeStampStruct>(); t3.data.add(t2);
s = s.append(" <option value=\"").append(Utility.encodeHTML(res.getMachineInformation().getDriveInformation().get(i).getSystemid())).append("\""); if (isIn(res.getMachineInformation().getDriveInformation().get(i).getSystemid(), existingItems)) { s = s.append(" selected "); append(Utility.encodeHTML(res.getMachineInformation().getDriveInformation().get(i).getSystemid())).append("</option>");
rs = com.executeQuery(); while (rs.next()) { DriveInformation d = new DriveInformation(); d.setFreespace(rs.getLong("freespace")); d.setPartition(rs.getString("driveIdentifier")); d.setKilobytespersecondDiskWrite(rs.getLong("writeKBs")); d.setKilobytespersecondDiskRead(rs.getLong("readKBs")); d.setOperational(rs.getBoolean("status")); d.setOperationalstatus(rs.getString("statusmsg")); d.setId(rs.getString("id")); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(rs.getLong("utcdatetime")); d.setTimestamp((gcal)); r.add(d);
/** * * @param data * @param partition * @return true if valid */ private boolean ConfirmDriveExists(GetProcessesListByMachineResponseMsg data, String partition) { if (data == null) { return false; } if (data.getMachineInformation() == null) { return false; } if (data.getMachineInformation().getDriveInformation() == null) { return false; } for (int i = 0; i < data.getMachineInformation().getDriveInformation().size(); i++) { if (data.getMachineInformation().getDriveInformation().get(i).getPartition().equalsIgnoreCase(partition)) { return true; } } return false; }