首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在普罗米修斯中,我如何立即获取触发警报的数量?

在普罗米修斯中,我如何立即获取触发警报的数量?
EN

Stack Overflow用户
提问于 2017-07-07 01:08:02
回答 2查看 2K关注 0票数 0

查看与prometheus相关的指标列表,我发现

代码语言:javascript
复制
prometheus_build_info
prometheus_config_last_reload_success_timestamp_seconds
prometheus_config_last_reload_successful
prometheus_engine_queries
prometheus_engine_queries_concurrent_max
prometheus_engine_query_duration_seconds
prometheus_engine_query_duration_seconds_count
prometheus_engine_query_duration_seconds_sum
prometheus_evaluator_duration_seconds
prometheus_evaluator_duration_seconds_count
prometheus_evaluator_duration_seconds_sum
prometheus_evaluator_iterations_missed_total
prometheus_evaluator_iterations_skipped_total
prometheus_evaluator_iterations_total
prometheus_local_storage_checkpoint_duration_seconds_count
prometheus_local_storage_checkpoint_duration_seconds_sum
prometheus_local_storage_checkpoint_last_duration_seconds
prometheus_local_storage_checkpoint_last_size_bytes
prometheus_local_storage_checkpoint_series_chunks_written_count
prometheus_local_storage_checkpoint_series_chunks_written_sum
prometheus_local_storage_checkpointing
prometheus_local_storage_chunk_ops_total
prometheus_local_storage_chunks_to_persist
prometheus_local_storage_fingerprint_mappings_total
prometheus_local_storage_inconsistencies_total
prometheus_local_storage_indexing_batch_duration_seconds
prometheus_local_storage_indexing_batch_duration_seconds_count
prometheus_local_storage_indexing_batch_duration_seconds_sum
prometheus_local_storage_indexing_batch_sizes
prometheus_local_storage_indexing_batch_sizes_count
prometheus_local_storage_indexing_batch_sizes_sum
prometheus_local_storage_indexing_queue_capacity
prometheus_local_storage_indexing_queue_length
prometheus_local_storage_ingested_samples_total
prometheus_local_storage_maintain_series_duration_seconds
prometheus_local_storage_maintain_series_duration_seconds_count
prometheus_local_storage_maintain_series_duration_seconds_sum
prometheus_local_storage_memory_chunkdescs
prometheus_local_storage_memory_chunks
prometheus_local_storage_memory_dirty_series
prometheus_local_storage_memory_series
prometheus_local_storage_non_existent_series_matches_total
prometheus_local_storage_open_head_chunks
prometheus_local_storage_out_of_order_samples_total
prometheus_local_storage_persist_errors_total
prometheus_local_storage_persistence_urgency_score
prometheus_local_storage_queued_chunks_to_persist_total
prometheus_local_storage_rushed_mode
prometheus_local_storage_series_chunks_persisted_bucket
prometheus_local_storage_series_chunks_persisted_count
prometheus_local_storage_series_chunks_persisted_sum
prometheus_local_storage_series_ops_total
prometheus_local_storage_started_dirty
prometheus_local_storage_target_heap_size_bytes
prometheus_notifications_dropped_total
prometheus_notifications_errors_total
prometheus_notifications_latency_seconds
prometheus_notifications_latency_seconds_count
prometheus_notifications_latency_seconds_sum
prometheus_notifications_queue_capacity
prometheus_notifications_queue_length
prometheus_notifications_sent_total
prometheus_rule_evaluation_duration_seconds
prometheus_rule_evaluation_duration_seconds_count
prometheus_rule_evaluation_duration_seconds_sum
prometheus_rule_evaluation_failures_total
prometheus_sd_azure_refresh_duration_seconds
prometheus_sd_azure_refresh_duration_seconds_count
prometheus_sd_azure_refresh_duration_seconds_sum
prometheus_sd_azure_refresh_failures_total
prometheus_sd_consul_rpc_duration_seconds
prometheus_sd_consul_rpc_duration_seconds_count
prometheus_sd_consul_rpc_duration_seconds_sum
prometheus_sd_consul_rpc_failures_total
prometheus_sd_dns_lookup_failures_total
prometheus_sd_dns_lookups_total
prometheus_sd_ec2_refresh_duration_seconds
prometheus_sd_ec2_refresh_duration_seconds_count
prometheus_sd_ec2_refresh_duration_seconds_sum
prometheus_sd_ec2_refresh_failures_total
prometheus_sd_file_read_errors_total
prometheus_sd_file_scan_duration_seconds
prometheus_sd_file_scan_duration_seconds_count
prometheus_sd_file_scan_duration_seconds_sum
prometheus_sd_gce_refresh_duration
prometheus_sd_gce_refresh_duration_count
prometheus_sd_gce_refresh_duration_sum
prometheus_sd_gce_refresh_failures_total
prometheus_sd_kubernetes_events_total
prometheus_sd_marathon_refresh_duration_seconds
prometheus_sd_marathon_refresh_duration_seconds_count
prometheus_sd_marathon_refresh_duration_seconds_sum
prometheus_sd_marathon_refresh_failures_total
prometheus_sd_triton_refresh_duration_seconds
prometheus_sd_triton_refresh_duration_seconds_count
prometheus_sd_triton_refresh_duration_seconds_sum
prometheus_sd_triton_refresh_failures_total
prometheus_target_interval_length_seconds
prometheus_target_interval_length_seconds_count
prometheus_target_interval_length_seconds_sum
prometheus_target_scrape_pool_sync_total
prometheus_target_scrapes_exceeded_sample_limit_total
prometheus_target_skipped_scrapes_total
prometheus_target_sync_length_seconds
prometheus_target_sync_length_seconds_count
prometheus_target_sync_length_seconds_sum
prometheus_treecache_watcher_goroutines
prometheus_treecache_zookeeper_failures_total

没有一个看起来像是直接给了我我要找的号码。

我得到的最接近的是rate(prometheus_notifications_sent_total[1m])

这似乎给出了我在1分钟间隔内发送的通知的数量--这不是我想要的,因为一些通知以不同的时间间隔发出,而且数据中的噪声也比我希望的要多。

我想在grafana仪表板上显示当前正在触发的普罗米修斯通知的数量。我能用普罗米修斯表达式来做这件事吗?如果是这样,表达式应该是什么样子的?

编辑:

我所说的“触发”是指在prometheus上的警报仪表板中被列为活动的警报的数量。

例如:

如果您打开dropdown,您将获得每个活动警报的条目,并且状态为“启动”。我想这就是“解雇”这个词的由来。

EN

回答 2

Stack Overflow用户

发布于 2018-12-13 11:29:58

警报是名为警报的特殊指标。我不熟悉Grafana,所以我个人会使用http API来计算当前触发的警报的数量,如下所示:

代码语言:javascript
复制
curl -s 'http://prometheus-002:9090/api/v1/query?query=ALERTS{alertstate="firing"}' \
  |grep -o '"__name__":' |wc -l

也许你可以制定一个记录规则来制定一个元指标,然后告诉Grafana去测量它。

票数 1
EN

Stack Overflow用户

发布于 2019-06-20 21:19:26

要立即查看所有活动的警报,请执行以下操作:

count(ALERTS{alertstate="firing"})

查看特定警报THE_NAME_OF_THE_ALERT的编号

count(ALERTS{alertname="THE_NAME_OF_THE_ALERT",alertstate="firing"})

另一种选择是,如果您想要在触发警报之前查看失败的原因(可能定时为在失败10秒后触发):

count(probe_success == 0)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44955125

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档