diff --git a/build/common/installer/scripts/tomlparser-prom-customconfig.rb b/build/common/installer/scripts/tomlparser-prom-customconfig.rb index 8568850ec1..78edcb09a4 100644 --- a/build/common/installer/scripts/tomlparser-prom-customconfig.rb +++ b/build/common/installer/scripts/tomlparser-prom-customconfig.rb @@ -119,6 +119,16 @@ def createPrometheusPluginsWithNamespaceSetting(monitorKubernetesPods, monitorKu timeout_config_key = "response_timeout" end + # 'fieldpass'/'fielddrop' were deprecated in telegraf 1.29.0 and removed in 1.40.0. + # Windows still ships telegraf 1.24.2, which predates the replacement options, so it + # must keep emitting the legacy option names. + field_include_key = "fieldinclude" + field_exclude_key = "fieldexclude" + if is_windows? + field_include_key = "fieldpass" + field_exclude_key = "fielddrop" + end + pluginConfigsWithNamespaces = "" monitorKubernetesPodsNamespaces.each do |namespace| if !namespace.nil? @@ -133,8 +143,8 @@ def createPrometheusPluginsWithNamespaceSetting(monitorKubernetesPods, monitorKu monitor_kubernetes_pods_namespace = \"#{namespace}\" kubernetes_label_selector = \"#{kubernetesLabelSelectors}\" kubernetes_field_selector = \"#{kubernetesFieldSelectors}\" - fieldpass = #{fieldPassSetting} - fielddrop = #{fieldDropSetting} + #{field_include_key} = #{fieldPassSetting} + #{field_exclude_key} = #{fieldDropSetting} metric_version = #{@metricVersion} url_tag = \"#{@urlTag}\" #{timeout_config_key} = \"#{@responseTimeout}\" diff --git a/build/linux/installer/conf/telegraf-ama-logs-process-metrics.conf b/build/linux/installer/conf/telegraf-ama-logs-process-metrics.conf index 02da703021..a22ec03d24 100644 --- a/build/linux/installer/conf/telegraf-ama-logs-process-metrics.conf +++ b/build/linux/installer/conf/telegraf-ama-logs-process-metrics.conf @@ -22,9 +22,9 @@ exe = "mdsd" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -38,9 +38,9 @@ exe = "fluent-bit" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -54,9 +54,9 @@ pattern = "telegraf(-rs|-prom-side-car)?.conf" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -70,9 +70,9 @@ pattern = "telegraf-ama-logs-process-metrics.conf" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -85,9 +85,9 @@ name_prefix = "t.azm.ms/" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -104,9 +104,9 @@ exe = "crond" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -120,9 +120,9 @@ exe = "inotifywait" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -135,9 +135,9 @@ name_prefix = "t.azm.ms/" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" @@ -154,9 +154,9 @@ pattern = "main.sh" interval = "60s" pid_finder = "native" - pid_tag = true + tag_with = ["pid"] name_override = "agent_telemetry" - fieldpass = ["cpu_usage", "memory_rss"] + fieldinclude = ["cpu_usage", "memory_rss"] [inputs.procstat.tags] Computer = "placeholder_hostname" PodName = "placeholder_podname" diff --git a/build/linux/installer/conf/telegraf-prom-side-car.conf b/build/linux/installer/conf/telegraf-prom-side-car.conf index 5e1c99ee05..9a7bb0eb15 100644 --- a/build/linux/installer/conf/telegraf-prom-side-car.conf +++ b/build/linux/installer/conf/telegraf-prom-side-car.conf @@ -183,8 +183,8 @@ $AZMON_TELEGRAF_CUSTOM_PROM_KUBERNETES_LABEL_SELECTOR $AZMON_TELEGRAF_CUSTOM_PROM_KUBERNETES_FIELD_SELECTOR - fieldpass = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDPASS - fielddrop = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDDROP + fieldinclude = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDPASS + fieldexclude = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDDROP metric_version = 2 url_tag = "scrapeUrl" diff --git a/build/linux/installer/conf/telegraf-rs.conf b/build/linux/installer/conf/telegraf-rs.conf index 887e660ccb..12cf533737 100644 --- a/build/linux/installer/conf/telegraf-rs.conf +++ b/build/linux/installer/conf/telegraf-rs.conf @@ -574,8 +574,8 @@ $AZMON_TELEGRAF_CUSTOM_PROM_KUBERNETES_LABEL_SELECTOR $AZMON_TELEGRAF_CUSTOM_PROM_KUBERNETES_FIELD_SELECTOR - fieldpass = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDPASS - fielddrop = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDDROP + fieldinclude = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDPASS + fieldexclude = $AZMON_TELEGRAF_CUSTOM_PROM_FIELDDROP metric_version = 2 url_tag = "scrapeUrl" @@ -641,7 +641,7 @@ $AZMON_TELEGRAF_OSM_PROM_PLUGINS #name_prefix="container.azm.ms/" ## An array of urls to scrape metrics from. urls = $AZMON_INTEGRATION_NPM_METRICS_URL_LIST_CLUSTER - fielddrop = $AZMON_INTEGRATION_NPM_METRICS_DROP_LIST_CLUSTER + fieldexclude = $AZMON_INTEGRATION_NPM_METRICS_DROP_LIST_CLUSTER metric_version = 2 url_tag = "scrapeUrl" diff --git a/build/linux/installer/conf/telegraf.conf b/build/linux/installer/conf/telegraf.conf index 81925e0f0c..ed047284b8 100644 --- a/build/linux/installer/conf/telegraf.conf +++ b/build/linux/installer/conf/telegraf.conf @@ -448,7 +448,7 @@ ## Ignore mount points by filesystem type. ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs", "cifs", "fuse"] - fieldpass = ["free", "used", "used_percent"] + fieldinclude = ["free", "used", "used_percent"] taginclude = ["device","path","hostName"] # Below due to Bug - https://github.com/influxdata/telegraf/issues/5615 # ORDER matters here!! - i.e the below should be the LAST modifier @@ -489,7 +489,7 @@ ## The typical use case is for LVM volumes, to get the VG/LV name instead of ## the near-meaningless DM-0 name. # name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"] - fieldpass = ["reads", "read_bytes", "read_time", "writes", "write_bytes", "write_time", "io_time", "iops_in_progress"] + fieldinclude = ["reads", "read_bytes", "read_time", "writes", "write_bytes", "write_time", "io_time", "iops_in_progress"] taginclude = ["name","hostName"] # Read metrics about network interface usage @@ -501,12 +501,11 @@ ## # interfaces = ["eth0"] ## - ## On linux systems telegraf also collects protocol stats. - ## Setting ignore_protocol_stats to true will skip reporting of protocol metrics. + ## NOTE: protocol stats collection was removed in telegraf 1.37.0 and the + ## ignore_protocol_stats option became a no-op (removed in 1.45.0), so it is + ## no longer set here. Current behavior matches the previous "true" setting. ## - ignore_protocol_stats = true - ## - fieldpass = ["bytes_recv", "bytes_sent", "err_in", "err_out"] + fieldinclude = ["bytes_recv", "bytes_sent", "err_in", "err_out"] taginclude = ["interface","hostName"] # net plugin is collecting loopback interface metrics by default from telegraf 1.34.3 @@ -652,7 +651,7 @@ name_prefix="container.azm.ms/" ## An array of urls to scrape metrics from. urls = ["$CADVISOR_METRICS_URL"] - fieldpass = ["$KUBELET_RUNTIME_OPERATIONS_METRIC", "$KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC", "$KUBELET_RUNTIME_OPERATIONS_TOTAL_METRIC", "$KUBELET_RUNTIME_OPERATIONS_ERRORS_TOTAL_METRIC"] + fieldinclude = ["$KUBELET_RUNTIME_OPERATIONS_METRIC", "$KUBELET_RUNTIME_OPERATIONS_ERRORS_METRIC", "$KUBELET_RUNTIME_OPERATIONS_TOTAL_METRIC", "$KUBELET_RUNTIME_OPERATIONS_ERRORS_TOTAL_METRIC"] metric_version = 2 url_tag = "scrapeUrl" @@ -697,7 +696,7 @@ # <= 1.18: metric name is kubelet_running_pod_count # >= 1.19: metric name changed to kubelet_running_pods - fieldpass = ["kubelet_running_pod_count","kubelet_running_pods","volume_manager_total_volumes", "kubelet_node_config_error", "process_resident_memory_bytes", "process_cpu_seconds_total"] + fieldinclude = ["kubelet_running_pod_count","kubelet_running_pods","volume_manager_total_volumes", "kubelet_node_config_error", "process_resident_memory_bytes", "process_cpu_seconds_total"] metric_version = 2 url_tag = "scrapeUrl" @@ -721,9 +720,9 @@ ## An array of urls to scrape metrics from. urls = $AZMON_DS_PROM_URLS - fieldpass = $AZMON_DS_PROM_FIELDPASS + fieldinclude = $AZMON_DS_PROM_FIELDPASS - fielddrop = $AZMON_DS_PROM_FIELDDROP + fieldexclude = $AZMON_DS_PROM_FIELDDROP metric_version = 2 url_tag = "scrapeUrl" diff --git a/build/linux/installer/scripts/tomlparser-osm-config.rb b/build/linux/installer/scripts/tomlparser-osm-config.rb index e2fdcd289e..0215469149 100644 --- a/build/linux/installer/scripts/tomlparser-osm-config.rb +++ b/build/linux/installer/scripts/tomlparser-osm-config.rb @@ -108,7 +108,7 @@ def replaceOsmTelegrafConfigPlaceHolders monitor_kubernetes_pods = true pod_scrape_scope = \"#{(@controllerType.casecmp(@replicaset) == 0) ? "cluster" : "node"}\" monitor_kubernetes_pods_namespace = \"#{namespace}\" - fieldpass = #{@fieldPassSetting} + fieldinclude = #{@fieldPassSetting} metric_version = #{@metricVersion} url_tag = \"#{@urlTag}\" bearer_token = \"#{@bearerToken}\" diff --git a/kubernetes/linux/main.sh b/kubernetes/linux/main.sh index 53aeb26d3a..a5b2b10854 100644 --- a/kubernetes/linux/main.sh +++ b/kubernetes/linux/main.sh @@ -1242,7 +1242,7 @@ else if [ "${CONTAINER_TYPE}" == "PrometheusSidecar" ] && [ -e "/opt/telegraf-test-prom-side-car.conf" ]; then if [ "${MUTE_PROM_SIDECAR}" != "true" ]; then echo "****************Start Telegraf in Test Mode**************************" - /opt/telegraf --non-strict-env-handling --config /opt/telegraf-test-prom-side-car.conf --input-filter file -test + /opt/telegraf config check --non-strict-env-handling --config /opt/telegraf-test-prom-side-car.conf if [ $? -eq 0 ]; then mv "/opt/telegraf-test-prom-side-car.conf" "/etc/opt/microsoft/docker-cimprov/telegraf-prom-side-car.conf" echo "Moving test conf file to telegraf side-car conf since test run succeeded" @@ -1254,7 +1254,7 @@ else else if [ -e "/opt/telegraf-test.conf" ]; then echo "****************Start Telegraf in Test Mode**************************" - /opt/telegraf --non-strict-env-handling --config /opt/telegraf-test.conf --input-filter file -test + /opt/telegraf config check --non-strict-env-handling --config /opt/telegraf-test.conf if [ $? -eq 0 ]; then mv "/opt/telegraf-test.conf" "/etc/opt/microsoft/docker-cimprov/telegraf.conf" echo "Moving test conf file to telegraf daemonset conf since test run succeeded" @@ -1265,7 +1265,7 @@ else else if [ -e "/opt/telegraf-test-rs.conf" ]; then echo "****************Start Telegraf in Test Mode**************************" - /opt/telegraf --non-strict-env-handling --config /opt/telegraf-test-rs.conf --input-filter file -test + /opt/telegraf config check --non-strict-env-handling --config /opt/telegraf-test-rs.conf if [ $? -eq 0 ]; then mv "/opt/telegraf-test-rs.conf" "/etc/opt/microsoft/docker-cimprov/telegraf-rs.conf" echo "Moving test conf file to telegraf replicaset conf since test run succeeded" diff --git a/kubernetes/windows/setup.ps1 b/kubernetes/windows/setup.ps1 index ae544148d2..0b54deeb3a 100644 --- a/kubernetes/windows/setup.ps1 +++ b/kubernetes/windows/setup.ps1 @@ -42,6 +42,11 @@ 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 + # NOTE: Windows is intentionally pinned to an older telegraf than Linux. Linux uses the + # 'fieldinclude'/'fieldexclude' options (added in 1.29.0, replacing 'fieldpass'/'fielddrop' + # which were removed in 1.40.0), while the Windows configs below must keep the legacy + # 'fieldpass'/'fielddrop' names until telegraf here is upgraded to >= 1.29.0. + # tomlparser-prom-customconfig.rb is shared by both and branches on is_windows? for this. $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