Added smartmontools for checking SMART values with agent2

This commit is contained in:
Alexey Pustovalov 2021-11-13 16:41:45 +01:00
parent eb042481ef
commit 4aa30899d4

View File

@ -14,6 +14,8 @@ ARG MAJOR_VERSION
ARG ZBX_VERSION ARG ZBX_VERSION
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ARG SMARTMONTOOLS_URL=https://sourceforge.net/projects/smartmontools/files/smartmontools/7.2/smartmontools-7.2-1.win32-setup.exe
LABEL org.opencontainers.image.title="Zabbix agent 2" ` LABEL org.opencontainers.image.title="Zabbix agent 2" `
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" ` org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
org.opencontainers.image.vendor="Zabbix LLC" ` org.opencontainers.image.vendor="Zabbix LLC" `
@ -40,6 +42,23 @@ RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemD
[Environment]::SetEnvironmentVariable('ZBX_HOME', $env:ZBX_HOME, [EnvironmentVariableTarget]::Machine); [Environment]::SetEnvironmentVariable('ZBX_HOME', $env:ZBX_HOME, [EnvironmentVariableTarget]::Machine);
RUN Set-Location -Path $env:SystemDrive\.; ` RUN Set-Location -Path $env:SystemDrive\.; `
`
Write-Host ('Downloading {0} ...' -f $env:SMARTMONTOOLS_URL); `
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
Invoke-WebRequest -OutFile $env:SystemDrive\smartmontools-setup.exe -Uri $env:SMARTMONTOOLS_URL; `
`
$sha256 = '83a577757bac76d48c3999b097bac4cd94e7ed3cb3456560aa511c5ac28fb859'; `
Write-Host ('Verifying SHA256 ({0}) ...' -f $sha256); `
if ((Get-FileHash $env:SystemDrive\mingw.7z -Algorithm sha256).Hash -ne $sha256) { `
Write-Host 'Checksum S.M.A.R.T. Monitoring Tools failed!'; `
exit 1; `
}; `
Write-Host 'Installing ...'; `
Start-Process `
-FilePath $env:SystemDrive\smartmontools-setup.exe `
-ArgumentList '/S' -Wait; `
Write-Host 'Removing downloaded...'; `
Remove-Item -Force -Path $env:SystemDrive\smartmontools-setup.exe; `
` `
New-Item -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; `
New-Item -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; `