Ad Widget

Collapse

Is there any way to send a file from Zabbix Server to Windows PCs?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hiromasa72
    Junior Member
    • Aug 2018
    • 1

    #1

    Is there any way to send a file from Zabbix Server to Windows PCs?

    Hi,

    Is there any way to send a file from Zabbix Server(Linux) to Windows PCs(Monitored by Zabbix Server)?

    I am monitoring like 500 Windows PCs from Zabbix server.
    (Zabbix agent has been installed on these 500 Windows PCs. So, Zabbix server can ping the PCs and vice versa)

    And I want to send the same file(100mb) to all the Windows PCs at once that I am monitoring.

    I can do this one by one manually like by connecting to them via RDP.
    However, this way, it takes ages, so to do this faster, I thought I could use Zabbix.

    Any help would be appreciated.

  • Lasse.H
    Junior Member
    • Dec 2020
    • 1

    #2
    Hi,
    I know it was a long time ago but did you find a solution or someone has an idea ?


    Best Regards

    Comment

    • PaulM
      Junior Member
      • Feb 2022
      • 2

      #3
      I have after much experimenting managed to do this.
      This process was using Zabbix Agent2. It may work with the original Zabbix agent, but we are not using that so I can't verify.

      Firstly 2 settings are needed in zabbix_agent2.conf:
      Code:
      Timeout=30
      AllowKey=system.run[*]
      You may be able to use a shorter timeout and a more tightly controlled system.run but you will certainly need to change them from the defaults.

      Now you need to place the files you want to copy onto your monitored Windows hosts on a webserver. This needs to be http or be configured to allow TLS 1.1.
      To use TLS 1.2 or 1.3 the PowerShell session has to be configured each time. We can't sent this configuration via the command string as it involves square brackets ([ ]) and these are not possiable to use or escape out in a zabbix key.

      If your Zabbix host configuration or template add an Item. You can call this what every you like and use any frequency you wish.
      This should work as type Zabbix Agent (active) or just Zabbix Agent. I use Zabbix Agent so that I can push the file out as soon as I change it.
      Type of information will need to be Log
      The critical bit is the Key.
      Here we are going to use the special key system.run to have the host run a PowerShell command:
      Code:
      system.run["powershell.exe -STA -noprofile -executionPolicy Bypass -command Invoke-WebRequest -Uri http://webhost/myfile -OutFile \"c:\Program Files\Zabbix Agent 2\zabbix_agent2.conf.d\myfile\"",nowait]
      Let me break that down a little so we can understand what is going on.
      • system.run["<our command>",nowait] - These parts tell zabbix that we would like it to run what ever is inside the quotes, and that it should not wait for the command to complete
      • powershell.exe -STA -noprofile -executionPolicy Bypass The command we would like to run is powershell and we do not want it to load a profile or prompt us if what's being run does not meet policy, we just want it to run (or fail!) in the background
      • -command says that we'd like powershell to run a command. If we wanted it to run a script we could say -file instead
      • Invoke-WebRequest -Uri http://webhost/myfile -OutFile "c:\Program Files\Zabbix Agent 2\zabbix_agent2.conf.d\myfile" Make a web request for a file and save it in the path specified in -Outfile. The " at the start and end of the path to save to are not necessary if there are no spaces in the path. Zabbix would ordinarily see quotes as indicating the end of the command A slash before escapes them.

      Screenshot of how this looks in Zabbix:Zabbix config screenshot

      Comment

      • PaulM
        Junior Member
        • Feb 2022
        • 2

        #4
        Sorry, should say
        In your Zabbix host
        not
        If

        Comment

        • alaahil
          Junior Member
          • Oct 2023
          • 18

          #5

          Hello,

          Question, do the files on the webserver need to be publicly available?

          Comment

          Working...