if (strpos ($instance, ";")) { # Perfmon counter $instance = explode (";", $instance); $instance = $instance[count($instance) - 1]; } $parameter = $variableArray[7]; $appClass = $variableArray[5]; $variableDisp = "THRESHOLD CHANGE"; $value = str_replace(",", " ", $value); $valueArray = explode (" ", $value); $scan = "UNDEFINED"; $stringToTranslate = "1___2___3___4___$valueArray[1]___$valueArray[2]___$valueArray[3]___$valueArray[4]___$valueArray[5]___$valueArray[6]___$valueArray[7]___$valueArray[8]___$valueArray[9]___$valueArray[10]___$valueArray[11]___$valueArray[12]___$valueArray[13]___$valueArray[14]___$valueArray[15]___$valueArray[16]___$valueArray[17]___$valueArray[18]___$valueArray[18]___$valueArray[19]___A___$scan" . "___$valueArray[0]"; $valueDisp = "parameter=$parameter, instance=$instance,application=$appClass <br>" . translate_threshold_to_english($stringToTranslate); $operationDisp = "CHANGE"; } elseif (strpos($variable, "BLACKOUT_RULE")) { $variableDisp = "BLACKOUT CHANGE"; $category = $variableArray[4]; $appClass = $variableArray[5]; $instance = $variableArray[6]; $parameter = $variableArray[7]; $value = str_replace (":","",$value); $valueArray = explode (" ", $value); $operationDisp = $valueArray[0]; $value = str_replace ($operationDisp, "", $value); $value = trim ($value); $valueDisp = "category=$category,application=$appClass,instance=$instance, parameter=$parameter <br>" . translate_Blackout_to_english($value); }
} else { $instanceChosen = ""; } if ($instanceChosen == "__ANYINST__") { $instanceChosen = ""; } $thresholdForHost = get_all_threshold_for_host($hostTemplate, $param,$instanceChosen); ?> <div style="float:left;border:1px solid #333;width:50%"> <TABLE style="width:100%" class="menu"> <?php if (count($thresholdForHost)) { $statement = translate_threshold_to_english($thresholdForHost[0]); # We need to save the settings $thresholdSettings = str_replace ("___", "\M", $thresholdForHost[0]); $valueArray = explode ("\M", $thresholdSettings); $alarm3Active = $valueArray[4]; $alarm3Min = $valueArray[5]; $alarm3Max = $valueArray[6]; $alarm3trigger = $valueArray[7]; $alarm3Cycle = $valueArray[8]; $alarm3State = $valueArray[9]; $alarm1Active = $valueArray[10]; $alarm1Min = $valueArray[11]; $alarm1Max = $valueArray[12]; $alarm1trigger = $valueArray[13]; $alarm1Cycle = $valueArray[14]; $alarm1State = $valueArray[15];
function show_request_detail($requestId, $showAffectedHosts) { $detailForRequest = get_details_for_request_id ($requestId); if (count($detailForRequest)) { $detailForRequestTmp = $detailForRequest[0]; $detailForRequestTmp = str_replace("___", "\M" , $detailForRequestTmp); $detailForRequestTmpArray = explode ("\M", $detailForRequestTmp); $userName = $detailForRequestTmpArray[1]; $firstname= $detailForRequestTmpArray[2]; $lastname = $detailForRequestTmpArray[3]; $comment = $detailForRequestTmpArray[4]; $priority = $detailForRequestTmpArray[5]; $changeControl = $detailForRequestTmpArray[14]; ?> <table class="menu"> <tr > <td class="menu"><b>RequestID</b></td> <td class="menu"><?php print $requestId; ?> </td> </tr> <tr> <td class="menu"><b>Requestor:</b></td> <td class="menu"><?php print "$firstname $lastname ($userName)"; ?></td> </tr> <!-- <tr> <td class="menu"><b>Priority:</b></td> <td class="menu"><?php print $priority; ?></td> </tr> --> <tr> <td class="menu"><b>Change control:</b></td> <td class="menu"><?php print $changeControl; ?></td> </tr> </table> <br/> <fieldset style="margin-top:2em;"> <legend>Description:</legend> <p><?php print $comment; ?></p> </fieldset> <br/> <br/> <? // We need to loop to get the hosts, groups, variable, value $hostTotal = array(); $groupTotal = array(); $variablevalue = array(); foreach ($detailForRequest as $indRequest) { $indRequest = str_replace("___", "\M", $indRequest); $indRequestArray = explode ("\M", $indRequest); array_push ($variablevalue, $indRequestArray[6] . "___" . $indRequestArray[7]. "___" . $indRequestArray[8]); if ($indRequestArray[11] != "") { $applyStatus = $indRequestArray[15]; if ($applyStatus == "1") { $applyStatus = "SUCCESS"; } elseif ($applyStatus == "2") { $applyStatus = "FAILED"; } elseif ($applyStatus == "3") { $applyStatus = "RETRYING"; } else { $applyStatus = "SCHEDULED"; } array_push ($hostTotal, $indRequestArray[11] . " " . $indRequestArray[12] . " " . $applyStatus . " " . $indRequestArray[16]); } if ($indRequestArray[13] != "") { array_push ($groupTotal, $indRequestArray[13]); } } sort ($hostTotal); $hostTotal = array_unique ($hostTotal); sort ($groupTotal); $groupTotal = array_unique ($groupTotal); sort ($variablevalue); $variablevalue = array_unique ($variablevalue); if(count($variablevalue)) { ?> <fieldset><legend>Rule changes</legend> <table class="pconfig"> <tr> <th>Variable</th> <th>Operation</th> <th>Value</th> </tr> <? foreach($variablevalue as $indVariable) { // We need to translate the rule $indVariable = str_replace ("___", "\M", $indVariable); $indVariableArray = explode ("\M", $indVariable); $indConfigVariable = $indVariableArray[0]; $indConfigOperation = $indVariableArray[1]; $indConfigValue = $indVariableArray[2]; if (strpos ($indConfigVariable, "/EVENTSPRING/PARAM_SETTINGS/THRESHOLDS")) { $value = str_replace(",", " ", $indConfigValue); $valueArray = explode (" ", $value); // We need to get the scan for 1 parameter $scan = "UNDEFINED"; $stringToTranslate = "1___2___3___4___$valueArray[1]___$valueArray[2]___$valueArray[3]___$valueArray[4]___$valueArray[5]___$valueArray[6]___$valueArray[7]___$valueArray[8]___$valueArray[9]___$valueArray[10]___$valueArray[11]___$valueArray[12]___$valueArray[13]___$valueArray[14]___$valueArray[15]___$valueArray[16]___$valueArray[17]___$valueArray[18]___$valueArray[18]___$valueArray[19]___A___$scan" . "___$valueArray[0]"; $value = translate_threshold_to_english($stringToTranslate); $indConfigValue = $indConfigValue . "<BR> Interpretation: <br>" . $value; } ?> <tr> <td><?php print $indConfigVariable;?></td> <td><?php print $indConfigOperation;?></td> <td><?php print $indConfigValue; ?></td> </tr> <?php } ?> </table> </fieldset> <br/> <br/> <? } if(count($groupTotal)) { ?> <fieldset><legend>Affected server groups</legend> <? $groupTotalString = "<ul><li>".implode ("</li><li>", $groupTotal)."</li></ul>"; echo "$groupTotalString <BR>"; ?> </fieldset> <br/> <br/> <? } if(count($hostTotal)) { ?> <fieldset><legend>Affected servers</legend> <? $hostTotalString = "<ul><li>".implode ("</li><li>", $hostTotal)."</li></ul>"; if ($showAffectedHosts) { ?> <input class="submit-button" name = "getHosts" type="button" onClick="submit();" value="Hide affected servers"> <?php print $hostTotalString; ?> <BR/> <input type = "hidden" name = "showAffectedHosts" value = 0> <?php } else { ?> <input class="submit-button" name = "getHosts" type="button" onClick="submit();" value="show affected servers"> <input type = "hidden" name = "showAffectedHosts" value = 1> <?php } ?> </fieldset> <? } ?> <br> <br> <? // We need to get scheduling details about this requestID $query = " SELECT username, firstname, lastname, comment, retries, scheduled_changes.date_entered, start_time, end_time FROM scheduled_changes, people WHERE requestid = '$requestId' AND scheduled_changes.schedulerId = people.id"; $result = run_query($query); if (count($result)) { $result = $result[0]; $result = str_replace("___", "\M", $result); $resultArray = explode("\M", $result); ?> <fieldset><legend>Scheduling</legend> <table class="menu"> <tr > <td class="menu"><b>SchedulerID:</b></td> <td class="menu"><?php print $resultArray[0]; ?> </td> </tr> <tr> <td class="menu"> <b>Requestor:</b> </td> <td class="menu"><?php print "$resultArray[1] $resultArray[2] ($resultArray[0])"; ?> </td> </tr> <tr> <td class="menu"> <b>Scheduler Comments:</b> </td> <td class="menu"><?php print $resultArray[3]; ?> </td> </tr> <tr> <td class="menu"> <b>Scheduled at:</b> </td> <td class="menu"><?php print $resultArray[5]; ?> </td> </tr> <tr> <td class="menu"> <b>Deployment scheduled at:</b> </td> <td class="menu"><?php print $resultArray[6]; ?> </td> </tr> <tr> <td class="menu"> <b>Deployment end at:</b> </td> <td class="menu"><?php print $resultArray[7]; ?> </td> </tr> <tr> <td class="menu"><b>Number of retries:</b> </td> <td class="menu"><?php print $resultArray[4]; ?></td> </tr> </table> </fieldset> <? } } else { ?> No details found <BR/> <?php } }