Giter VIP home page Giter VIP logo

Comments (5)

zwopir avatar zwopir commented on June 12, 2024

Hi,

if I understand your question correctly, you want to specify a query and get the result as a metric? Unfortunately there is no possibility to do that. If you like you can elaborate on your use case so we can possibly put it on a feature list.

from elasticsearch_exporter.

vinkdong avatar vinkdong commented on June 12, 2024

@zwopir
If I define a query as:

GET xxx/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "level": "WARN"
          }
        }
      ],
      "filter": {
        "range": {
          "@timestamp": {
            "gte": "now-5m"
          }
        }
      }
    }
  }
}

Then we can get result as

{
  "took": 1067,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 8295,
    "max_score": 0.027100416,
    "hits": [
 ...

if there is a metrics es_query_count{app="xxx",level="warn",...} 8295 , I can get every 5 min's WARNING LEVEL data , and display it on grafana via prometheus then config alertmanger rule instead of elastalert.

from elasticsearch_exporter.

zwopir avatar zwopir commented on June 12, 2024

thanks for elaborating
we already thought about such a feature, but as a separate exporter. But it might be a good idea to integrate it into this exporter. There are a few challenging things with generic queries:

  • the are potentially executed very often (depending on your number of prometheus servers and scape interval). This makes the exporter a possible culprit to self-DoSing.
  • technically the structure of the query result is unknown to the exporter, so there must be a way to tell the exporter via configuration, where to expect the value to be exported, i.e. some jq-style syntax.

so for now there is no solution for your problem, but it's on a "list without milestones"

@tclass: FYI

from elasticsearch_exporter.

dominikschulz avatar dominikschulz commented on June 12, 2024

I'm strongly opposed to putting support for this usecase in this exporter. I'd propose to start a separate project to export custom metrics from ES.

from elasticsearch_exporter.

vinkdong avatar vinkdong commented on June 12, 2024

@zwopir @dominikschulz Thanks, now I think I need to start a new project for my case

from elasticsearch_exporter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.