PPF Custom Thresholds

You are here
PPF Custom Thresholds

PPF Custom Thresholds

Typically thresholds for metrics are defined in the threshold file. This can be edited within MCS. However, if you want to either create a custom threshold or override an existing one without editing the main file you can do so.

var ppf_custhr = { //ppf_custhr is reserved for PPF use and is where variables are defined.
            
    //Format is metric name: { warn: 5, crit: 2, highgood: "y"}. Values can themselves contain variables or expressions.
   "act.deff": {
      crit: 50,
      highgood: "y", // "y" \higher result is better, "n" lower result is better
      warn: 75
   },
   "act.ueff": {
      crit: 50,
      highgood: "y",
      warn: 75
   },
   "act.dspeed": {
      crit: "$$exp.(||a24.act.maxroutespeed||*0.7)$$",
      warn: "$$exp.(||a24.act.maxroutespeed||*0.85)$$",
      highgood: "y"
   }
}

For details on expressions click here.

Custom thresholds that override existing metrics will automatically be used when making threshold related decisions, such as deciding what color to use for a result.

Custom Metrics

The syntax also allows the creation of custom metrics.

For example, connection efficiency. At the time of writing this the metric did not exist in MCS but could be calculated by dividing the throughput result by the max route speed.

Click here to see how a function can be used to calculate such metrics.

To test the new metric against the custom thresholds use the API call below.

ppf_testThresholdResult(metricName, resultValue); //reserved API function
				
//For example
var thresh = ppf_testThresholdResult("act.deff", 87);

The format of the response to this API call is below in JSON format.

{
   bad: true,
   good: false,
   okay: false,
   notbad: false,
   notokay: true,
   notgood: true
}

The example below shows this being used to get the a color. If the result is bad you want to show a red color, etc.

function calcEfficiency(metname, tput, route) {
   var efficiencyResult = parseFloat(((tput / route) * 100).toFixed(1));
   var tres = ppf_testThresholdResult(metname, efficiencyResult);
   return setTholdCol(tres);
}

function setTholdCol(tholdRes) {
   if (tholdRes.good) { //if the result was good return green
      return "#08873f";
   } else if (tholdRes.okay) { //if the result was okay return orange
      return "#da711b";
   } else { //else return red
      return "#fa1f05";
   }
}