Created
January 4, 2021 15:13
-
-
Save tsleite/ce4ec488635548e7e6e41271333582fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SO: Windows Server 2012, 2012R2, 2016, 2019 | |
# Parando o serviço | |
c:\zabbix\zabbix_agentd.exe --stop | |
# Desintalando o serviço | |
c:\zabbix\zabbix_agentd.exe --uninstall | |
# Cria diretório backup | |
mkdir c:\zabbix_backup | |
# Backup arquivos | |
Copy-Item c:\zabbix\*.conf -Destination c:\zabbix_backup | |
# Deleta arquivos antigos | |
Remove-Item c:\zabbix -Force -Recurse | |
# Cria diretório | |
mkdir c:\zabbix | |
# Download Zabbix | |
wget "https://www.zabbix.com/downloads/4.0.17/zabbix_agent-4.0.17-windows-amd64.zip" -outfile c:\zabbix\zabbix-4.0.4.zip | |
# ZIP | |
Add-Type -AssemblyName System.IO.Compression.FileSystem | |
function Unzip | |
{ | |
param([string]$zipfile, [string]$outpath) | |
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | |
} | |
# Descompactando c:\zabbix | |
Unzip "c:\zabbix\zabbix-4.0.4.zip" "c:\zabbix" | |
# Movvendo arquivos binários | |
Move-Item c:\zabbix\bin\zabbix_agentd.exe -Destination c:\zabbix\bin | |
# Movendo arquivos conf | |
Move-Item c:\zabbix\conf\zabbix_agentd.win.conf -Destination c:\zabbix\conf | |
# Copia arquivo de configuração antiga para c:\zabbix | |
Copy-Item c:\zabbix_backup\conf\*.conf -Destination c:\zabbix\conf -Force | |
# Remove/Limpa pasta c:\zabbix_Backup | |
Remove-Item c:\zabbix_backup -Force -Recurse | |
# Instala o serviço | |
c:\zabbix\zabbix_agentd.exe --config c:\zabbix\conf\zabbix_agentd.win.conf --install | |
# Inicia o serviço | |
c:\zabbix\zabbix_agentd.exe --start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment