Skip to content

Commit

Permalink
Revert "Gangams/windows telegraf update (#1359)"
Browse files Browse the repository at this point in the history
This reverts commit 9a8808d.
  • Loading branch information
ganga1980 committed Feb 27, 2025
1 parent d20d49a commit c6c8769
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ def createPrometheusPluginsWithNamespaceSetting(monitorKubernetesPods, monitorKu
new_contents = new_contents.gsub("$AZMON_TELEGRAF_CUSTOM_PROM_SCRAPE_SCOPE", "# Commenting this out since new plugins will be created per namespace\n # $AZMON_TELEGRAF_CUSTOM_PROM_SCRAPE_SCOPE")

timeout_config_key = "timeout"
if is_windows?
# For windows, the timeout config key is different because of old version of telegraf
timeout_config_key = "response_timeout"
end

pluginConfigsWithNamespaces = ""
monitorKubernetesPodsNamespaces.each do |namespace|
if !namespace.nil?
Expand Down
4 changes: 2 additions & 2 deletions build/windows/installer/conf/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
#Prometheus Custom Metrics
[[inputs.prometheus]]
interval = "$AZMON_TELEGRAF_CUSTOM_PROM_INTERVAL"

## Scrape Kubernetes pods for the following prometheus annotations:
## - prometheus.io/scrape: Enable scraping for this pod
## - prometheus.io/scheme: If the metrics endpoint is secured then you will need to
Expand All @@ -150,7 +150,7 @@
# bearer_token_string = "abc_123"

## Specify timeout duration for slower prometheus clients (default is 3s)
timeout = "15s"
response_timeout = "15s"

## Optional TLS Config
tls_ca = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
Expand Down
1 change: 0 additions & 1 deletion kubernetes/windows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ ENV APPLICATIONINSIGHTS_AUTH "NzAwZGM5OGYtYTdhZC00NThkLWI5NWMtMjA3ZjM3NmM3YmRi"
ENV AZMON_COLLECT_ENV False
ENV CI_CERT_LOCATION "C://oms.crt"
ENV CI_KEY_LOCATION "C://oms.key"
ENV TELEGRAF_CONFIG_PATH "/etc/telegraf/telegraf.conf"

# Delete unnecessary files
RUN powershell -Command "Remove-Item -Recurse -Force 'C:\ruby31\share\doc\ruby\html\js'; \
Expand Down
13 changes: 2 additions & 11 deletions kubernetes/windows/main.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -812,15 +812,6 @@ function Start-Telegraf {
Write-Host "Failed to set environment variable NODE_IP for target 'machine' since it is either null or empty"
}

$telegrafConfigPath = [System.Environment]::GetEnvironmentVariable("TELEGRAF_CONFIG_PATH", "process")
if (![string]::IsNullOrEmpty($telegrafConfigPath)) {
[System.Environment]::SetEnvironmentVariable("TELEGRAF_CONFIG_PATH", $telegrafConfigPath, "machine")
Write-Host "Successfully set environment variable TELEGRAF_CONFIG_PATH - $($telegrafConfigPath) for target 'machine'..."
}
else {
Write-Host "Failed to set environment variable TELEGRAF_CONFIG_PATH for target 'machine' since it is either null or empty"
}

$hostName = [System.Environment]::GetEnvironmentVariable("HOSTNAME", "process")
Write-Host "nodename: $($hostName)"
Write-Host "replacing nodename in telegraf config"
Expand Down Expand Up @@ -852,8 +843,8 @@ function Start-Telegraf {
}
Write-Host "Running telegraf service in test mode"
C:\opt\telegraf\telegraf.exe --config "C:\etc\telegraf\telegraf.conf" --test
Write-Host "Starting telegraf service with auto restart"
C:\opt\telegraf\telegraf.exe --service-auto-restart
Write-Host "Starting telegraf service"
C:\opt\telegraf\telegraf.exe --service start

# Trying to start telegraf again if it did not start due to fluent bit not being ready at startup
Get-Service telegraf | findstr Running
Expand Down
2 changes: 1 addition & 1 deletion kubernetes/windows/setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Write-Host ('Finished Installing Fluentbit')
Write-Host ('Installing Telegraf');
try {
# For next telegraf update, make sure to update config changes in telegraf.conf, tomlparser-prom-customconfig.rb and tomlparser-osm-config.rb
$telegrafUri='https://dl.influxdata.com/telegraf/releases/telegraf-1.33.1_windows_amd64.zip'
$telegrafUri='https://dl.influxdata.com/telegraf/releases/telegraf-1.24.2_windows_amd64.zip'
Invoke-WebRequest -Uri $telegrafUri -OutFile /installation/telegraf.zip
Expand-Archive -Path /installation/telegraf.zip -Destination /installation/telegraf
Move-Item -Path /installation/telegraf/*/* -Destination /opt/telegraf/ -ErrorAction SilentlyContinue
Expand Down

0 comments on commit c6c8769

Please sign in to comment.