public static MachinePolicy ProcessMachineLevelSLAs(AddMachineAndProcessDataRequestMsg req, boolean pooled) { MachinePolicy mp = loadMachinePolicyPooled(req.getHostname()); AuxHelper.TryUpdateStatus(req.getMachineData().isOperationalstatus(), req.getMachineData().getUri(), req.getMachineData().getStatusmessage(), pooled, PolicyType.MACHINE, req.getDomainname(), req.getHostname()); processMachineSLAs(req, mp, pooled); return mp; }
/** * does process specific SLA processing, scope: just right now * * @param processData * @param pooled */ private static void processMachineSLAs(AddMachineAndProcessDataRequestMsg req, MachinePolicy pol, boolean pooled) { if (pol == null || pol.getServiceLevelAggrements() == null) { return; } for (int i = 0; i < pol.getServiceLevelAggrements().getSLA().size(); i++) { RuleBaseType rule = pol.getServiceLevelAggrements().getSLA().get(i).getRule(); AtomicReference<String> msg = new AtomicReference<String>(); if (processMachineSLAsRecursive(req, rule, pol, pooled, msg)) { String id = UUID.randomUUID().toString(); RecordSLAFault(new AtomicReference<String>(msg.get()), pol.getURL(), req.getMachineData().getId(), System.currentTimeMillis(), id, pooled); ProcessAlerts(msg.get(), "<h2" + Utility.encodeHTML(msg.get()) + "</h2>", pol.getURL(), req.getMachineData().getId(), System.currentTimeMillis(), id, pooled, false, pol.getServiceLevelAggrements().getSLA().get(i).getAction().getSLAAction(), pol.getServiceLevelAggrements().getSLA().get(i).getGuid(), pol, AlertType.Performance); } } }
if (req.getMachineData() == null) { throw new IllegalArgumentException("The element MachineData must be specified and contain at least the current status information"); if (Utility.stringIsNullOrEmpty(req.getMachineData().getUri())) { throw new IllegalArgumentException("The element MachineData must specify a uri representing the system, typically in the format urn:hostname:system"); + "(uri, memoryused, percentcpu, id, utcdatetime, threads, startedat) " + "VALUES (?, ?, ?, ?, ? ,?, ?);"); com.setString(1, Utility.truncate(req.getMachineData().getUri(), MAXTEXT)); if (req.getMachineData().getBytesusedMemory() == null) { com.setNull(2, java.sql.Types.BIGINT); } else { com.setLong(2, req.getMachineData().getBytesusedMemory()); if (req.getMachineData().getPercentusedCPU() == null) { com.setNull(3, java.sql.Types.INTEGER); } else { com.setLong(3, req.getMachineData().getPercentusedCPU().intValue()); req.getMachineData().setId(id.toString()); com.setString(4, id.toString()); if (req.getMachineData().getTimestamp() == null) { com.setLong(5, now); } else { com.setLong(5, req.getMachineData().getTimestamp().getTimeInMillis()); if (req.getMachineData().getNumberofActiveThreads() == null) { com.setNull(6, java.sql.Types.BIGINT); } else {
if (cast != null && cast.CheckTransactionalRule(req.getMachineData(), x.getParameterNameValue(), f)) { sb = sb.append(f.get()); outFaultmsg.set(sb.toString() + " " + outFaultmsg.get());