Ad Widget

Collapse

Execute Zabbix script items outside of Zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • troffasky
    Senior Member
    • Jul 2008
    • 567

    #1

    Execute Zabbix script items outside of Zabbix

    I am trying to write a template using Zabbix Script item to talk to Sonicwall SonicOS API.
    Is there a way I can execute the script outside of Zabbix for development/testing purposes? Obviously it would have to execute it exactly as Zabbix does in order to be useful.
  • PavelZ
    Senior Member
    • Dec 2024
    • 162

    #2
    There is such a utility


    You can install it the same way as regular packages. The package is called zabbix-js
    Last edited by PavelZ; 10-07-2025, 21:44.

    Comment

    • troffasky
      Senior Member
      • Jul 2008
      • 567

      #3
      Thankyou. Would be great if this was linked from the "Script items" documentation.

      Comment

      • troffasky
        Senior Member
        • Jul 2008
        • 567

        #4
        Any idea what the input file format is? The man page just says "the input parameter". I am guessing this would provide "obj".

        Comment

        • troffasky
          Senior Member
          • Jul 2008
          • 567

          #5
          I tried looking at zabbix_js.c but could not work this out.
          All Hail our New AI Overlords....I asked Deepseek and it told me:
          The zabbix_js tool (used for testing Zabbix JavaScript preprocessing scripts) expects the -i parameter to accept input data in JSON format. This input simulates the data passed to the preprocessing script during runtime.
          ...
          Example:
          bash

          zabbix_js -s script.js -i '{"key1":"value1", "key2":123}'​
          And it's actually correct! It's not perfect - it hallucinated a "-I" parameter that doesn't exist. But the main thing is, I have this working, so I am happy.

          Comment

          Working...