Example #1
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);
  }        
 elseif (strpos($variable, "NOTIFICATION_RULE"))  {
          $variableDisp = "NOTIFICATION CHANGE";
          $category = $variableArray[4];
          $appClass = $variableArray[5];
          $instance = $variableArray[6];
          $parameter = $variableArray[7];
          $paramStatus= $variableArray[8];
          $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,status=$paramStatus <br>" . $value;
 }
Example #2
0
function translate_rules_into_english ($rule) {

    $result = array ();

    $rule = str_replace ("___", "\M", $rule);
    $indRuleArray = explode ("\M", $rule);
    $variable = $indRuleArray[0];
    $value = $indRuleArray[1];
    $changeType = $indRuleArray[2];
    $ruleId = $indRuleArray[3];
    $operation = $indRuleArray[4];
    $variableArray = explode ("/", $variable);

    $category = "N/A";
    $appClass = $variableArray[5];
    $instance = $variableArray[6];
    $parameter = $variableArray[7];

    if ($changeType == "Message Wording") {

        $status = $variableArray[8];
        $status = str_replace ("msgText", "", $status);
        if ($status == "") {
            $status = "ALL";
        }

    }

    elseif (($changeType == "Thresholds") || ($changeType == "Process Count")) {

        $value = str_replace(",", " ", $value);
        $valueArray = explode (" ", $value);

        // We need to get the scan for 1 parameter
        $cmd = "SELECT polltime FROM thresholds WHERE parameter = '$parameter' LIMIT 1";
        $result = run_query($cmd);
        $scan = $result[0];

        $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);

        if ($valueArray[0]) {
            # $value = $value . "<BR><i>* Cycle time value may not be accurate, to get an accurate value, please run the threshold report </i>";
        }
        $status = "N/A";
    }
    elseif ($changeType == "Process Add") {
        $instance = str_replace("$", "", $value);
        $instance = str_replace("^", "", $instance);
        $value = "Process Add";
    }
    elseif ($changeType == "Process Delete") {
        $instance = str_replace("_NO_ARGUMENT", "", $value);
        $instance = str_replace("$", "", $instance);
        $instance = str_replace("^", "", $instance);
        $value = "Process Delete";
    }
    elseif ($changeType == "Polling Intervals") {
        $value = $value . " seconds";
        $status = "N/A";
    }
    elseif ($changeType == "Blackouts") {
        
        $category = $variableArray[4];
        $value = str_replace (":","",$value);
        $valueArray = explode (" ", $value);
        $operation = $valueArray[0];
        $value = str_replace ($operation, "", $value);
        $value = trim ($value);
        $value = translate_Blackout_to_english($value);
        $status = "N/A";
        
    }
    elseif ($changeType == "Notification Targets") {
        
        $category = $variableArray[4];
        $value = str_replace (":","",$value);
        $valueArray = explode (" ", $value);
        $operation = $valueArray[0];
        $value = str_replace ($operation, "", $value);
        $value = trim ($value);
        $status = $variableArray[8];
        if (($operation == "DELETE") && ($value == "")) {
            $value = "DELETE ALL E-MAILS";
        }
        
    }
    if ($instance == "__ANYINST__") {
        $instance = "ALL";
    }
    $result[0] = $changeType;
    $result[1] = $category;
    $result[2] = $appClass;
    $result[3] = $instance;
    $result[4] = $parameter;
    $result[5] = $status;
    $result[6] = $value;
    $result[7] = $ruleId;
    $result[8] = $operation;
    return $result;

}