public static void readExtraItems(String s, ArrayList array) throws IOException { File file = new File(Platform.getRoot() + File.separator + "templates.view"); if (!file.exists()) { return; } String as[] = file.list(); if (as == null) { return; } for (int i = 0; i < as.length; i++) { File file1 = new File(file, as[i]); if (!file1.isDirectory()) { continue; } File file2 = new File(file1, s); if (!file2.exists()) { continue; } ArrayList array1 = FrameFile.readFromFile(file2.getAbsolutePath()); for (int j = 0; j < array1.size(); j++) { HashMap hashmap = (HashMap) array1.get(j); String s1 = TextUtils.getValue(hashmap, "_id"); s1 = file1.getName() + "-" + s1; hashmap.put("_id", s1); hashmap.put("_package", as[i]); array.add(hashmap); } } }
synchronized HashMap getLabels() { if (labelsCache == null) { labelsCache = new HashMap(); if (getProperty(pValueLabels).length() > 0) { String as[] = TextUtils.split(getProperty(pValueLabels), ","); for (int i = 0; i < as.length; i++) { String s1 = as[i]; String s2 = getNameFromIndex(i); labelsCache.add(s2, s1.trim()); } } else { for (int j = 0; j < maxNumberOfMatches; j++) { String s = getNameFromIndex(j); labelsCache.add(s, s); } } ArrayList array = getProperties(); Enumeration enumeration = (Enumeration) array.iterator(); do { if (!enumeration.hasMoreElements()) { break; } StringProperty stringproperty = (StringProperty) enumeration.nextElement(); if (stringproperty.isThreshold() && stringproperty.getName().indexOf("value") < 0) { labelsCache.add(stringproperty.getLabel(), stringproperty.getLabel()); } } while (true); } return labelsCache; }
String saveResultProps(Array array, int i) { String s = ""; HashMap hashmap = new HashMap(); for (int j = i; j < array.size(); j++) { String s1 = (String) array.get(j); int l = s1.indexOf('='); String s4 = s1.substring(0, l); String s5 = s1.substring(l + 1); hashmap.add(s4, s5); } for (int k = 1; k <= nMaxCounters; k++) { String s2 = getProperty(PROPERTY_NAME_COUNTER_ID + k); if (s2.length() <= 0) { break; } String s3 = (String) hashmap.get(s2); if (s3 != null) { setProperty(PROPERTY_NAME_COUNTER_VALUE + k, s3); if (s.length() > 0) { s = s + ", "; } } s = s + getProperty(PROPERTY_NAME_COUNTER_NAME + k) + "=" + getProperty(PROPERTY_NAME_COUNTER_VALUE + k); } return s; }
public String saveAdditionalSchedulePrefs() { HashMap hashmap = new HashMap(); StringBuffer stringbuffer = new StringBuffer(); String s = COM.dragonflow.Properties.ScheduleProperty.requestToScheduleString(request, stringbuffer); if (s.length() > 0) { hashmap.put("_schedule", s); } String s1 = request.getValue("name"); if (s1.length() == 0) { boolean flag = false; if (s.startsWith("*")) { flag = true; s1 = s.substring(1); } else { s1 = s; } String s2 = COM.dragonflow .Properties .ScheduleProperty .dayStrings[COM.dragonflow.Utils.TextUtils.dayLetterToNumber(s1.substring(0, 1))]; s1 = s1.substring(1); if (flag) { s2 = s2 + " at "; } else { if (s1.startsWith("D")) { s2 = "Disable on " + s2; } else { s2 = "Enable on " + s2; } s2 = s2 + " from "; s1 = s1.substring(1); } int i = s1.indexOf(","); String s4; if (i != -1) { s4 = s1.substring(0, i); } else { s4 = s1; } if (flag) { s2 = s2 + s4.replace('/', ','); } else { s2 = s2 + s4; } if (i != -1) { s2 = s2 + "..."; } s1 = s2; } hashmap.put("_name", s1); String s3 = saveAdditionalPrefs("Schedule", request.getValue("schedule_data"), hashmap); COM.dragonflow.SiteView.ScheduleManager schedulemanager = COM.dragonflow.SiteView.ScheduleManager.getInstance(); schedulemanager.updateSchedule(s3, (String) hashmap.get("_schedule")); return s3; }
public void addAlertTag(HashMap hashmap, String s, String s1) { hashmap.put(s, s1); if (!Action.isBaseEntry(s)) { String s2 = TextUtils.getValue(hashmap, "extraCount"); if (s2.length() == 0) s2 = "0"; s2 = TextUtils.increment(s2); hashmap.put("extra" + s2, s); hashmap.put("extraCount", s2); } }
public static void main(String args[]) { File file = new File(Platform.getRoot() + "/logs/alert.log"); AlertLogReader alertlogreader = new AlertLogReader(file); HashMap hashmap = new HashMap(); hashmap.put("alert-type", "Email"); ArrayList array = alertlogreader.process(hashmap, null, null, null); System.out.println("***************************************************"); for (int i = 0; i < array.size(); i++) { HashMap hashmap1 = (HashMap) array.get(i); System.out.println( TextUtils.dateToString((Date) hashmap1.get("date")) + " " + hashmap1.get("alert-message")); } }
public String verify( StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) { if (stringproperty == getPropertyObject(PROPERTY_NAME_BROWSABLE)) { String s1 = getProperty(PROPERTY_NAME_COUNTER_ID + 1); if (s1.length() <= 0) { String s2 = httprequest.getValue("browseDataError"); if (s2 != null && s2.length() > 0) { hashmap.put(stringproperty, s2); } else { hashmap.put(stringproperty, "No counters selected"); } } return s; } else { return super.verify(stringproperty, s, httprequest, hashmap); } }
COM.dragonflow.StandardAction.Page getPageObject(HashMap hashmap) { COM.dragonflow.SiteView.SiteViewObject siteviewobject = getSettingsGroup(); COM.dragonflow.StandardAction.Page page = new Page(); if (hashmap != null) { Enumeration enumeration = hashmap.keys(); do { if (!enumeration.hasMoreElements()) { break; } String s = (String) enumeration.nextElement(); if (s.startsWith("_schedule")) { page.setProperty(s, (String) hashmap.get(s)); } } while (true); } siteviewobject.addElement(page); return page; }
public String verify( StringProperty stringproperty, String s, HTTPRequest httprequest, HashMap hashmap) { if (stringproperty == pParameters) { if (TextUtils.hasChars(s, "`;&")) { hashmap.put(stringproperty, "script parameters have illegal characters"); } } else if (stringproperty == pExpression) { String s1 = TextUtils.legalMatchString(s); if (s1.length() > 0) { hashmap.put(stringproperty, s1); } } else if (stringproperty == pLocalScriptLocation) { String s2 = getProperty(pLocalScriptLocation); if (s2.length() == 0) { hashmap.put(stringproperty, "Specified local Scripts location must be non zero-length"); } } return super.verify(stringproperty, s, httprequest, hashmap); }
/** * CAUTION: Decompiled by hand. * * @param hashmap * @param array * @param hashmap1 */ public void addAlertEntry(HashMap hashmap, ArrayList array, HashMap hashmap1) { if (hashmap1 != null) { Enumeration enumeration = hashmap1.keys(); Object obj = null; String s1 = null; while (enumeration.hasMoreElements()) { String s = (String) enumeration.nextElement(); if (!s.equals(s1)) { String s2 = ""; s2 = TextUtils.getValue(hashmap, s); if (s.equals("alert-type")) { String s3 = TextUtils.getValue(hashmap, "alert-id"); s2 = TextUtils.readStringFromEnd(s3, ":"); } else if (s.equals("alert-id")) s2 = TextUtils.readStringFromStart(s2, ":"); else if (s.equals("alert-monitor-id")) s2 = TextUtils.readStringFromStart(s2, ":"); if (hashmap1.countValues(s2) > 0) array.add(hashmap); s1 = s; } } } }
/** * CAUTION: Decompiled by hand. * * @param s * @return * @throws IOException */ private String getCommandFromLocalFile(String s) throws IOException { String s1; s1 = (String) scriptCommands.get(s); if (s1 == null) { try { s1 = FileUtils.readFile(Platform.getUsedDirectoryPath("scripts.remote", "") + "//" + s) .toString(); } catch (FileNotFoundException filenotfoundexception) { int i = 0; for (; i < 10; i++) { try { s1 = FileUtils.readFile(Platform.getUsedDirectoryPath("scripts.remote", "") + "//" + s) .toString(); if (s1 == null) { continue; } } catch (FileNotFoundException filenotfoundexception1) { try { Thread.currentThread(); Thread.sleep(100L); } catch (InterruptedException interruptedexception) { interruptedexception.printStackTrace(); } } } if (i == 10) { throw filenotfoundexception; } } scriptCommands.add(s, s1); } return s1; }
void printMessageForm(String s, String s1) throws java.io.IOException { java.lang.Object obj = null; if (request.isPost()) { StringBuffer stringbuffer = new StringBuffer(); obj = new HashMapOrdered(true); ((HashMap) (obj)).put("title", request.getValue("title")); if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "title").length() == 0) { COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "title missing"); } ((HashMap) (obj)).put("product", request.getValue("product")); String s3 = ""; for (Enumeration enumeration = request.getValues("topic"); enumeration.hasMoreElements(); ) { String s5 = (String) enumeration.nextElement(); if (s3.length() > 0) { s3 = s3 + ","; } s3 = s3 + s5; } ((HashMap) (obj)).put("topics", s3); if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "topics").length() == 0) { COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "at least one topic required"); } ((HashMap) (obj)).put("body", request.getValue("body")); if (COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "body").trim().length() == 0) { COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "body of note missing"); } ((HashMap) (obj)).put("weight", request.getValue("weight")); ((HashMap) (obj)).put("releases", request.getValue("releases")); ((HashMap) (obj)).put("author", request.getValue("author")); ((HashMap) (obj)).put("id", request.getValue("id")); ((HashMap) (obj)) .put( "updated", COM.dragonflow.Utils.TextUtils.prettyDateDate( COM.dragonflow.Utils.TextUtils.prettyDate( COM.dragonflow.SiteView.Platform.timeMillis()))); String s6 = request.getValue("idnum"); if (s6.length() == 0) { HashMap hashmap1 = getMasterConfig(); String s9 = COM.dragonflow.Utils.TextUtils.getValue(hashmap1, "_developerNoteNextID"); int i = COM.dragonflow.Utils.TextUtils.toInt(s9); if (i < 10000) { i = 10000; } for (java.io.File file2 = new File(s1 + "noteDN" + i + ".htm"); file2.exists(); file2 = new File(s1 + "noteDN" + i + ".htm")) { i++; } s6 = "DN" + i; i++; hashmap1.put("_developerNoteNextID", "" + i); saveMasterConfig(hashmap1); } ((HashMap) (obj)).put("idnum", s6); ((HashMap) (obj)).put("filename", "note" + s6 + ".htm"); String s8 = s1 + "noteInternalTemplate.txt"; String s10 = COM.dragonflow.Utils.FileUtils.readFile(s8).toString(); if (s10.length() == 0) { COM.dragonflow.Utils.TextUtils.addToBuffer(stringbuffer, "could not find template " + s8); } if (stringbuffer.length() > 0) { outputStream.println("<HR><H2>" + stringbuffer.toString() + "</H2><HR><P>"); } else { SiteViewMain.SupportNoteUtils.writeNoteFile(s1, ((HashMap) (obj)), s10); java.io.File file1 = new File(NOTE_CACHE_FILENAME); if (file1.exists()) { file1.delete(); } printRefreshPage("/SiteView/cgi/go.exe/SiteView?page=developerNote", 0); return; } } String s2 = s + " Developer Note"; printBodyHeader(s2); if (obj == null) { String s4 = request.getValue("idnum"); if (s4.length() > 0) { java.io.File file = new File(s1 + "note" + s4 + ".htm"); if (file.exists()) { obj = SiteViewMain.SupportNoteUtils.readNote(file); } else { outputStream.println("<HR><H3>Could not read note file " + file + "</H3><HR><P>"); } } } if (obj == null) { obj = new HashMapOrdered(true); } HashMap hashmap = new HashMap(); for (Enumeration enumeration1 = ((HashMap) (obj)).values("topic"); enumeration1.hasMoreElements(); hashmap.put(enumeration1.nextElement(), "true")) {} String s7 = ""; ArrayList array = COM.dragonflow.Properties.FrameFile.readFromFile(s1 + "topics.txt"); for (Enumeration enumeration2 = (Enumeration) array.iterator(); enumeration2.hasMoreElements(); ) { HashMap hashmap2 = (HashMap) enumeration2.nextElement(); String s11 = COM.dragonflow.Utils.TextUtils.getValue(hashmap2, "id"); String s13 = COM.dragonflow.Utils.TextUtils.getValue(hashmap2, "title"); String s15 = ""; if (hashmap.get(s11) != null) { s15 = " selected"; } s7 = s7 + "<option " + s15 + " value=\"" + s11 + "\">" + s13 + "\n"; } ArrayList array1 = new ArrayList(); array1.add("common"); array1.add("common"); array1.add("frequent"); array1.add("frequent"); array1.add("normal"); array1.add("normal"); array1.add("infrequent"); array1.add("infrequent"); array1.add("rare"); array1.add("rare"); String s12 = COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "weight"); if (s12.length() == 0) { s12 = "normal"; } String s14 = COM.dragonflow.Page.developerNotePage.getOptionsHTML(array1, s12); ArrayList array2 = new ArrayList(); array2.add("SiteView,SiteSeer"); array2.add("SiteView and SiteSeer"); array2.add("SiteSeer"); array2.add("SiteSeer only"); array2.add("SiteView"); array2.add("SiteView all platforms"); array2.add("SiteView NT"); array2.add("SiteView NT"); array2.add("SiteView Unix"); array2.add("SiteView Unix"); array2.add("CentraScope"); array2.add("CentraScope"); String s16 = COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "product"); if (s16.length() == 0) { s16 = "SiteView,SiteSeer"; } String s17 = COM.dragonflow.Page.developerNotePage.getOptionsHTML(array2, s16); outputStream.println("<p><H2>" + s2 + "</H2>"); outputStream.println( "Use this form to add a note to the developer note database. Every night, the developernote index is updated on the internal web site.<p>"); outputStream.println( "<FORM ACTION=/SiteView/cgi/go.exe/SiteView method=POST><input type=hidden name=page value=developerNote><input type=hidden name=account value=" + request.getAccount() + ">" + "<BLOCKQUOTE><DL>" + "<DT><B>Title:</B> <input type=text name=title size=80 value=\"" + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "title") + "\"><BR>" + "<DD><P>" + "<DT><B>Note applies to:</B> <select name=product>" + s17 + "</select>" + "<DD><P>" + "<DT><B>Topics</B>" + "<DD><TABLE>" + "<tr><td><select name=topic size=10 multiple>" + s7 + "</select>" + "</TABLE>" + "<DT>This is a <select name=weight>" + s14 + "</select> question\n" + "<DD><P>" + "<DT><B>Author:</B> <input type=text name=author size=50 value=\"" + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "author") + "\"><BR>" + "<DD>Your name so that people who have more questions can contact you<P>" + "<DT><B>Releases:</B> <input type=text name=releases size=50 value=\"" + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "releases") + "\"><BR>" + "<DD>enter one or more releases that this note applies to<P>" + "</DL></BLOCKQUOTE>" + "<B>Notes:</B>" + "<textarea cols=80 rows=12 name=body>" + COM.dragonflow.Utils.TextUtils.escapeHTML( COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "body")) + "</textarea><BR>" + "<input type=hidden name=idnum value=\"" + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "idnum") + "\">\n" + "<input type=hidden name=id value=\"" + COM.dragonflow.Utils.TextUtils.getValue(((HashMap) (obj)), "id") + "\">\n" + "<input type=hidden name=operation value=\"" + s + "\">\n" + "<P><input type=submit name=send value=\"Save Developer Note\"><P>" + "</FORM>"); printFooter(outputStream); }
public void setMaxCounters(int i) { nMaxCounters = i; HashMap hashmap = MasterConfig.getMasterConfig(); hashmap.put("_DispatcherMaxCounters", (new Integer(i)).toString()); MasterConfig.saveMasterConfig(hashmap); }
public ArrayList process(HashMap hashmap, Date date, Date date1, HashMap hashmap1) { SiteViewGroup siteviewgroup = SiteViewGroup.currentSiteView(); long l = siteviewgroup.getSettingAsLong("_alertLogReadChunkSize", 0x19000); ArrayList array = new ArrayList(); if (logfile == null || !logfile.exists()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " does not exist"); return array; } if (!logfile.canRead()) { LogManager.log("Error", "Alert log " + logfile.getAbsolutePath() + " cannot be read"); return array; } boolean flag = false; String s = logfile.getAbsolutePath(); long l1 = Platform.FILE_NEWLINE.length(); long l2 = logfile.length(); boolean flag1 = false; if (hashmap1 != null) flag1 = !hashmap1.isEmpty(); long l3 = 0L; long l4 = 0x7fffffffffffffffL; if (date != null) l3 = date.getTime(); if (date1 != null) l4 = date1.getTime(); long l5 = 0x7fffffffffffffffL; long l6 = 0L; Braf braf = null; try { do { if (flag) break; long l7 = l2 - l; long l8 = l2; l2 = -1L; if (l7 < 0L) l7 = 0L; long l9 = l7; braf = new Braf(s, l7); HashMap hashmap2 = null; ArrayList array1 = new ArrayList(); String s2 = ""; StringBuffer stringbuffer = new StringBuffer(); label0: do { String s1; do if ((s1 = braf.readLine()) == null) break label0; while (s1.indexOf("<pre>") >= 0); if (isDateLine(s1) && getDateInfo(s1, lineDate)) { if (l2 < 0L) l2 = l9 - 1L; if (hashmap2 != null) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } addAlertEntry(hashmap2, array1, hashmap); } Date date2 = getDate(lineDate); long l10 = date2.getTime(); hashmap2 = null; if (l10 >= l3 && l10 <= l4) if (flag1) { if (ScheduleProperty.isEnabled(hashmap1, date2)) { hashmap2 = new HashMap(); hashmap2.put("date", date2); } } else { hashmap2 = new HashMap(); hashmap2.put("date", date2); } if (l10 < l5) l5 = l10; if (l10 > l6) l6 = l10; } else if (hashmap2 != null) if (s1.startsWith(ALERT_LINE_PREFIX)) { if (s2.length() > 0) { addAlertTag(hashmap2, s2, stringbuffer.toString()); s2 = ""; stringbuffer.setLength(0); } int i = s1.indexOf(COLON_SUFFIX); if (i >= 0) { s2 = s1.substring(1, i); stringbuffer.setLength(0); stringbuffer.append(s1.substring(i + COLON_SUFFIX.length())); } } else if (s2.length() > 0) { if (stringbuffer.length() > 0) stringbuffer.append("\n"); stringbuffer.append(s1); } l9 += (long) s1.length() + l1; } while (l9 < l8); if (hashmap2 != null) { if (s2.length() > 0) addAlertTag(hashmap2, s2, stringbuffer.toString()); addAlertEntry(hashmap2, array1, hashmap); } for (int j = 0; j < array.size(); j++) array1.add(array.get(j)); array = array1; if (l7 == 0L) flag = true; braf.close(); braf = null; if (l5 <= l3 && l6 >= l4) flag = true; } while (true); } catch (IOException ioexception) { LogManager.log("Error", "I/O error reading file: " + s); System.out.println("I/O error reading file: " + s); } finally { if (braf != null) try { braf.close(); } catch (IOException ioexception1) { } } return array; }
/** CAUTION: Decompiled by hand. */ protected boolean update() { long l = Platform.timeMillis(); int i = -1; String[] as = (new String[] {""}); String s = getProperty(pExpression); long l1 = getPropertyAsLong(pMaxMeasurement); int j = getPropertyAsInteger(pCacheLife); boolean flag = j > 0; ArrayList array = new ArrayList(); String s1 = ""; try { String s2 = I18N.toDefaultEncoding(getProperty(pScript)); String s3 = I18N.toDefaultEncoding(getProperty(pRemoteScript)); String s4 = null; String s7 = I18N.toDefaultEncoding(getProperty(pLocalScriptLocation)); if (s7.length() == 0) { s7 = "scripts"; } else if (s7.indexOf("../") >= 0 || s7.indexOf("..\\") >= 0) { failMonitorRun(i, "Illegal Script Location contains ../ construct"); return true; } s1 = getProperty(pMachineName); if (Machine.isNTSSH(s1) && s2.equals("USE COMMAND")) { failMonitorRun(i, "Can't use this option with remote NT ssh connection"); return true; } if (Platform.isRemote(s1) && Machine.getMachine(s1) == null) { failMonitorRun(i, "Remote host unreachable"); return true; } if (Platform.isNTRemote(s1) && !Machine.isNTSSH(s1)) { failMonitorRun(i, "NT host must be configured as NT ssh remote "); return true; } if (s3.equals("none") && s2.equals("USE COMMAND")) { failMonitorRun(i, "Need to specify a script"); return true; } if (s3.length() != 0 && !s3.equals("none")) { try { s4 = getCommandFromLocalFile(s3); s4 = TextUtils.replaceParameters(s4, getParameters(), getReplacementChars()); } catch (IOException ioexception) { LogManager.log("Error", " File load error " + ioexception.toString()); setProperty(pNoData, "n/a"); } } else { if (!Platform.isRemote(s1)) { String s8 = Platform.getRoot() + "/" + s7 + "/" + s2; File file = new File(s8); s4 = file.getAbsolutePath(); } else { String s9 = "scripts" + Machine.getMachinePathSeparator(s1) + s2; OSAdapter osadapter = Machine.getAdapter(s1); if (osadapter != null) { CommandLine commandline = new CommandLine(); String s11 = osadapter.getCommandSetting("fileExists", "changeDirectory"); if (s11.length() > 0) { s4 = s11; } else { s4 = "/usr/bin/cd"; } commandline.exec(s4, s1, Platform.getLock(s1)); } RemoteFile remotefile = new RemoteFile(s1, s9); s4 = remotefile.getFullPath(); } s4 = s4 + " " + getParameters(); System.out.println("Script: " + s4); } LogManager.log("RunMonitor", "Script monitor command: " + s4 + ", machine: " + s1); String s10 = s1; if (s10.startsWith("\\\\")) { s10 = s10.substring(2); } Machine machine = Machine.getNTMachine(s10); int j1 = getPropertyAsInteger(pTimeout) * 1000; if (j1 < 0) { j1 = getSettingAsLong("_scriptMonitorTimeout", -1) * 1000; } String s12 = getScriptServerName(s1); String s14 = getProperty(pScript).equals("USE COMMAND") ? getProperty(pRemoteScript) : getProperty(pScript); ScriptMonitorCache scriptmonitorcache = new ScriptMonitorCache(s12, s14, getPropertyAsInteger(pCacheLife)); if (!flag && alertDebug) { System.out.println("Caching is disabled."); } boolean flag1 = scriptmonitorcache.isFresh(); if (flag && flag1 && scriptmonitorcache.getExitValue() == 0) { if (alertDebug) { System.out.println( "Caching is enabled, the cache life time is set to: " + getPropertyAsInteger(pCacheLife)); } if (alertDebug) { System.out.println( "The cache is still good, not exec'ing script, cache last modified on: " + scriptmonitorcache.getLastModDate()); } array = scriptmonitorcache.getOutput(); i = scriptmonitorcache.getExitValue(); } else if (machine != null && Machine.isNTSSH(s10)) { if (s4.indexOf("\\\\" + s10) > 0) { s4 = TextUtils.replaceString(s4, "\\\\" + s10, ""); } s4 = "scripts\\" + s4.substring(s4.indexOf(s2)); if (j1 > 0) { s4 = CommandLine.getExecSyncCmd(s10, s4, j1, true); } SSHCommandLine sshcommandline = new SSHCommandLine(); array = sshcommandline.exec(s4, machine, false); i = sshcommandline.exitValue; } else { CommandLine commandline1 = new CommandLine(); array = commandline1.exec(s4, s1, Platform.monitorLock, j1); i = commandline1.getExitValue(); } if (flag && !flag1) { if (alertDebug) { System.out.println("Exec'd script and updating cache."); } scriptmonitorcache.update(i, array); } if (i < 0) { String s16 = "Failed to run script"; if (i == Monitor.kURLTimeoutError) { s16 = "Script timed out"; } failMonitorRun(i, s16); return true; } StringBuffer stringbuffer1 = new StringBuffer(); String s17; Enumeration enumeration = (Enumeration) array.iterator(); while (enumeration.hasMoreElements()) { s17 = (String) enumeration.nextElement(); LogManager.log("RunMonitor", "Script monitor machine " + s1 + " output: " + s17); if (s17.startsWith(CommandLine.PERFEX_EXECSYNC_TIMEOUT)) { failMonitorRun(-1, "Error: Timeout"); return true; } if (s17.indexOf("not found") > 0 || s17.indexOf("Not Found") > 0 || s17.indexOf("denied") > 0 || s17.indexOf("Denied") > 0 || s17.indexOf("cannot execute") > 0 || s17.indexOf("such file or directory") > 0) { failMonitorRun(-1, s17); return true; } stringbuffer1.append(s17); stringbuffer1.append("\n"); if (s.length() > 0 && !TextUtils.isRegularExpression(s) && s17.indexOf(s) != -1) { long l4 = TextUtils.findLong(s17, "", ""); if (l4 != -1L) { as[0] = String.valueOf(l4); } } } if (TextUtils.isSubstituteExpression(s)) { s = TextUtils.substitute(s, this); } if (s.length() > 0 && TextUtils.isRegularExpression(s)) { String s18 = stringbuffer1.toString(); Perl5Util perl5util = new Perl5Util(); if (perl5util.match(s, s18)) { int i2 = perl5util.groups(); if (i2 > 0) { if (i2 == 1) { as = new String[i2]; as[0] = perl5util.group(0); } else { if (--i2 > maxNumberOfMatches) { i2 = maxNumberOfMatches; } as = new String[i2]; for (int j2 = 0; j2 < as.length && j2 < maxNumberOfMatches; j2++) { as[j2] = perl5util.group(j2 + 1); } } } } else { failMonitorRun(-1, "Content Match Error"); return true; } } } catch (Exception exception) { LogManager.log("RunMonitor", "Script monitor error: " + exception + " machine: " + s1); setProperty(pNoData, "n/a"); } LogManager.log("RunMonitor", "Script monitor exit: " + i + " machine: " + s1); setProperty(pScriptOutput, ""); if (as[0].trim().length() == 0) { as[0] = "n/a"; long l2 = getSettingAsLong("_scriptMonitorLinesToSave", 25); String s5 = ""; for (int k = 0; k < array.size() && (long) k < l2; k++) { s5 = s5 + array.get(k); s5 = s5 + "^"; } s5 = s5.replace('\r', ' '); s5 = s5.replace('\n', '^'); setProperty(pScriptOutput, s5); } long l3 = Platform.timeMillis() - l; String s6 = TextUtils.floatToString((float) l3 / 1000F, 2) + " sec"; if (stillActive()) { synchronized (this) { for (int i1 = 0; i1 < as.length; i1++) { setProperty(pMatchValue[i1], as[i1]); } setProperty(pStatus, i); if (i != 0) { setProperty(pNoData, "n/a"); } setProperty(pRoundTripTime, l3); setProperty(pMeasurement, getMeasurement(pRoundTripTime, l1)); if (s.length() > 0) { HashMap hashmap = getLabels(); StringBuffer stringbuffer = new StringBuffer(); for (int k1 = 0; k1 < as.length; k1++) { String s13 = getNameFromIndex(k1); String s15 = (String) hashmap.get(s13); if (s15 == null) { s15 = s13; } stringbuffer.append(s15 + "=" + as[k1] + (k1 >= as.length - 1 ? "" : ",")); } setProperty(pStateString, stringbuffer); } else { setProperty(pStateString, "exit: " + i + ", " + s6); } } } return true; }