已启动的k8s emqx集群怎么通过API 命令行关闭promethus监控

prometheus.enable 设置成false后
prometheus {
mnesia_collector = disabled
vm_dist_collector = disabled
vm_memory_collector = disabled
vm_msacc_collector = disabled
vm_statistics_collector = disabled
vm_system_info_collector = disabled
}
以上这些指标会自动停止收集吗?
或者我要在已启动的集群停止这些指标收集该用什么指令呢?

您好。以下是emqx e5.x上关闭promethus监控的api命令。只要将"enable"的值设置为false,执行api返回status code 200,就表示promethus监控已经关闭。

curl -X 'PUT' \
  'http://10.42.6.245:18083/api/v5/prometheus' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic OWU4MGZhOTRhOGE3N2YwNzpFbnNQaW9LeGt1YzRWdTc3czhHcDRIbDlBaE9XMGFEMGw5Q0diaGxPYTlCZjhQ' \
  -H 'Content-Type: application/json' \
  -d '{
  "enable": false,
  "headers": {
    "header-name": "header-value"
  },
  "interval": "15s",
  "job_name": "${name}/instance/${name}~${host}",
  "push_gateway_server": "http://127.0.0.1:9091"
}'

能通过调用
curl -X ‘PUT’
http://10.42.6.245:18083/api/v5/prometheus
-H ‘accept: application/json’
-H ‘Authorization: Basic OWU4MGZhOTRhOGE3N2YwNzpFbnNQaW9LeGt1YzRWdTc3czhHcDRIbDlBaE9XMGFEMGw5Q0diaGxPYTlCZjhQ’
-H ‘Content-Type: application/json’
-d ‘{
“mnesia_collector”: disabled,
“vm_dist_collector”: disabled,
“headers”: {
“header-name”: “header-value”
},
“interval”: “15s”,
“job_name”: “${name}/instance/${name}~${host}”,
“push_gateway_server”: “http://127.0.0.1:9091
}’

这样的命令仅关掉mnesiacollector这些而不把整个promethus关掉吗?或者说先关掉然后加上这些disabled参数再开起来?

这样的命令仅关掉mnesiacollector这些而不把整个promethus关掉吗

可以的

按照上述指令调用接口后出现这样的报错
[error] msg: post_to_push_gateway_failed, mfa: emqx_prometheus:push_to_push_gateway/3, line: 136, error: {error,{failed_connect,[{to_address,{“127.0.0.1”,9091}},{inet,[inet],econnrefused}]}}, headers: [{“header-name”,“header-value”}], url: http://127.0.0.1:9091/metrics/job/emqx/instance/emqx~emqx-cluster-1.emqx-headless.amq.svc.cluster.local

可能是因为我用的这个方法使用 Prometheus+Grafana 监控 EMQX 集群 | EMQX Operator2.1.1 文档
集成的监控所以不可行?