Ad Widget

Collapse

Run .py script via Zabbix Agent 2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • galavichid
    Member
    • Mar 2021
    • 40

    #1

    Run .py script via Zabbix Agent 2

    Hi,
    I have .py script running short code with selenium to open chrome browser on windows 2019 and reset the SW.
    I must have this script running non-headless cause I need to render the UI for the navigation over the menus.

    For the devices (projectors) connected to the SW, there is ICMP check, once one of them is turned offline, I would like to trigger the .py script on one of my servers with access to the SW.

    Any idea how can i achieve that?

    Thanks
  • Brambo
    Senior Member
    • Jul 2023
    • 245

    #2
    The content of your script is yours to build but execution could be done fairly simple:
    In the zabbix agent.conf file:
    Code:
    UserParameter=ZabbixAgentItemname,python.exe  -File "your python file location"
    ZabbixAgentItemname is the name you config in the Zabbix itemkey value this shouldn't be agent active as you want to trigger it on demand.
    not sure how you call your python.exe but if you don't have system variable set on your windows host it could be your need to provided full path to the exe. And depending on the python.exe you need to provide path to the script (with or without -File)

    Comment


    • galavichid
      galavichid commented
      Editing a comment
      Hi Brambo,

      Thanks for the answer. One think I am not sure about, if I configure it as an 'item' the 'item' should do interval checks, which in my case is not needed, eventually I need the .py script to run when a problem is created (in my case 'Unavailable by ICMP ping' of any host from Host Group 'BARCO F50')

      I have thought about another way, I have added Global Script to Zabbix UI, and now I am trying to create Trigger Action which will listen to the trigger of the ICMP, then execute the command, but I can't change the 'Operation' drop down menu:
      this is on the WIKI:
  • galavichid
    Member
    • Mar 2021
    • 40

    #3
    ***Found my issue, the script was configured on 'manual', after change it to Action Operation I could set it in the trigger.
    Also checked the all flow, and its working good! thanks!

    Can't add photos on the replay,
    This is the WIKI:
    Click image for larger version  Name:	image.png Views:	2 Size:	42.6 KB ID:	489518
    This is mine:
    Click image for larger version  Name:	image.png Views:	2 Size:	26.0 KB ID:	489519

    I have change the global scripts on the Zabbix Server, but still I can't change it.
    Last edited by galavichid; 13-08-2024, 16:07.

    Comment

    Working...