Added MongoDB and PostgreSQL plugins for Windows agent 2

This commit is contained in:
dotneft 2022-12-15 13:37:39 +09:00 committed by Alexey Pustovalov
parent 314e5e0b05
commit d1a691d91e
2 changed files with 29 additions and 5 deletions

View File

@ -29,6 +29,10 @@ SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"]
WORKDIR C:\zabbix\
COPY --from=builder ["C:\\zabbix2", "C:\\zabbix"]
COPY --from=builder ["C:\\mongodb_plugin\\zabbix-agent2-plugin-mongodb.exe", "C:\\zabbix\\zabbix-agent2-plugin\\zabbix-agent2-plugin-mongodb.exe"]
COPY --from=builder ["C:\\mongodb_plugin\\mongodb.conf", "C:\\zabbix\\conf\\zabbix_agentd.d\\mongodb.conf"]
COPY --from=builder ["C:\\postgresql_plugin\\zabbix-agent2-plugin-postgresql.exe", "C:\\zabbix\\zabbix-agent2-plugin\\zabbix-agent2-plugin-postgresql.exe"]
COPY --from=builder ["C:\\postgresql_plugin\\postgresql.conf", "C:\\zabbix\\conf\\zabbix_agentd.d\\postgresql.conf"]
COPY [".\\docker-entrypoint.ps1", "C:\\zabbix"]
USER ContainerAdministrator
@ -41,10 +45,10 @@ RUN $env:PATH = [string]::Format('{0}\zabbix\sbin;{0}\zabbix\bin;', $env:SystemD
RUN Set-Location -Path $env:SystemDrive\.; `
`
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\modules | Out-Null; `
New-Item -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; `
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\conf\zabbix_agentd.d | Out-Null; `
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\enc | Out-Null; `
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\modules | Out-Null; `
New-Item -Force -ItemType directory -Path $env:ZBX_HOME\buffer | Out-Null; `
`
net accounts /MaxPWAge:unlimited; `
net user /add zabbix /expire:never /passwordreq:no; `

View File

@ -12,7 +12,9 @@ ARG MAJOR_VERSION=6.0
ARG ZBX_VERSION=${MAJOR_VERSION}.12
ARG ZABBIX_VERSION_RC_NUM=2400
ARG ZBX_SOURCES=https://git.zabbix.com/scm/zbx/zabbix.git
ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION
ENV ZBX_SOURCES=$ZBX_SOURCES MAJOR_VERSION=$MAJOR_VERSION ZBX_VERSION=$ZBX_VERSION `
MONGODB_PLUGIN_SOURCES=https://git.zabbix.com/scm/ap/mongodb.git MONGODB_PLUGIN_VERSION=master `
POSTGRESQL_PLUGIN_SOURCES=https://git.zabbix.com/scm/ap/postgresql.git POSTGRESQL_PLUGIN_VERSION=master
LABEL org.opencontainers.image.title="Zabbix agent 2 build (Windows)" `
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
@ -53,4 +55,22 @@ RUN Set-Location -Path $env:SystemDrive\.; `
`
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\bin\win64\zabbix_agent2.exe $env:SystemDrive\zabbix2\sbin; `
Copy-Item -Path $env:SystemDrive\zabbix-$env:ZBX_VERSION\src\go\conf\zabbix_agent2.win.conf $env:SystemDrive\zabbix2\conf; `
`
Set-Location -Path $env:SystemDrive; `
Write-Host ('Building Zabbix MongoDB plugin {0} version ...' -f $env:MONGODB_PLUGIN_VERSION); `
git -c advice.detachedHead=false clone $env:MONGODB_PLUGIN_SOURCES --branch $env:MONGODB_PLUGIN_VERSION --depth 1 --single-branch $env:SystemDrive\mongodb_plugin; `
Set-Location -Path $env:SystemDrive\mongodb_plugin; `
mingw32-make; `
mv $env:SystemDrive\mongodb_plugin\zabbix-agent2-plugin-mongodb $env:SystemDrive\mongodb_plugin\zabbix-agent2-plugin-mongodb.exe; `
Write-Host 'Verifying build ("zabbix-agent2-plugin-mongodb.exe -V") ...'; `
& $env:SystemDrive\mongodb_plugin\zabbix-agent2-plugin-mongodb.exe -V; `
`
Set-Location -Path $env:SystemDrive; `
Write-Host ('Building Zabbix PostgreSQL plugin {0} version ...' -f $env:POSTGRESQL_PLUGIN_VERSION); `
git -c advice.detachedHead=false clone $env:POSTGRESQL_PLUGIN_SOURCES --branch $env:POSTGRESQL_PLUGIN_VERSION --depth 1 --single-branch $env:SystemDrive\postgresql_plugin; `
Set-Location -Path $env:SystemDrive\postgresql_plugin; `
mingw32-make; `
mv $env:SystemDrive\postgresql_plugin\zabbix-agent2-plugin-postgresql $env:SystemDrive\postgresql_plugin\zabbix-agent2-plugin-postgresql.exe; `
Write-Host 'Verifying build ("zabbix-agent2-plugin-postgresql.exe -V") ...'; `
& $env:SystemDrive\postgresql_plugin\zabbix-agent2-plugin-postgresql.exe -V; `
Write-Host 'Zabbix binaries are compiled...';