Giter Site home page Giter Site logo

Comments (8)

jpdstan avatar jpdstan commented on May 19, 2024 4

@zsrinivas for a single stat panel in grafana you can do something like

max(elasticsearch_cluster_health_status{color="green",cluster=~"my_cluster"}) + ON(cluster) 
max(elasticsearch_cluster_health_status{color="yellow",cluster=~"my_cluster"})* 2 + ON(cluster) 
max(elasticsearch_cluster_health_status{color="red",cluster=~"my_cluster"}) * 3

and then create value mappings in the grafana dashboard to map the values 1, 2, 3 to green, yellow, and red respectively.

from elasticsearch_exporter.

jpdstan avatar jpdstan commented on May 19, 2024 3

@QuanTran91 you can think of them as SQL joins, i.e. "join results from left side with right side where cluster is the same". if you do not include the ON(<labels>), then the left side will "join" only with a metric that has the EXACT same set of labels. ON(<labels>) lets you specify the label(s) to join on. it's not always necessary but it's recommended since labels are very dynamic and it is possible that the green metric may have labels that the yellow metric does not have, or vice versa.

read more here: https://prometheus.io/docs/prometheus/latest/querying/operators/#many-to-one-and-one-to-many-vector-matches

from elasticsearch_exporter.

zwopir avatar zwopir commented on May 19, 2024

see https://github.com/justwatchcom/elasticsearch_exporter/blob/master/collector/cluster_health.go#L195 and
https://github.com/justwatchcom/elasticsearch_exporter/blob/master/collector/cluster_health.go#L275

So the values are for example

elasticsearch_cluster_health_status{cluster="elasticsearch",color="green"} 1
elasticsearch_cluster_health_status{cluster="elasticsearch",color="red"} 0
elasticsearch_cluster_health_status{cluster="elasticsearch",color="yellow"} 0

from elasticsearch_exporter.

burton-scalefastr avatar burton-scalefastr commented on May 19, 2024

wait,, both read AND yellow are 0 ??

from elasticsearch_exporter.

dannyk81 avatar dannyk81 commented on May 19, 2024

from elasticsearch_exporter.

zwopir avatar zwopir commented on May 19, 2024

we chose this representation to avoid a made up mapping like

green = 1
yellow = 2
red = 3

(you can't have string values in prometheus. The json from ES contains a string in the cluster-health-status value).

I hope the explanation makes it clear, closing the issue. If there are further questions, just reopen the ticket

from elasticsearch_exporter.

zsrinivas avatar zsrinivas commented on May 19, 2024

hey @zwopir , any idea on how I can make a single stat panel in grafana with this kind of value format. also thought about a bit on how I can make an alert on this but still confused.

from elasticsearch_exporter.

QuanTran91 avatar QuanTran91 commented on May 19, 2024

Hi @jpdstan , I am just curios since I am a Promql newbie
What does the "ON(cluster) " mean here?
Thank a lot

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.