/** * Sets the status of an item wrapper, sets policy type to status, machine * name to the current machine name, and domain to unspecified, parent * component to null, policies are auto created * * @param currenstatus * @param name * @param s * @param pooled * @deprecatedwrap */ @Deprecated public static void TryUpdateStatus(boolean currenstatus, String name, String s, boolean pooled) { TryUpdateStatus(currenstatus, name, s, pooled, PolicyType.STATUS, AuxHelper.UNSPECIFIED, SLACommon.GetHostName(), null, FLAGS.AUTO_CREATE); }
public static String getPolicyDisplayName(String uri){ ServicePolicy policy = SLACommon.LoadPolicyPooled(uri); if (policy==null){ //very unexpected return uri; } if (policy.getDisplayName()!=null && policy.getDisplayName().length()>0) return policy.getDisplayName(); return uri; } protected static boolean isPolicyTypeOf(String uri, PolicyType p) {
SetupBundle(); try { props = LoadSLAPropertiesPooled(); } else { props = LoadSLAPropertiesNotPooled(); from = new InternetAddress(props.getProperty("defaultReplyAddress")); if (pooled) { to = GetAllfgsmsAdminsEmailAddressPooled(); } else { to = GetAllfgsmsAdminsEmailAddressNotPooled(); Utility.encodeHTML(url), p.value(), props.getProperty("fgsms.GUI.URL")) + GenerateManageLink(url, props.getProperty("fgsms.GUI.URL")), bundle.getString("EmailEncodingType")); Transport.send(simpleMessage);
public static void AlertUserSLASubscribed(String subscribersUsername, List<String> subscribersEmail, SetAlertRegistrationsRequestMsg request, boolean pooled) { SetupBundle(); try { props = LoadSLAPropertiesPooled(); } else { props = LoadSLAPropertiesNotPooled(); sb = sb.append("<li>").append(Utility.encodeHTML(request.getItems().get(i).getServiceUri())).append(" - ").append(Utility.encodeHTML(request.getItems().get(i).getSLAID())).append("</li>"); sb = sb.append(bundle.getString("AlertSubscriptionBody2")).append(SLACommon.GenerateSubscriptionLink(props.getProperty("fgsms.GUI.URL"))); simpleMessage.setContent(sb.toString(), bundle.getString("EmailEncodingType")); Transport.send(simpleMessage);
private static void sendMailAlert(String htmlencodedText, String subject, InternetAddress[] subscribers, boolean pooled) { Properties props = null; if (pooled) { props = SLACommon.LoadSLAPropertiesPooled(); } else { props = SLACommon.LoadSLAPropertiesNotPooled();
p = SLACommon.LoadPolicyPooled(modifiedurl); } else { p = SLACommon.LoadPolicyNotPooled(modifiedurl); try { c = JMXConnectorFactory.connect(u, m); AuxHelper.TryUpdateStatus(true, modifiedurl, status, pooled, PolicyType.STATISTICAL, AuxHelper.UNSPECIFIED, SLACommon.GetHostName()); } catch (Exception ex) { AuxHelper.TryUpdateStatus(false, modifiedurl, ex.getLocalizedMessage(), pooled, PolicyType.STATISTICAL, AuxHelper.UNSPECIFIED, SLACommon.GetHostName()); req.setBrokerHostname(p.getMachineName()); req.setDomain(p.getDomainName()); req.setClassification(SLACommon.GetClassLevel(pooled)); req.setOperationalStatus(ok); req.setOperationalStatusMessage(status); SLACommon.ProcessStatisticalSLARules(req, pooled); c.close(); perfcon.close();
SetupBundle(); if (pooled) { pol = LoadPolicyPooled(req.getBrokerURI()); } else { pol = LoadPolicyNotPooled(req.getBrokerURI()); AtomicReference<String> ref = new AtomicReference<String>(); AtomicReference<AlertType> alertType = new AtomicReference<AlertType>(); if (processStatisticalSLARulesRecursive(req, pooled, pol.getServiceLevelAggrements().getSLA().get(i).getRule(), ref, alertType)) { String id = UUID.randomUUID().toString(); RecordSLAFault(new AtomicReference<String>(ref.get()), req.getBrokerURI(), null, System.currentTimeMillis(), id, pooled); ProcessAlerts(ref.get(), Utility.encodeHTML(ref.get()), req.getBrokerURI(), null, System.currentTimeMillis(), id, pooled, false, pol.getServiceLevelAggrements().getSLA().get(i).getAction().getSLAAction(), pol.getServiceLevelAggrements().getSLA().get(i).getGuid(), pol, alertType.get());
private static void SendMailAlert(String htmlencodedTest, SLAAction email, String slaguid, boolean pooled, String policyurl) { Properties props = null; if (pooled) { props = SLACommon.LoadSLAPropertiesPooled(); } else { props = SLACommon.LoadSLAPropertiesNotPooled(); subscribers = SLACommon.GetSubscribersPooled(slaguid); } else { subscribers = SLACommon.GetSubscribersNotPooled(slaguid); + SLACommon.GenerateManageLink(policyurl, props.getProperty("fgsms.GUI.URL")) + "<br><br>" + SLACommon.GenerateSubscriptionLink(props.getProperty("fgsms.GUI.URL")), SLACommon.getBundleString("EmailEncodingType")); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSendingEmail") + subscribers[i2].getAddress(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorUncaughtException"), ex);
public void ProcessNewTransaction(AddDataRequestMsg req, String transactionid) { ServicePolicy pol = SLACommon.LoadPolicyPooled(req.getURI()); Properties props = SLACommon.LoadSLAPropertiesPooled(); SLACommon.RecordSLAFault(ref, pol.getURL(), transactionid, time, incident, true); SLACommon.ProcessAlerts(ref.get(), ref.get() + "<br>" + GenerateLink(props.getProperty("fgsms.GUI.URL"), pol.getURL(), transactionid), pol.getURL(), transactionid, time, incident, true, false, pol.getServiceLevelAggrements().getSLA().get(i).getAction().getSLAAction(), pol.getServiceLevelAggrements().getSLA().get(i).getGuid(), pol, AlertType.Performance);
if (oldstatus != operational) { log.log(Level.INFO, "Trigger status change SLAs"); SLACommon.TriggerStatusChange(uri, oldstatus, oldstatusmsg, operational, message, true);
boolean sendTest(String email) { log.log(Level.INFO, "fgsms SLA Pusher test message"); try { Properties props = SLACommon.LoadSLAPropertiesPooled(); Session mailSession = Session.getDefaultInstance(props); Message simpleMessage = new MimeMessage(mailSession); InternetAddress from; if (Utility.stringIsNullOrEmpty(email)) { from = new InternetAddress(props.getProperty("defaultReplyAddress")); } else { from = new InternetAddress(email); } InternetAddress to = new InternetAddress(email); simpleMessage.setFrom(from); simpleMessage.setRecipient(Message.RecipientType.TO, to); simpleMessage.setSubject("fgsms SLA Processor Test Message"); simpleMessage.setContent("This is a test indicating that your fgsms SLA Processor is configured correctly." + "<br>" + "<a href=\"" + props.getProperty("fgsms.GUI.URL") + "\">fgsms</a>", "text/html; charset=ISO-8859-1"); Transport.send(simpleMessage); return true; } catch (Exception ex) { log.log(Level.ERROR, "Error sending SLA alert email! " + ex.getLocalizedMessage()); } return false; } private static String allitems = "All-Methods";
SLACommon.ProcessStatisticalSLARules(req, true);
SetupBundle(); try { props = LoadSLAPropertiesPooled(); } else { props = LoadSLAPropertiesNotPooled(); + SLACommon.GenerateSubscriptionLink(props.getProperty("fgsms.GUI.URL")), bundle.getString("EmailEncodingType")); Transport.send(simpleMessage); } catch (Exception e) {
SLACommon.TriggerStatusChange(name, oldstatus, oldstatusmsg, currenstatus, statusMessage, pooled);
/** * * Sets the status of an item wrapper, sets machine name to the current * machine name, and domain to unspecified, parent component to null, * policies are auto created * * @param currenstatus * @param name * @param s * @param pooled * @param p * @deprecated */ @Deprecated public static void TryUpdateStatus(boolean currenstatus, String name, String s, boolean pooled, PolicyType p) { TryUpdateStatus(currenstatus, name, s, pooled, p, AuxHelper.UNSPECIFIED, SLACommon.GetHostName(), null, FLAGS.AUTO_CREATE); }
MachinePolicy mp = (MachinePolicy) SLACommon.LoadPolicyPooled("urn:" + ret.getMachineData().get(i).getHostname() + ":system"); ret.getMachineData().get(i).setMachinePerformanceData(getCurrentMachinePerformanceData(mp));
if (oldstatus != req.isOperational()) { log.log(Level.INFO, "Trigger status change SLAs"); SLACommon.TriggerStatusChange(req.getURI(), oldstatus, oldstatusmsg, req.isOperational(), req.getMessage(), true);
public void run() { System.out.println("Control-C caught. Shutting down..."); running = false; while (!done) { try { Thread.sleep(1000); } catch (InterruptedException ex) { } } closeLock(); deleteFile(); if (!noloop) { AuxHelper.TryUpdateStatus(false, "urn:fgsms:DataPruner:" + Utility.getHostName(), "Stopped", false, PolicyType.STATUS, AuxHelper.UNSPECIFIED, SLACommon.GetHostName()); } } }
d.setDomainName(domainname); d.setHostname(hostname); ServicePolicy sp = SLACommon.LoadPolicyPooled(uri); if (!(sp instanceof MachinePolicy)) { throw new IllegalArgumentException("The requested URL is not of type Machine Policy");
public void run() { System.out.println("Control-C caught. Shutting down..."); running = false; while (!done) { try { Thread.sleep(1000); } catch (InterruptedException ex) { } } closeLock(); deleteFile(); if (!noloop) { AuxHelper.TryUpdateStatus(false, "urn:fgsms:Bueller:" + Utility.getHostName(), "Stopped", false, AuxHelper.UNSPECIFIED, SLACommon.GetHostName()); } } }