Ad Widget

Collapse

Unable to run system.run[]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zbxksiu123124
    Junior Member
    • May 2021
    • 1

    #1

    Unable to run system.run[]

    Dear All,

    I would like to execute a ps1 script to return some text from my Windows machine.
    So I add an item to Windows host, as below
    system.run[powershell -NoProfile -ExecutionPolicy bypass -File "\\myshare\myscript.ps1",1]

    However, it doesnt work, it shows not supported in host page and Unknown metric system.run.
    Tried to added to AllowKey = system.run[*] in agent conf file, but still now working.

    Any ideas?

    Best Regards
  • RaulChiarella
    Member
    • Apr 2021
    • 59

    #2
    I am having the same problem
    Using Zabbix Agent 2 - Trying to do this on Windows 10...

    Did you get it working?

    Comment

    • Daniel4711
      Senior Member
      • Jul 2014
      • 126

      #3
      Same Problem here with an SQL Template.
      Name: Database Status..
      Key: system.run["powershell C:\'Program Files'\'Zabbix Agent 2'\scripts\database_status_disc.ps1 -instName 'PROD' -dbName 'tempdb'"]

      Info: unknown metric system.run

      Zabbix 5.4.7
      Agent 2 5.4.7

      Any Ideas?
      Last edited by Daniel4711; 12-11-2021, 08:40.

      Comment

      • Daniel4711
        Senior Member
        • Jul 2014
        • 126

        #4
        Reading and understanding (!) the documentation helped me.


        Code:
        # If no AllowKey or DenyKey rules defined, all keys are allowed.
        # Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default.
        Example:
        AllowKey=system.run["powershell C:\'Program Files'\'Zabbix Agent 2'\scripts\database_status_disc.ps1 *"]
        DenyKey=system.run[*]

        Comment

        • RaulChiarella
          Member
          • Apr 2021
          • 59

          #5
          Originally posted by Daniel4711
          Reading and understanding (!) the documentation helped me.


          Code:
          # If no AllowKey or DenyKey rules defined, all keys are allowed.
          # Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default.
          Example:
          AllowKey=system.run["powershell C:\'Program Files'\'Zabbix Agent 2'\scripts\database_status_disc.ps1 *"]
          DenyKey=system.run[*]
          You're a lifesaver!

          Comment

          Working...