diff --git a/.gitignore b/.gitignore index b2f027583..485bef590 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +**.DS_Store zbx_env/ zbx_env*/ .*CERT_FILE diff --git a/Dockerfiles/agent/windows/docker-entrypoint.ps1 b/Dockerfiles/agent/windows/docker-entrypoint.ps1 index 1963d372b..357f4572e 100644 --- a/Dockerfiles/agent/windows/docker-entrypoint.ps1 +++ b/Dockerfiles/agent/windows/docker-entrypoint.ps1 @@ -74,6 +74,17 @@ function Update-Config-Var { Write-Host updated } + elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 1) { + (Get-Content $ConfigPath) | + Foreach-Object { + $_ + if ($_ -match "^[#;] $VarName=$") { + "$VarName=$VarValue" + } + } | Set-Content $ConfigPath + + Write-Host "added first occurrence" + } elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 0) { (Get-Content $ConfigPath) | Foreach-Object { diff --git a/Dockerfiles/agent2/windows/docker-entrypoint.ps1 b/Dockerfiles/agent2/windows/docker-entrypoint.ps1 index bc6be2340..9250a9e6a 100644 --- a/Dockerfiles/agent2/windows/docker-entrypoint.ps1 +++ b/Dockerfiles/agent2/windows/docker-entrypoint.ps1 @@ -74,6 +74,17 @@ function Update-Config-Var { Write-Host updated } + elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 1) { + (Get-Content $ConfigPath) | + Foreach-Object { + $_ + if ($_ -match "^[#;] $VarName=$") { + "$VarName=$VarValue" + } + } | Set-Content $ConfigPath + + Write-Host "added first occurrence" + } elseif ((Get-Content $ConfigPath | select-string -pattern "^[#;] $VarName=").length -gt 0) { (Get-Content $ConfigPath) | Foreach-Object { @@ -86,7 +97,7 @@ function Update-Config-Var { Write-Host "added" } else { - Add-Content -Path $ConfigPath -Value "$VarName=$VarValue" + Add-Content -Path $ConfigPath -Value "$VarName=$VarValue" Write-Host "added at the end" } } @@ -199,7 +210,7 @@ function Prepare-Zbx-Agent-Config { # Please use include to enable Perfcounter feature # update_config_multiple_var $ZBX_AGENT_CONFIG "PerfCounter" $env:ZBX_PERFCOUNTER Update-Config-Var $ZbxAgentConfig "Timeout" "$env:ZBX_TIMEOUT" - Update-Config-Var $ZbxAgentConfig "Include" "$ZabbixConfigDir\zabbix_agentd.d\*.conf" + Update-Config-Var $ZbxAgentConfig "Include" ".\zabbix_agentd.d\*.conf" Update-Config-Var $ZbxAgentConfig "UnsafeUserParameters" "$env:ZBX_UNSAFEUSERPARAMETERS" Update-Config-Var $ZbxAgentConfig "TLSConnect" "$env:ZBX_TLSCONNECT" Update-Config-Var $ZbxAgentConfig "TLSAccept" "$env:ZBX_TLSACCEPT" @@ -217,19 +228,9 @@ function Prepare-Zbx-Agent-Config { } -function Prepare-Zbx-Agent-Plugins-Config { - Write-Host "** Preparing Zabbix agent 2 (plugins) configuration files" - - Update-Config-Var "$ZabbixConfigDir/mongodb.conf" "Plugins.MongoDB.System.Path" "$ZabbixUserHomeDir\zabbix-agent2-plugin\mongodb.exe" - Update-Config-Var "$ZabbixConfigDir/postgresql.conf" "Plugins.PostgreSQL.System.Path" "$ZabbixUserHomeDir\zabbix-agent2-plugin\postgresql.exe" - Update-Config-Var "$ZabbixConfigDir/mssql.conf" "Plugins.MSSQL.System.Path" "$ZabbixUserHomeDir\zabbix-agent2-plugin\mssql.exe" - Update-Config-Var "$ZabbixConfigDir/ember.conf" "Plugins.EmberPlus.System.Path" "$ZabbixUserHomeDir\zabbix-agent2-plugin\ember-plus.exe" -} - function PrepareAgent { Write-Host "** Preparing Zabbix agent 2" Prepare-Zbx-Agent-Config - Prepare-Zbx-Agent-Plugins-Config } $commandArgs=$args diff --git a/Dockerfiles/build-mysql/centos/Dockerfile b/Dockerfiles/build-mysql/centos/Dockerfile index 08db453f4..1b4452e0b 100644 --- a/Dockerfiles/build-mysql/centos/Dockerfile +++ b/Dockerfiles/build-mysql/centos/Dockerfile @@ -44,7 +44,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/ && \ - mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/zabbix_agent2.d/plugins.d/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/database/${DB_TYPE}/ && \ diff --git a/Dockerfiles/build-mysql/windows/Dockerfile.agent2 b/Dockerfiles/build-mysql/windows/Dockerfile.agent2 index 62d451b4f..ee626edc6 100644 --- a/Dockerfiles/build-mysql/windows/Dockerfile.agent2 +++ b/Dockerfiles/build-mysql/windows/Dockerfile.agent2 @@ -35,7 +35,6 @@ RUN Set-Location -Path $env:SystemDrive\.; ` New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\sbin | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\conf | Out-Null; ` New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\conf\zabbix_agentd.d | Out-Null; ` - New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\zabbix-agent2-plugin | Out-Null; ` ` Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; ` Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; ` diff --git a/Dockerfiles/build-pgsql/ubuntu/Dockerfile b/Dockerfiles/build-pgsql/ubuntu/Dockerfile index b7eb110a7..c0b73b5c7 100644 --- a/Dockerfiles/build-pgsql/ubuntu/Dockerfile +++ b/Dockerfiles/build-pgsql/ubuntu/Dockerfile @@ -50,7 +50,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/ && \ - mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/zabbix_agent2.d/plugins.d/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/database/${DB_TYPE}/ && \ diff --git a/Dockerfiles/build-sqlite3/ol/Dockerfile b/Dockerfiles/build-sqlite3/ol/Dockerfile index 62d307493..c24cfcf8e 100644 --- a/Dockerfiles/build-sqlite3/ol/Dockerfile +++ b/Dockerfiles/build-sqlite3/ol/Dockerfile @@ -31,7 +31,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/ && \ - mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/zabbix_agent2.d/plugins.d/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/java_gateway/sbin/ && \ diff --git a/Dockerfiles/build-sqlite3/rhel/Dockerfile b/Dockerfiles/build-sqlite3/rhel/Dockerfile index 640fdb412..02898875f 100644 --- a/Dockerfiles/build-sqlite3/rhel/Dockerfile +++ b/Dockerfiles/build-sqlite3/rhel/Dockerfile @@ -54,7 +54,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build/ \ mkdir -p ${ZBX_OUTPUT_DIR}/agent/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/ && \ - mkdir -p ${ZBX_OUTPUT_DIR}/agent2/conf/zabbix_agent2.d/plugins.d/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/sbin/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/proxy/conf/ && \ mkdir -p ${ZBX_OUTPUT_DIR}/java_gateway/sbin/ && \