Zabbix Crashes with JavaScript pre-processing

XMLWordPrintable

    • Type: Problem report
    • Resolution: Duplicate
    • Priority: Trivial
    • None
    • Affects Version/s: 5.2.5
    • Component/s: Server (S)
    • None

      HTTP based check with a preprocessing step of certain javascript causes Zabbix to crash.

      Item is calling an HTTP API, and if it would go unsupported value is set to APIFAIL and carried through the JS function.

      JS Function that causes crash is:

      ============
      
      switch(value)
      
      { case 'APIFAIL': return 'APIFAIL'; break; case '[]': return 0; break; default: return parseJson(value); }
      
      function parseJson(value)
       {
       var obj = JSON.parse(value);
      
      var parsedJson =
      
      { "alarm_state": obj[0].alarm_state, "alarm_id": obj[0].alarm_id, "alert_severity": obj[0].alert_severity, "alert_dimension": obj[0].alert_dimension, "policy_name": obj[0].policy_name, "alert_key_lookup": obj[0].alert_key_lookup, "mitigation_id": obj[0].mitigation_id }
      
      var json = JSON.stringify(parsedJson);
      
      return json;
       }
      
      ============
      

      Screenshots and log file attached.

            Assignee:
            Zabbix Development Team
            Reporter:
            Ben Carter
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: