log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), x);
public static long GrabMTBF(long x, String URL) { Connection con = null; try { con = Utility.getPerformanceDB_NONPOOLED_Connection(); PreparedStatement comm = con.prepareStatement("select mtbf from agg2 where uri=? and soapaction=? and timerange=?"); // comm.setString(1, ; comm.setString(1, URL); comm.setString(2, allitems); comm.setLong(3, x); ResultSet rs = comm.executeQuery(); long ret = 0; if (rs.next()) { ret = rs.getLong(1); } rs.close(); comm.close(); con.close(); return ret; } catch (Exception ex) { log.log(Level.ERROR, null, ex); } try { con.close(); } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return 0; }
public static long GrabInvocationRate(long x, String URL) { Connection con = null; try { con = Utility.getPerformanceDBConnection(); PreparedStatement comm = con.prepareStatement("select success from agg2 where URI=? and soapaction=? and timerange=?"); comm.setString(1, URL); comm.setString(2, allitems); comm.setLong(3, x); ResultSet rs = comm.executeQuery(); long ret = 0; if (rs.next()) { ret = rs.getLong(1); } rs.close(); comm.close(); con.close(); return ret; } catch (Exception ex) { log.log(Level.ERROR, null, ex); } try { if (con != null && !con.isClosed()) { con.close(); } } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return 0; }
public static int GetCPUUsageOverTime(String pol, long timerange, boolean pooled) { Connection con = null; int ret = -1; try { con = Utility.getPerformanceDBConnection(); long limit = System.currentTimeMillis() - timerange; PreparedStatement com = con.prepareStatement("select avg(percentcpu) from rawdatamachineprocess where uri=? and utcdatetime > ?; "); com.setString(1, pol); com.setLong(2, limit); ResultSet rs = com.executeQuery(); if (rs.next()) { ret = (int) rs.getDouble(1); } rs.close(); com.close(); } catch (Exception ex) { log.log(Level.WARN, "trouble calculating avg cpu used for " + pol, ex); } try { if (con != null && !con.isClosed()) { con.close(); } } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return ret; }
public static long GetDiskUsageOverTime(String pol, long timerange, boolean pooled) { Connection con = null; long ret = -1; try { con = Utility.getPerformanceDBConnection(); long limit = System.currentTimeMillis() - timerange; PreparedStatement com = con.prepareStatement("select avg(diskKBs) from rawdatamachineprocess where uri=? and utcdatetime > ?; "); com.setString(1, pol); com.setLong(2, limit); ResultSet rs = com.executeQuery(); if (rs.next()) { ret = (long) rs.getDouble(1); } rs.close(); com.close(); } catch (Exception ex) { log.log(Level.WARN, "trouble calculating avg disk used for " + pol, ex); } try { if (con != null && !con.isClosed()) { con.close(); } } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return ret; }
public static long GetMemoryUsageOverTime(String pol, long timerange, boolean pooled) { Connection con = null; long ret = -1; try { con = Utility.getPerformanceDBConnection(); long limit = System.currentTimeMillis() - timerange; PreparedStatement com = con.prepareStatement("select avg(memoryused) from rawdatamachineprocess where uri=? and utcdatetime > ?; "); com.setString(1, pol); com.setLong(2, limit); ResultSet rs = com.executeQuery(); if (rs.next()) { ret = (long) rs.getDouble(1); } rs.close(); com.close(); } catch (Exception ex) { log.log(Level.WARN, "trouble calculating avg mmem used for " + pol, ex); } try { if (con != null && !con.isClosed()) { con.close(); } } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return ret; }
public static long GrabFaultRate(long timeInMs, String URL) { Connection con = null; try { con = Utility.getPerformanceDBConnection(); PreparedStatement comm = con.prepareStatement("select failure from agg2 where uri=? and soapaction=? and timerange=?"); // comm.setString(1,); comm.setString(1, URL); comm.setString(2, allitems); comm.setLong(3, timeInMs); ResultSet rs = comm.executeQuery(); long ret = 0; if (rs.next()) { ret = rs.getLong(1); } rs.close(); comm.close(); con.close(); return ret; } catch (Exception ex) { log.log(Level.ERROR, null, ex); } try { if (con != null && !con.isClosed()) { con.close(); } } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex); } return 0; }
log.log(Level.WARN, SLACommon.getBundleString("ErrorClosingDB"), ex);
@Override public void run() { try { AlertContainer poll = queue.poll(); if (poll != null) { SLACommon slac = new SLACommon(); do { slac.DoAlerts(poll); poll = queue.poll(); } while (poll != null); } SLAProcessorSingleton.setRunning(false); log.log(org.apache.log4j.Level.INFO, SLACommon.getBundleString("InternalAlertingSingletonStop")); } catch (Throwable t) { log.log(org.apache.log4j.Level.FATAL, SLACommon.getBundleString("InternalAlertingSingletonStop"), t); t.printStackTrace(); } } }
c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
private static void RegisterProducer(String t) { try { RegisterPublisher req = new RegisterPublisher(); TopicExpressionType localtopic = new TopicExpressionType(); if (Utility.stringIsNullOrEmpty(configuredWSN_DIALECT)) { localtopic.setDialect(WSNConstants.WST_TOPICEXPRESSION_SIMPLE); } else { localtopic.setDialect(configuredWSN_DIALECT); } if (Utility.stringIsNullOrEmpty(t)) { localtopic.getContent().add("fgsmsAlerts"); } else { localtopic.getContent().add(t); } req.getTopic().add(localtopic); RegisterPublisherResponse registerPublisher = notificationPort.registerPublisher(req); log.log(Level.INFO, String.format(SLACommon.getBundleString("WSNTopicRegisteredSuccess"), t)); isMainTopicRegistered = true; } catch (Exception ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("WSNTopicRegisteredFailed"), t), ex); } }
gcal.setTimeInMillis(laststatusat); Calendar xcal = gcal; faultMsg.append(SLACommon.getBundleString("ConsideredStale")).append(" ").append(xcal.toString()).append(" which was ").append(Utility.durationToString(df.newDuration(System.currentTimeMillis() - laststatusat))).append(" ago."); } catch (Exception ex) { java.util.logging.Logger.getLogger(NonTransactionalSLAProcessor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); faultMsg.append(SLACommon.getBundleString("ConsideredStale")).append(" ").append(laststatusat).append("ms (Epoch) ago.");
private static void SendLogger(String msg, SLAAction logAction, String url, String incident) { if (logAction != null) { NameValuePair GetNameValuePairByName = Utility.getNameValuePairByName(logAction.getParameterNameValue(), "Logger"); if (GetNameValuePairByName != null) { Logger l = null; if (GetNameValuePairByName.isEncrypted()) { l = Logger.getLogger(Utility.DE(GetNameValuePairByName.getValue())); } else { l = Logger.getLogger((GetNameValuePairByName.getValue())); } l.log(Level.WARN, SLACommon.getBundleString("SLALoggerPrefix") + url + " message: " + msg.toString() + " SLAFaultID: " + incident); } } else { log.warn("log action is null, defaulting"); log.log(Level.WARN, SLACommon.getBundleString("SLALoggerPrefix") + url + " message: " + msg.toString() + " SLAFaultID: " + incident); } }
c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; } catch (IllegalAccessException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); return false; log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
c = Thread.currentThread().getContextClassLoader().loadClass(x.getClassName()); } catch (ClassNotFoundException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; obj = c.newInstance(); } catch (InstantiationException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; } catch (IllegalAccessException ex) { log.log(Level.ERROR, SLACommon.getBundleString("ErrorSLAPluginRuleNCDF") + x.getClassName(), ex); return false; cast = (SLARuleInterface) obj; } catch (ClassCastException ex) { log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleTypeCast"), x.getClassName(), SLARuleInterface.class.getCanonicalName()), ex); return false; log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorSLAPluginRuleUnexpectedError"), x.getClassName()), ex);
perf.close(); } catch (Exception ex) { log.log(Level.WARN, SLACommon.getBundleString("ErrorInsertingRawDataTallyRecord"), ex); } finally { DBUtils.safeClose(c2); log.log(Level.ERROR, String.format(SLACommon.getBundleString("ErrorCreatingServicePolicy"), URL) + "policy type is unhandled!"); throw new NullPointerException(); retention = Long.parseLong(d.getKeyNameValue().getPropertyValue()); } catch (Exception ex) { log.log(Level.WARN, String.format(SLACommon.getBundleString("ErrorUnableToParse"), "defaultRetention" + p.value(), "Long"), ex); log.log(Level.DEBUG, String.format(SLACommon.getBundleString("ErrorCreatingServicePolicy"), URL), ex);
log.log(Level.WARN, SLACommon.getBundleString("ErrorUnableToRunSLAScript"), ex); } finally {
+ 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);