Zabbix agent2
Jump to navigation
Jump to search
zabbix_agent2 -t system.run['ls -l /'] zabbix_get -s 127.0.0.1 -p 10050 -k system.run['/mon/checkip ping <host/ip>']
UserParameter=jping[*],powershell.exe -NoProfile -ExecutionPolicy bypass -File C:\app\zabbix\get-monitor.ps1 $1 /app/zabbix/zabbix_agent2 -t "jping[return1]" -c .\zabbix_agent2.conf
update timeout for system.run commands in /etc/zabbix/zabbix_agent2.conf
Timeout=10
# Download and install Zabbix Agent $ErrorActionPreference = "Stop" cd C:\tmp\z $version = "5.0.5" $file = "zabbix_agent-$version-windows-amd64-openssl.msi" $file_sha256 = "4ee20029dacdbab91f0c0bf9d026a44286773c19878689d54f93cf287341e24e" $hostname = (hostname).ToLower() # https://www.zabbix.com/downloads/5.2.1/zabbix_agent2-5.2.1-windows-amd64-openssl.msi # https://www.zabbix.com/downloads/5.0.5/zabbix_agent2-5.0.5-windows-amd64-openssl.msi function uninstall { # This does not work properly, dang you windows # $description = wmic product get description | findstr -i zabbix # wmic product where "description='Zabbix Agent (64-bit)' " uninstall # zabbix_agentd.exe --uninstall # as admin msiexec /x $file # sc delete "Zabbix Agent" } function download { if( -Not(Test-Path "$file") ){ curl.exe -L -O https://www.zabbix.com/downloads/$version/$file } $get_file_hash = (Get-FileHash "$file").Hash.ToLower() if( -Not($get_file_hash -eq $file_sha256) ){ write-host "E: Invalid SHA256 file hash." mv -force "$file" "$file.badsha256" exit } } function install { $install_folder = "C:\app\zabbix"; msiexec /I zabbix_agent-5.0.5-windows-amd64-openssl.msi HOSTNAME=myhostname HOSTNAMEFQDN=1 SERVER=monitor-proxies.example.com SERVERACTIVE=monitor-proxies.example.com INSTALLFOLDER="$install_folder" SKIP=fw /qn } download install