Ad Widget

Collapse

Script Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ocarlossouza
    Junior Member
    • Feb 2024
    • 22

    #1

    Script Problem

    I need to run remote scripts on servers, but I wouldn't like to have a script on each remote server to run. Can I generate a single script on my zbbix server and run it through items created for each server?
  • Hamardaban
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2019
    • 2713

    #2
    If you have installed zabbix agent on each server - yes.

    Comment

    • ocarlossouza
      Junior Member
      • Feb 2024
      • 22

      #3
      Thanks for the feedback. Today I already use this function, but each script is on the host I want to monitor. My intention is for these scripts to be concentrated on the zabbix server, for this format I did not find ways to use system.run[]
      If you have configuration examples and could share them, I would be grateful.

      Comment

      • Hamardaban
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2019
        • 2713

        #4
        For example:
        Code:
        system.run["powershell -c \"[Console]::OutputEncoding=[System.Text.Encoding]::GetEncoding('utf-8');$UninstallPath = 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\'; $softlist= Get-ChildItem $UninstallPath | ForEach-Object { $ProdID = ($_.Name -split '\\')[-1]; Get-ItemProperty -Path \"$UninstallPath\$ProdID\" -ea SilentlyContinue | Select-Object -Property @{n='IdentifyingNumber'; e={$ProdID}}, @{n='Name'; e={$_.DisplayName}}, @{n='Vendor'; e={$_.Publisher}}, @{n='Version'; e={$_.DisplayVersion}} , @{n='Caption'; e={$_.DisplayName}} }| ConvertTo-Json -Compress; [Console]::WriteLine( $softlist ) \" "]
        You can also create a user macro with a script written in one line and insert it into the system.run call
        Last edited by Hamardaban; 28-03-2024, 09:11.

        Comment

        Working...