简体   繁体   English

如何使用 Elasticseacrh_exporter 将 Elastic-search 指标提取到 Prometheus 中

[英]How do I pull Elastic-search metrics into Prometheus using the Elasticseacrh_exporter

I have installed Prometheus into a Kubernetes cluster using the helm stable chart.我已经使用 helm stable 图表将 Prometheus 安装到 Kubernetes 集群中。 We run Elastic Search and I want to scrape metrics from this and then create Alerts based on events.我们运行 Elastic Search,我想从中抓取指标,然后根据事件创建警报。 I have installed the elasticsearch exporter via helm but no where can I find how I then import these metrics into Prometheus ?我已经通过 helm 安装了 elasticsearch 导出器,但在哪里可以找到如何将这些指标导入 Prometheus 的方法?

There is some config I am missing such as creating a scraping job or something.我缺少一些配置,例如创建抓取作业或其他东西。 Anyone can help much appreciated.任何人都可以提供帮助,非常感谢。

I connected to the elasticsearch exporter and can see it pulling metrics.我连接到 elasticsearch 导出器,可以看到它正在拉取指标。

If you're using an elasticsearch exporter it should contain some documentation.如果您使用的是elasticsearch 导出器,它应该包含一些文档。 There are more than just one solution out there and you didn't specify which one you're using.有不止一种解决方案,您没有指定您使用的是哪一种。 In my opinion it would be best for you to start from a tutorial like this one which explains step by step the whole process.在我看来,最好从像这样的教程开始,它一步一步地解释了整个过程。 As you can read there:正如你可以在那里读到的:

Metrics collection of Prometheus follows the pull model. Prometheus 的指标集合遵循拉模型。 That means, Prometheus is responsible for getting metrics from the services that it monitors.这意味着,Prometheus 负责从它监控的服务中获取指标。 This process introduced as scraping.这个过程被称为刮擦。 Prometheus server scrapes the defined service endpoints, collect the matrixes and store in local database. Prometheus 服务器抓取定义的服务端点,收集矩阵并存储在本地数据库中。

which means you need to configure Prometheus to scrape metrics exposed by the elasticsearch exporter you chose.这意味着您需要配置Prometheus来抓取您选择的elasticsearch 导出器公开的指标。

Official Prometheus documentation will be also a great source of knowledge and good starting point.官方Prometheus文档也将是重要的知识来源和良好的起点。

EDIT:编辑:

If you run your Elasticsearch instance on Kubernetes cluster, you should rather use the Service Discovery mechanism than static configs.如果您在 Kubernetes 集群上运行 Elasticsearch 实例,您应该使用服务发现机制而不是静态配置。 More on <kubernetes_sd_config> you can find here .有关<kubernetes_sd_config>更多信息,您可以在此处找到。

There are five different types of Kubernetes service discoveries you can use with Prometheus: node , endpoints , service , pod , and ingress . Prometheus 可以使用五种不同类型的 Kubernetes 服务发现nodeendpointsservicepodingress The one which you most probably need in your case is endpoints .在您的情况下,您最可能需要的是endpoints Prometheus uses the Kubernetes API to discover targets. Prometheus 使用 Kubernetes API 来发现目标。 Below you have some examples:下面你有一些例子:

https://blog.sebastian-daschner.com/entries/prometheus-kubernetes-discovery https://raw.githubusercontent.com/prometheus/prometheus/master/documentation/examples/prometheus-kubernetes.yml https://blog.sebastian-daschner.com/entries/prometheus-kubernetes-discovery https://raw.githubusercontent.com/prometheus/prometheus/master/documentation/examples/prometheus-kubernetes.yml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM