我正在尝试使用以下查询检索标准化的 CPU 利用率百分比。
curl -H "Content-Type: application/json" -X POST http://localhost:12001/metricbeat*/_search?pretty=true -d '{"query":{"bool":{"must": [{"range": {"system.cpu.total.norm.pct": {"gte": 0.1}}},{"range": {"@timestamp": {"gte": "now-10m","lte": "now/m"}}}]}}}'
我想要过去 10 分钟的标准化百分比,但我没有得到任何数据。以下是回应。
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 8,
"successful" : 8,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
但是,如果我用“ system.cpu.total.pct ”查询elasticsearch,我会得到数据。另外,我用“ cpu.metrics: ["percentages", "normalized_percentages", "ticks"] "更新了"CPU"的配置。
谁能让我知道为什么规范化查询不起作用?
下面是我的 metricbeat.reference.yml 配置。
module: system
metricsets:
- cpu # CPU usage
- load # CPU load averages
- memory # Memory usage
- network # Network IO
- process # Per process metrics
- process_summary # Process summary
- uptime # System Uptime
- core # Per CPU core usage
#- diskio # Disk IO
- filesystem # File system usage for each mountpoint
#- fsstat # File system summary metrics
#- raid # Raid
#- socket # Sockets and connection info (linux only)
enabled: true
period: 10s
processes: ['.*']
# Configure the metric types that are included by these metricsets.
cpu.metrics: ["percentages", "normalized_percentages", "ticks"] # The other available options are normalized_percentages and ticks.
core.metrics: ["percentages"] # The other available option is ticks.
弹性搜索模块:
module: elasticsearch
metricsets:
- node
- node_stats
#- index
#- index_recovery
#- index_summary
#- shard
#- ml_job
period: 10s
hosts: ["localhost:8881"]
我已启用 kibana 作为输出主机:
# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
# This requires a Kibana endpoint configuration.
setup.kibana:
# Kibana Host
# Scheme and port can be left out and will be set to the default (http and 5601)
# In case you specify and additional path, the scheme is required: http://localhost:5601/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:5601
host: "localhost:8882"