我有一个包含 Windows 和 Linux 节点和容器的 AKS 集群。对于 Linux,我通常使用 Prometheus 收集指标,但不显示 Windows 指标。我已经安装并配置了 windows_exporter https://github.com/prometheus-community/windows_exporter 。显示与 windows_exporter 位于同一命名空间中的 pod 的指标。您能帮助我如何从其他 namespace 收集矩阵吗?或者建议如何最好地从 Windows AKS 节点和 Pod 收集指标。谢谢。
最佳答案
您可以尝试以下步骤:
下载Windows-Exporter后, 在终端中打开文件夹并运行:
.\windows_exporter.exe --collectors.enabled "cpu,cs,logical_disk,os,system,net"
启动Windows-Exporter后,配置 Prometheus 通过在以下内容中添加以下内容来抓取导出器
scrapes_configs
数组:- job_name: "windows_exporter" static_configs: - targets: ["localhost:9182"]
现在,通过添加以下内容将Prometheus配置为远程写入 下面的
根配置
:remote_write: - url: "https://<PROMETHEUS_SERVER_NAME>/prometheus/remote/write" tls_config: insecure_skip_verify: true
执行上述步骤后,您就可以启动 Prometheus 如果您希望保留一天数据或保留数据 根据您的要求,您可以运行以下命令:
prometheus.exe --storage.tsdb.retention.time=1d ##as per your requirement change 1d
引用:
Monitoring a Windows cluster with Prometheus – Sysdig
或
正如RahulKumarShaw-MT建议的那样,您可以引用How to export metrics from Windows Kubernetes nodes in AKS - Octopus Deploy和 aidapsibr/aks-prometheus-windows-exporter
关于azure - windows 导出器不从其他命名空间收集指标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70439618/