home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / AdminAlertFunc3.js < prev    next >
Encoding:
JavaScript  |  2003-06-24  |  27.3 KB  |  721 lines

  1. /* ======================================================================
  2. DESC: Common Alert Functions for the Administer/Analyze Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5.  
  6. USAGE NOTES: 
  7. ====================================================================== */
  8.  
  9. var WatchTypes = new Array("","CounterWatch","EventLogWatch","WinServiceWatch", "FileWatch","SNMPTrapWatch","SyslogWatch","ServerWatch","ProcessWatch");
  10. var WatchTypeImage = new Array("","Objects","sEventViewer","WinServices", "NewImg","SNMPTrapDisplaySm","SyslogDisplaySm","sAdminServers","ProcessWatch");
  11.  
  12. var COUNTER_WATCH = 1;
  13. var EVENTLOG_WATCH = 2;
  14. var WINSERVICE_WATCH    = 3;
  15. var FILE_WATCH    = 4;
  16. var SNMPTRAP_WATCH =    5;
  17. var SYSLOG_WATCH = 6;
  18. var SERVER_WATCH = 7;
  19. var PROCESS_WATCH = 8;
  20.  
  21. var WatchDetailsArr = new Array();
  22. var WatchDetailsIx = 0;
  23. var CurrentWatchReportType = 0;
  24. var CurrentAT_Save;
  25. var WRCount = 0;
  26.  
  27. function processWatchReportButton() {
  28.     SetButtonState(WatchReportButton,"1");
  29.     CurrentAT_Save = CurrentAT;
  30.     CurrentAT = WatchReportType;
  31.     PopUpContextOpen();
  32.     PopUpSelectDiv.style.display = ""; // enable Pop-Up
  33.     AL_CCOneWatchReport.innerHTML = "";
  34.      processInitialLookup("WatchReport");
  35. }
  36. var WRComputerCountTotal = 0;
  37. var WRComputerCountCurrent = 0;
  38. function processWRSelectDoneButton() {
  39.     var CompSelectedArr = ""; // reset
  40.     if ( !createElmArray() ) {
  41.         alert("Please select one or more servers/devices for the Watch/Alert Report");
  42.         return;
  43.     }
  44.     CompSelectedArr = ELM_Ar.join(",");
  45.     WRComputerCountTotal = ELM_Ar.length;
  46.     WRComputerCountCurrent = 0;
  47.     
  48.     PopUpSelectDiv.style.display = "none"; 
  49.     PopUpContextClose();
  50.     SetButtonState(UUpdateButton,"1");
  51.     SetButtonState(UResetButton,"1");
  52.  
  53.     CurrentAT = CurrentAT_Save;
  54.     AL_CCOneWatchReport.innerHTML = "";
  55.       SetCursor("wait");
  56.     top.banner.processStartComm(); 
  57.     top.Rstatus.Pstat("One moment while Watch/Alert Details are retrieved and displayed",true);
  58.  
  59.       RpmCC_AL.NetStatFunction("GetWatchDetails~"+CompSelectedArr);
  60.       
  61.     CounterUI.style.display="none";
  62.     SchedUI.style.display="none";
  63.     ActsUI.style.display="none";
  64.  
  65.     WatchReport.style.display = "";
  66.     SetButtonState(WatchRepOKButton,"1");
  67.     SetButtonState(WatchRepPrintButton,"1");
  68.     
  69.     var dtb = document.all["repwatch"];
  70.     dtb.style.display = "";
  71.     dtb.innerHTML = ""; // clear details      
  72. }
  73. function processWRSelectCancelButton() {
  74.     PopUpSelectDiv.style.display = "none"; 
  75.     PopUpContextClose();
  76.     SetButtonState(UUpdateButton,"1");
  77.     SetButtonState(UResetButton,"1");
  78.  
  79.     CurrentAT = CurrentAT_Save;
  80.     AL_CCOneWatchReport.innerHTML = "";
  81.     SetButtonState(WatchReportButton,"0");
  82. }
  83.  
  84. function processWatchRepOKButton() {
  85.     top.Rstatus.Pstat("");
  86.     WatchReport.style.display = "none";
  87.     processGeneralClick(CounterTab);
  88. }
  89.  
  90. function processWatchReportBegin() {
  91.     WatchDetailsArr.length = 0;
  92.     WatchDetailsIx = 0;
  93.     WRCount = 0;
  94.     WOIx = 0;    
  95.     WatchReportEndReceived = false;
  96.     
  97.     /* Format Details for output */
  98.     var sob = "";
  99.       sob += "<center><table border='1' cellpadding='0' cellSpacing='0' width='620'>";
  100.     sob += "<tr><td width='100%' colspan='2' align='center' style='background-color:activeborder' class='optextb'>";
  101.     sob += "Watch/Alert Report"
  102.     sob += "</td></tr></table></center>";
  103.  
  104.     var dtb = document.all["repwatch"];
  105.    dtb.insertAdjacentHTML("beforeEnd",sob);
  106.     dtb.style.overflow = (dtb.scrollHeight >= dtb.clientHeight) ? "scroll" : "";    
  107.     WRTid = setTimeout("processWatchReportOutputThread()",100); 
  108. }
  109. function processWatchReportData(csArg) {
  110.     WatchDetailsArr[ WatchDetailsIx ] = csArg;
  111.     WatchDetailsIx++
  112. }
  113.  
  114. var WRTid = null;
  115. var WOIx = 0;
  116. var WatchReportEndReceived = false;
  117. function processWatchReportOutputThread() {
  118.     WRTid = null; //reset    
  119.     while ( WOIx < WatchDetailsIx ) {
  120.         processWatchReportOutput(WOIx);
  121.         ++WOIx;
  122.     }
  123.     if ( WatchReportEndReceived == false ) {
  124.         WRTid = setTimeout("processWatchReportOutputThread()",100); 
  125.         return;
  126.     }
  127.  
  128.       SetCursor("auto");
  129.     top.banner.processStopCommX();
  130.     SetButtonState(WatchReportButton,"0");        
  131.     SetButtonState(WatchRepOKButton,"0");
  132.     SetButtonState(WatchRepPrintButton,"0");
  133.     top.Rstatus.Pstat("Done",true);
  134.  
  135.     var sob = "";
  136.       sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  137.     sob += "<tr height='3'><td width='100%' class='optext'><hr size='2' style='color:c8c8c8'></td></tr></table>";
  138.     
  139.     var dtb = document.all["repwatch"];
  140.    dtb.insertAdjacentHTML("beforeEnd",sob);
  141.     dtb.style.overflow = (dtb.scrollHeight >= dtb.clientHeight) ? "scroll" : "";
  142. }
  143.  
  144. function processWatchReportEnd() {
  145.     WatchReportEndReceived = true;
  146. }
  147. function processWatchReportOutput(windex) {
  148.         var warr = new Array();
  149.         var i = windex;
  150.         var sob = "";
  151.     
  152.         warr = WatchDetailsArr[i].split("~");
  153.         switch ( warr[1] ) {
  154.         
  155.            case "ComputerInfo" : 
  156.                ++WRComputerCountCurrent;
  157.                 top.Rstatus.Pstat("One moment while Watch/Alert Details are retrieved; Processing "+WRComputerCountCurrent+" of "+WRComputerCountTotal,true);
  158.                if ( i > 0 ) { 
  159.                        sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  160.                       sob += "<tr height='3'><td width='100%' class='optext'><hr size='2' style='color:c8c8c8'></td></tr></table>";
  161.  
  162.                       sob += "<center style='page-break-before: always'><table border='1' cellpadding='0' cellSpacing='0' width='620'>";
  163.                     sob += "<tr><td width='100%' colspan='2' align='center' style='background-color:activeborder' class='optextb'>";
  164.                     sob += "Watch/Alert Report"
  165.                     sob += "</td></tr></table></center>";           
  166.                }
  167.                
  168.                 sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  169.                 sob += "<tr height='3'><td width='100%' class='optext'><hr size='2' style='color:c8c8c8'></td></tr></table>";
  170.  
  171.                sob += "<center><table border='1' cellpadding='0' cellSpacing='0' width='620'>";
  172.                  sob += "<tr style='background-color:c8c8c8'>";
  173.                  sob += "<td style='border-width:0' width='60' align='left' class='optextn'> Name</td>"
  174.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[5] +"</td></tr>";
  175.                  
  176.                   sob += "<tr style='background-color:c8c8c8'>";
  177.                 sob += "<td style='border-width:0' width='60' align='left' class='optextn'> Descr</td>"
  178.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[6] +"</td></tr>";
  179.                  
  180.                   sob += "<tr style='background-color:c8c8c8'>";
  181.                 sob += "<td style='border-width:0' width='60' align='left' class='optextn'> Addr</td>"
  182.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[10] +"</td></tr>";
  183.                  
  184.                  sob += "<tr style='background-color:c8c8c8'>";
  185.                  sob += "<td style='border-width:0' width='60' align='left' class='optextn'> OS Ver</td>"
  186.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[7] +"</td></tr>";
  187.                  
  188.                  sob += "<tr style='background-color:c8c8c8'>";
  189.                  sob += "<td style='border-width:0' width='60' align='left' class='optextn'> Agent</td>"
  190.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[8] +"</td></tr>";
  191.                  
  192.                  sob += "<tr style='background-color:c8c8c8'>";
  193.                  sob += "<td style='border-width:0' width='60' align='left' class='optextn'> Domain</td>"
  194.                  sob += "<td style='font-size:11pt; border-width:0' width='*' align='left' class='optext'>: " + warr[9] +"</td></tr>";
  195.                 sob += "</table></center>";
  196.                   break;
  197.                  
  198.            case "NewWatch" : 
  199.                CurrentWatchReportType = parseInt(warr[2],10);
  200.                  sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  201.                 sob += "<tr height='3'><td width='100%' class='optext'><hr size='2' style='color:c8c8c8'></td></tr></table>";
  202.  
  203.                sob += "<center><table border='1' cellpadding='0' cellSpacing='0' width='620'>";
  204.                  sob += "<tr style='background-color:d8d8d8'><td width='20' align='center' style='border-width:0'>";
  205.                  sob += "<img src='images/" + WatchTypeImage[CurrentWatchReportType] +".gif' align='absmiddle' height='16' width='16'></td>";
  206.                 sob += "<td width='*' align='left' class='optextb' style='border-width:0'> ";
  207.                 sob += WatchTypes[CurrentWatchReportType] + "</td></tr></table></center>";
  208.                 WRCount = 0;
  209.                   break;
  210.                   
  211.            default : 
  212.                 sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  213.                 sob += "<tr height='3'><td width='100%' class='optext'><hr size='2' style='color:c8c8c8'></td></tr></table>";
  214.                 
  215.                 var bgColor
  216.                var parr = new Array();
  217.                var garr = new Array();
  218.                var marr = new Array();
  219.                parr = WatchDetailsArr[i].split("<+>");
  220.                garr = parr[1].split("~");
  221.                var garrd = new Array();
  222.                var garrs = new Array();
  223.                garrs = garr[2].split("][");
  224.                garrd = garrs[0].split("[]");
  225.                marr = parr[2].split("~");    
  226.              
  227.                  sob += "<center><table border='0' cellpadding='0' cellSpacing='3' width='620'>";
  228.  
  229.                bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  230.                  sob += "<tr style='background-color:"+bgColor+"' >";
  231.                  sob += "<td width='50' align='left' class='optext'> Name</td>";
  232.                  sob += "<td width='*' align='left' class='optext'>: " + garr[1] +"</td></tr>";
  233.                  
  234.                bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  235.                  sob += "<tr style='background-color:"+bgColor+"' >";
  236.                 sob += "<td width='50' align='left' class='optext'> Descr</td>";
  237.                  sob += "<td width='*' align='left' class='optext'>: " + garrd[0] +"</td></tr>";
  238.                  
  239.                bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  240.                  sob += "<tr style='background-color:"+bgColor+"' >";
  241.                 sob += "<td width='50' align='left' class='optext'> Severity</td>";
  242.                 var sevvalue = (garrs.length > 5) ? parseInt(garrs[5],10) : 1;
  243.                  sob += "<td width='*' align='left' class='optext'>: " + SeverityArray[ sevvalue ] +"</td></tr>"; 
  244.   
  245.                 bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  246.                 sob += "<tr style='background-color:"+bgColor+"' >";
  247.                 sob += "<td width='50' align='left' class='optext'>";
  248.                  sob += " Details</td>";
  249.                  sob += "<td width='*' align='left' class='optext'>";
  250.                 switch ( CurrentWatchReportType ) {
  251.                        case SERVER_WATCH : 
  252.                            if ( marr[8] == "1" ) {
  253.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  254.                          }
  255.                          sob += ": IP Service = " + ((marr[0] == "SQLCONNECT")?"SQL":marr[0]) +"<br>";
  256.                          if ( marr[0] != "AGENT" ) {
  257.                              if ( marr[0] == "PING" || marr[0] == "SQLCONNECT" || marr[0] == "ORACLE" || marr[0] == "SNMP"  ) {
  258.                                 sob += ": TimeOut= "+marr[1]+";  Retry Count= "+marr[2]+"<br>";                       
  259.                             }
  260.                             else {
  261.                                 sob += ": Port= "+marr[3]+";  TimeOut= "+marr[1];
  262.                                 sob += ";  Retry Count= "+marr[2]+"<br>";                       
  263.                             }
  264.                         }
  265.                          if ( marr[0] == "HTTP" ) {
  266.                              if ( marr[11] != "" ) {
  267.                                 sob += ": Look For= "+marr[11];
  268.                                 if ( marr[10] != "" ) 
  269.                                     sob += ";  Page Name= "+marr[10]; 
  270.                                 sob += "<br>";
  271.                             }                      
  272.                             else if ( marr[10] != "" ) {
  273.                                 sob += ": Page Name= "+marr[10]+"<br>"; 
  274.                             }
  275.                         }
  276.                          else if ( marr[0] == "DNS" ) {
  277.                             if ( marr[9] != "" ) {
  278.                                 sob += ": Resolve Name= "+marr[9]+"<br>"; 
  279.                             }                      
  280.                         }
  281.                          else if ( marr[0] == "USER" ) {
  282.                             if ( marr[10] != "" ) {
  283.                                 sob += ": Request= "+marr[10];
  284.                                 if ( marr[11] != "" ) 
  285.                                     sob += ";  Response= "+marr[11]; 
  286.                                 sob += "<br>";
  287.                             }  
  288.                             else if ( marr[11] != "" ) {
  289.                                 sob += ": Response= "+marr[11]+"<br>";
  290.                             }
  291.                         }
  292.                          else if ( marr[0] == "SNMP" ) {
  293.                              var snmpparr = new Array();
  294.                              snmpparr = marr[10].split(",");
  295.                             if ( snmpparr.length > 3 && snmpparr[3] != "" ) {
  296.                                 sob += ": Look For= "+snmpparr[3];
  297.                                 if ( snmpparr[0] != "" ) 
  298.                                     sob += ";  Read Community= "+snmpparr[0];
  299.                                 sob += "<br>";
  300.                             }
  301.                             else if ( snmpparr[0] != "" ) {
  302.                                 sob += ": Read Community= "+snmpparr[0]+"<br>";
  303.                             }                                                   
  304.                             if ( snmpparr.length > 3 && snmpparr[4] != "" ) {
  305.                                 sob += ": OIDs= "+snmpparr[4]+"<br>";        
  306.                             }                    
  307.                         }
  308.                          else if ( marr[0] == "ORACLE" || marr[0] == "SQLCONNECT") {
  309.                              var sqlparr = new Array();
  310.                              sqlparr = marr[10].split(",");
  311.                              if ( sqlparr[0] != "" ) { 
  312.                                 sob += ": Server Name= "+sqlparr[0];
  313.                                 if ( sqlparr[3] != "" )
  314.                                     sob += ";  Database= "+sqlparr[3];
  315.                                 sob += "<br>";
  316.                             }                     
  317.                             else if ( sqlparr[3] != "" ) {
  318.                                 sob += ": Database= "+sqlparr[3]+"<br>";
  319.                             }
  320.                             
  321.                              if ( sqlparr[1] != "" ) { 
  322.                                 sob += ": User Name= "+sqlparr[1];
  323.                                 if ( sqlparr[2] != "" )
  324.                                     sob += ";  Password= "+sqlparr[2];
  325.                                 sob += "<br>";
  326.                             }                     
  327.                             else if ( sqlparr[2] != "" ) {
  328.                                 sob += ": Password= "+sqlparr[2]+"<br>";
  329.                             }
  330.                         }
  331.                          else if ( marr[0] == "AGENT" ) {
  332.                              var aparr = new Array();
  333.                              aparr = marr[10].split(",");
  334.                             sob += ": Memory Threshold= "+aparr[0]+"%;  Logical Drive Threshold= "+aparr[1]+"%<br>";                       
  335.                         }
  336.                       break;
  337.                       
  338.                         case SYSLOG_WATCH : 
  339.                             if ( marr[5] != "" ) {
  340.                             var tagarr = new Array();
  341.                              tagarr = marr[5].split("`");
  342.                              if ( tagarr[3] == "0" ) {
  343.                                  sob += ": *****CURRENTLY SUSPENDED*****<br>";
  344.                              }
  345.                          }
  346.                             if ( marr[0] != "" ) {
  347.                               var fac = "";
  348.                              var facarr = new Array();
  349.                              facarr = marr[0].split(",");
  350.                              for ( var j=0; j<facarr.length; j++ ) {
  351.                                  if ( j != 0 ) { fac += ", " }
  352.                                fac += GetFacility( facarr[j] );
  353.                             }
  354.                              sob += ": Facility= " + fac +"<br>";
  355.                          }                         
  356.                             if ( marr[1] != "" ) {
  357.                               var sev = "";
  358.                              var sevarr = new Array();
  359.                              sevarr = marr[1].split(",");
  360.                              for ( var k=0; k<sevarr.length; k++ ) {
  361.                                  if ( k != 0 ) { sev += ", " }
  362.                                sev += GetSeverity( sevarr[k] );
  363.                             }
  364.                             sob += ": Severity= " + sev +"<br>";
  365.                         }
  366.                             if ( marr[5] != "" ) {
  367.                                 if ( tagarr[0] != "" ) 
  368.                                  sob += ": Tag= " + tagarr[0] +"<br>";
  369.                                 if ( tagarr[1] != "" ) 
  370.                                  sob += ": Content= " + tagarr[1] +"<br>";
  371.                          }
  372.                          
  373.                         sob += ": Precedence= "+ (parseInt(marr[4],10)+1);
  374.                         if ( marr[2] == "1" )
  375.                             sob += ";  AND Params";
  376.                         sob += "<br>";                       
  377.                         break;
  378.                         
  379.                        case PROCESS_WATCH : 
  380.                            var prarr = new Array();
  381.                            prarr = marr[13].split("[+]");
  382.                            if ( prarr.length <= 1 ) {
  383.                            prarr[0] = prarr[1] = prarr[2] = prarr[3] = "";
  384.                         }
  385.                            if ( marr[2] == "0" ) {
  386.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  387.                          }
  388.                         sob += ": Process Name= "+marr[0]+"<br>";
  389.                         if ( marr[1] != "" )
  390.                              sob += ": Process Path= "+marr[1]+"<br>";
  391.                              
  392.                         fp = ": Thresholds: ";
  393.                         if ( prarr[0] != "" && parseInt(prarr[0],10) > 0 )
  394.                             fp += "Duration (Mins)= "+prarr[0]+";  ";
  395.                         if ( marr[3] != "" && parseInt(marr[3],10) > 0 )
  396.                             fp += "CPU %= "+marr[3]+";  ";
  397.                         if ( marr[4] != "" && parseInt(marr[4],10) > 0 )
  398.                             fp += "Memory(KB)= "+marr[4]+";  ";
  399.                         if ( marr[5] != "" && parseInt(marr[5],10) > 0 )
  400.                             fp += "PagedPool(KB)= "+marr[5]+";  ";
  401.                         if ( marr[6] != "" && parseInt(marr[6],10) > 0 )
  402.                             fp += "NonPagedPool(KB)= "+marr[6]+";  ";
  403.                         if ( marr[7] != "" && parseInt(marr[7],10) > 0 )
  404.                             fp += "PageFile(KB)= "+marr[7]+";  ";
  405.                         if ( fp.length > 23 )
  406.                             sob += fp + "<br>";
  407.  
  408.                         if ( prarr[1] != "" && parseInt(prarr[1],10) > 0 ) {
  409.                             sob += ": Instance Count= "+prarr[1]+";  ";
  410.                             if ( prarr[3] != "" ) {
  411.                                sob += "Exclude From WildCard= "+prarr[3];
  412.                             }
  413.                             sob += "<br>";
  414.                         }
  415.                         else if ( prarr[3] != "" ) {
  416.                               sob += ": Exclude From WildCard= "+prarr[3]+"<br>";
  417.                         }
  418.  
  419.                         sob += ": ";
  420.                         if ( marr[9] == "1")
  421.                             sob += "Should NOT Be Running;  ";
  422.                         else
  423.                             sob += "Should BE Running;  ";
  424.                         
  425.                         if ( marr[10] == "1")
  426.                             sob += "Notify Only;  ";
  427.                         else if ( marr[11] != "")
  428.                             sob += "Restart  ";
  429.                         else 
  430.                             sob += "Terminate  ";
  431.                         sob += "<br>";
  432.                              
  433.                          break;
  434.                          
  435.                        case SNMPTRAP_WATCH : 
  436.                            if ( marr[0] == "0" ) {
  437.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  438.                          }
  439.                          var trapoid = "";
  440.                          for ( var l=1; l<marr.length; l++ ) {
  441.                              if ( l > 1 ) { trapoid += ",    " }
  442.                            trapoid += marr[l];
  443.                         }
  444.                          sob += ": Trap OID(s)= " + trapoid +"<br>";
  445.                          break;
  446.                          
  447.                        case FILE_WATCH : 
  448.                            if ( marr[2] == "0" ) {
  449.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  450.                          }
  451.                            var farr = new Array();
  452.                            farr = marr[1].split("`");
  453.                         sob += ": File Path Name= "+marr[0];
  454.                         if ( farr[3] == "1")
  455.                             sob += ";  D/T Change";
  456.                         if ( farr[2] == "1")
  457.                             sob +=  ";  Size Change";
  458.                         sob += "<br>";    
  459.                         
  460.                         var fp = ": ";
  461.                         if ( farr[1] != "")
  462.                             fp += "Maximum Size(KB)= "+farr[1]+";  ";
  463.                         if ( farr[0] != "")
  464.                             fp += "Search String= "+farr[0];
  465.                         if ( fp.length > 7 )
  466.                             sob += fp + "<br>";
  467.                             
  468.                         fp = ": ";
  469.                         if ( farr[4] == "1")
  470.                             fp += "AND Params;  ";
  471.                         if ( farr[5] == "1")
  472.                             fp += "NOT Check;  ";
  473.                         if ( farr[6] != "")
  474.                             fp += "Duration (Hours)= "+farr[6];
  475.                         if ( fp.length > 7 )
  476.                             sob += fp + "<br>";
  477.                         break;   
  478.                                             
  479.                        case WINSERVICE_WATCH : 
  480.                            if ( marr[5] == "0" ) {
  481.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  482.                          }
  483.                          var sr = "";
  484.                            if ( marr[6] == "0" ) {
  485.                              sr = ": Attempt Service Restart;";
  486.                          }
  487.                          else {
  488.                              sr = ": Notify Only;";
  489.                          }
  490.                          sob += sr + "  Windows Service(s)=<br>";
  491.                          for ( var m=0; m<marr.length-1; m+=7 ) {
  492.                              sob += "    -" + marr[m+2] + "  ("+marr[m+1]+")<br>";
  493.                          }
  494.                       break;
  495.                       
  496.                        case EVENTLOG_WATCH : 
  497.                            if ( marr[0] == "0" ) {
  498.                              sob += ": *****CURRENTLY SUSPENDED*****<br>";
  499.                          }
  500.                         sob += ": Log Name= "+marr[1];
  501.                         if ( marr[2] != "" ) {
  502.                             for ( var p=0; p<TypeTable.length; p++ ) {
  503.                                 if ( marr[2] == TypeTable[p] ) {
  504.                                     sob += ";  Type= "+AL_EvLogType.options[ p ].text;
  505.                                 }
  506.                             }
  507.                         }
  508.                         if ( marr[5] != "")
  509.                             sob +=  ";  EventID(s)= "+marr[5];
  510.                         sob += "<br>";       
  511.                         
  512.                         var fp = ": ";
  513.                         if ( marr[3] != "")
  514.                             fp += "Source= "+marr[3]+";  ";
  515.                         if ( marr[4] != "")
  516.                             fp += "Category= "+marr[4]+";  ";
  517.                         if ( marr[6] != "") {
  518.                             var warr = new Array();
  519.                             warr = marr[6].split("\x09");
  520.                             if ( warr.length > 1 ) {
  521.                                marr[6] = warr.join("&T");
  522.                             }                        
  523.                             fp += "Description= "+marr[6];
  524.                         }
  525.                         if ( fp.length > 7 )
  526.                             sob += fp + "<br>";
  527.  
  528.                         sob += ": Precedence= "+ (parseInt(marr[14],10)+1);
  529.                         if ( marr[13] == "1" )
  530.                             sob += ";  AND Params";
  531.                         if ( marr[12] == "0" )
  532.                             sob += ";  NOT Check";
  533.                         if ( marr[15] == "1" )
  534.                             sob += ";  Exclude";                        
  535.                         sob += "<br>";                       
  536.                         break;   
  537.                                             
  538.                        case COUNTER_WATCH : 
  539.                          sob += ": Object= "+marr[0]+" "+marr[1]+";  Counter= "+marr[2]+"<br>";
  540.                          sob += ": Threshold= "+garr[3]+";  "+((garr[4] == "1")?"OVER":"BELOW")+" Threshold";
  541.                          sob += ";  Duration= "+garr[6]+"<br>";
  542.                       break;
  543.                 }
  544.                   sob += "</td></tr>";            
  545.                 
  546.                bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  547.                  sob += "<tr style='background-color:"+bgColor+"' >";
  548.                 sob += "<td width='50' align='left' class='optext'> Schedule</td>";
  549.                  sob += "<td width='*' align='left' class='optext'>";                 
  550.  
  551.                 if ( CurrentWatchReportType == COUNTER_WATCH ) {
  552.                     if ( garr[5] == "0" ) {
  553.                         sob += ": Alert Every Time<br>";   
  554.                     }
  555.                     else {
  556.                         /* Determine Schedule */
  557.                         var Ia = new Array();
  558.                         var CDUnits, CDCount;
  559.                         Ia = garr[19].split(",");
  560.                         if ( (CDCount = Ia[1]) != 0 ) {
  561.                             CDUnits = 2; // default to hours
  562.                         }
  563.                         else {
  564.                             if ( (CDCount = Ia[3]) == 0 ) {
  565.                                 ++CDCount;
  566.                             }
  567.                             CDUnits = Ia[2];
  568.                         }
  569.                         sob += ": Minimum Notification Interval= "+(CDCount + " " + SchedTxtArray[CDUnits])+"<br>";   // 
  570.                     }
  571.                     sob += ": Maximum Alert Notifications= "+garrs[3]+"<br>";  
  572.                     if ( garrs[4] == "1" ) {
  573.                         sob += ": Notify On Restore<br>";  
  574.                     }
  575.                 }
  576.                 else {
  577.                     if ( garr[5] == "1" ) {
  578.                         sob += ": Alert Every Time<br>";   
  579.                     }
  580.                     else {
  581.                         /* Determine Schedule */
  582.                         var Ia = new Array();
  583.                         var CDUnits, CDCount;
  584.                         Ia = garr[19].split(",");
  585.                         if ( (CDCount = Ia[1]) != 0 ) {
  586.                             CDUnits = 2; // default to hours
  587.                         }
  588.                         else {
  589.                             if ( (CDCount = Ia[3]) == 0 ) {
  590.                                 ++CDCount;
  591.                             }
  592.                             CDUnits = Ia[2];
  593.                         }
  594.                         sob += ": Minimum Notification Interval= "+(CDCount + " " + SchedTxtArray[CDUnits])+"<br>";   // 
  595.                     }
  596.                 }                
  597.  
  598.                 if ( CurrentWatchReportType == SERVER_WATCH ) {
  599.                     sob += ": Maximum Alert Notifications= "+garr[3]+"<br>";  
  600.                    if ( marr[4] != "0" ) { SrvUnits = 0; SrvCount = parseInt(marr[4],10); }
  601.                    else if ( marr[5] != "0" ) { SrvUnits = 1; SrvCount = parseInt(marr[5],10); }
  602.                    else if ( marr[6] != "0" ) { SrvUnits = 2; SrvCount = parseInt(marr[6],10); }
  603.                    else if ( marr[7] != "0" ) { SrvUnits = 3; SrvCount = parseInt(marr[7],10); }
  604.                     var SrvFreq = SrvCount + " " + SchedTxtArray[SrvUnits];
  605.                     sob += ": Server Check Frequency= "+SrvFreq+"<br>";
  606.                     if ( garrd[1] != "" ) {   
  607.                         sob += ": Watch/Alert Dependency= "+getOnlyAlertName(garrd[1])+" <br>";  
  608.                     }
  609.                     
  610.                     if ( garrs.length > 1 && garrs[1] != "" ) {
  611.                         var Suppress1 = new Array();
  612.                         var Supp1 = "", Supp2 = "";
  613.                         Suppress1 = garrs[1].split("^");
  614.                         if ( Suppress1.join(",") != "0,0,0,0,0,0" ) {
  615.                             Supp1 = InactDaysArray[ Suppress1[0] ];
  616.                             Supp1 += "-"+InactDaysArray[ Suppress1[1] ];
  617.                             Supp1 += "  "+ ((Suppress1[2] < 10) ? "0"+Suppress1[2] : Suppress1[2]);
  618.                             Supp1 += ":"+ ((Suppress1[4] < 10) ? "0"+Suppress1[4] : Suppress1[4]);
  619.                             Supp1 += " - "+ ((Suppress1[3] < 10) ? "0"+Suppress1[3] : Suppress1[3]);
  620.                             Supp1 += ":"+ ((Suppress1[5] < 10) ? "0"+Suppress1[5] : Suppress1[5]);
  621.                         }
  622.                         Suppress1 = garrs[2].split("^");
  623.                         if ( Suppress1.join(",") != "0,0,0,0,0,0" ) {
  624.                             Supp2 = InactDaysArray[ Suppress1[0] ];
  625.                             Supp2 += "-"+InactDaysArray[ Suppress1[1] ];
  626.                             Supp2 += "  "+ ((Suppress1[2] < 10) ? "0"+Suppress1[2] : Suppress1[2]);
  627.                             Supp2 += ":"+ ((Suppress1[4] < 10) ? "0"+Suppress1[4] : Suppress1[4]);
  628.                             Supp2 += " - "+ ((Suppress1[3] < 10) ? "0"+Suppress1[3] : Suppress1[3]);
  629.                             Supp2 += ":"+ ((Suppress1[5] < 10) ? "0"+Suppress1[5] : Suppress1[5]);
  630.                         }
  631.                         if ( Supp1 != "" ) {
  632.                             sob += ": Suppress Monitoring= "+Supp1;
  633.                             if ( Supp2 != "" ) 
  634.                                 sob += " and "+Supp2;
  635.                             sob += "<br>";  
  636.                         }
  637.                         else if ( Supp2 != "" ) {
  638.                             sob += ": Suppress Monitoring= "+Supp2+ "<br>";  
  639.                         }    
  640.                     }                
  641.                 }
  642.                   sob += "</td></tr>";            
  643.                  
  644.                  bgColor = ( ++WRCount % 2 == 0 ) ? "e0e0e0" : "white";
  645.                  sob += "<tr style='background-color:"+bgColor+"' >";
  646.                 sob += "<td width='50' align='left' class='optext'> Actions</td>"
  647.                  sob += "<td width='*' align='left' class='optext'>"
  648.                  if ( garr[7] != "1" && garr[10] != "1" && garr[13] != "1" && garr[16] != "1" ) {
  649.                     sob += ": No Actions";
  650.                 }
  651.                 else {
  652.                     if ( garr[7] == "1" ) {
  653.                         sob += ": Run Program;  Program Name= "+garr[8]+";  Programs Args= "+garr[9]+"<br>";   
  654.                     }
  655.                     if ( garr[10] == "1" ) {
  656.                         var warr = new Array();
  657.                         warr = garr[12].split("[+]");
  658.                         sob += ": Send Email;  Email Addr= "+garr[11]+";  Email Subj= "+warr[0];
  659.                         if ( warr[1].length != 0 ) {
  660.                            sob += "<br>    Custom Email Text= "+warr[1];
  661.                         }
  662.                         sob += "<br>";   
  663.                     }
  664.                     if ( garr[13] == "1" ) {
  665.                         var narr1 = new Array();
  666.                         var narr2 = new Array();
  667.                         var narr3 = new Array();
  668.                         var narr4 = new Array();
  669.                         narr1 = garr[14].split("^");
  670.                         narr2 = narr1[0].split("[+]");
  671.                         narr3 = narr1[1].split(";");
  672.                         narr4 = narr3[1].split("[+]");
  673.                         
  674.                         sob += ": Dial Pager/PCS;  Access Number(s)= "+narr2.join(";");
  675.                         sob += "<br>    PIN/Pager Numnber(s)= "+narr4.join(";");
  676.                         if (narr3[0] != "")
  677.                             sob += ";  Password= "+narr3[0];
  678.                         sob += "<br>    Text-To-Send= "+garr[15]+"<br>";   
  679.                     }
  680.                     if ( garr[16] == "1" ) {
  681.                         sob += ": Dial Beeper;  Number= "+garr[17]+";  Numeric TTS= "+garr[18]+"<br>";   
  682.                     }
  683.                 }                 
  684.                  sob += "</td></tr></table>";
  685.         }        
  686.     var dtb = document.all["repwatch"];
  687.    dtb.insertAdjacentHTML("beforeEnd",sob);
  688.     dtb.style.overflow = (dtb.scrollHeight >= dtb.clientHeight) ? "scroll" : "";
  689. }
  690.  
  691. function processPrintWatchReport() {
  692.     if ( !top.banner.IE55orBetter ) {
  693.         alert("Print requires IE 5.5/SP1 or greater. Download current, free IE update from Microsoft's web site");
  694.         return;
  695.     }
  696.     var DiscStatWindow = null;
  697.     FakeBut.click();    // simulate event to call "savePageCoord(...)"
  698.     var wprop = "height="+top.banner.bCh+",width="+top.banner.bCw;
  699.     wprop += ",top="+(top.banner.bY-28)+",left="+(top.banner.bX-4)+",scrollbars";
  700.     var rName = ""+Math.random(); // use Random number to get unique Window name
  701.     rName = rName.substring(2,rName.length);
  702.     DiscStatWindow = window.open("",rName,wprop);
  703.     if ( DiscStatWindow == null ) {
  704.         return;   
  705.     }
  706.     var dh = "<html><head><title>MonitorIT - Watch/Alert Report</title>";
  707.     dh += "<link rel='stylesheet' type='text/css' href='css/Rpmstyle.css'>";
  708.     dh += "</head><body";
  709.     dh += " title='Exit to Close Window when Printing is complete'>"; 
  710.     dh += repwatch.innerHTML;    
  711.     dh += "</body></html>";
  712.     DiscStatWindow.document.open();
  713.     DiscStatWindow.document.write(dh)
  714.     DiscStatWindow.document.close();
  715.     DiscStatWindow.print();
  716. }
  717.  
  718. function processProcNameChange() {
  719.     processProcNotify();
  720. }
  721.