Search code examples
javascriptzabbix

Zabbix Preprocessing JavaScript


I have a value variable VALUE it is a literal numeric task to display 1 if the value is literal numeric and 0 if the value is FAILED Please tell me who knows what JS will look like, a beginner in programming.

function (value) { return value }


Solution

  • The javascript code will be like this:

    function checkValue(value) {
      var result;
      if (!isNaN(value) && value !== '') {
        result = "1";
      } else if (value === "FAILED") {
        result = "0";
      } else {
        result = "value is not a literal numeric value or is FAILED.";
      }
      return result;
    }
    

    As a Zabbix javascript preprocessing:

    zabbix javascript preprocessing

    Test:

    test in zabbix of the above code