pushgateway | Push acceptor for ephemeral and batch jobs | Continuous Deployment library

 by   prometheus Go Version: v1.6.0 License: Apache-2.0

kandi X-RAY | pushgateway Summary

kandi X-RAY | pushgateway Summary

pushgateway is a Go library typically used in Devops, Continuous Deployment, Docker, Prometheus applications. pushgateway has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

The Prometheus server will attach a job label and an instance label to each scraped metric. The value of the job label comes from the scrape configuration. When you configure the Pushgateway as a scrape target for your Prometheus server, you will probably pick a job name like pushgateway. The value of the instance label is automatically set to the host and port of the target scraped. Hence, all the metrics scraped from the Pushgateway will have the host and port of the Pushgateway as the instance label and a job label like pushgateway. The conflict with the job and instance labels you might have attached to the metrics pushed to the Pushgateway is solved by renaming those labels to exported_job and exported_instance. However, this behavior is usually undesired when scraping a Pushgateway. Generally, you would like to retain the job and instance labels of the metrics pushed to the Pushgateway. That's why you have set honor_labels: true in the scrape config for the Pushgateway. It enables the desired behavior. See the documentation for details. This leaves us with the case where the metrics pushed to the Pushgateway do not feature an instance label. This case is quite common as the pushed metrics are often on a service level and therefore not related to a particular instance. Even with honor_labels: true, the Prometheus server will attach an instance label if no instance label has been set in the first place. Therefore, if a metric is pushed to the Pushgateway without an instance label (and without instance label in the grouping key, see below), the Pushgateway will export it with an empty instance label ({instance=""}), which is equivalent to having no instance label at all but prevents the server from attaching one.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pushgateway has a medium active ecosystem.
              It has 2605 star(s) with 423 fork(s). There are 61 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 5 open issues and 236 have been closed. On average issues are closed in 93 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of pushgateway is v1.6.0

            kandi-Quality Quality

              pushgateway has 0 bugs and 0 code smells.

            kandi-Security Security

              pushgateway has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pushgateway code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              pushgateway is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              pushgateway releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.
              It has 23883 lines of code, 96 functions and 31 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pushgateway and discovered the below as its top functions. This is intended to give you an instant insight into pushgateway implemented functionality, and help decide if they suit your requirements.
            • Compute style .
            • Flip the flip
            • Run arrow .
            • Parse an offset string
            • Create a new Popper instance
            • Ensures that a popper element has been applied to it .
            • Gets the boundaries of a popper element
            • Calculates the offset relative to the child of an element .
            • Computes auto placement .
            • Returns the bounding rect of an element .
            Get all kandi verified functions for this library.

            pushgateway Key Features

            No Key Features are available at this moment for pushgateway.

            pushgateway Examples and Code Snippets

            No Code Snippets are available at this moment for pushgateway.

            Community Discussions

            QUESTION

            Grafana Datasource Prometheus 404
            Asked 2022-Feb-25 at 10:13

            We are using AWS EKS, i deployed Promethus using the below command:

            ...

            ANSWER

            Answered 2022-Feb-25 at 10:13

            This is because you're targeting the wrong service. You're using the alert manager url instead of the prometheus server.
            The URL should be this one :

            Source https://stackoverflow.com/questions/71261619

            QUESTION

            Monitor application metric to grafana with grafana agent / prometheus
            Asked 2021-Dec-27 at 11:49

            Description

            Being new to the grafana and prometheus world, I am struggeling to add custom metrics from my laravel php cli application to grafana cloud - preferably via grafana agent.

            Situation

            I am using grafana cloud with their grafana agent on a linux server that is running a laravel php worker without a web server. The grafana agent is running with node_exporter integration. I have already tried to find some documentation on how to add a custom exporter or adding a scraper to gather information. What I have currently found is that the agent will be somehow (?) querying an HTTP endpoint and parse the response (which format?) to post it to the grafa cloud endpoint (prometheus push gateway as far as I understood).

            I did not find a documentation on how to write a custom exporter for the grafana agent, since I am running a php worker thread without an http endpoint on that server. Exposing those information on an endpoint is doable but feels wrong, isn't it? Basically I'd like to do a 'php artisan mypackage:metrics' and let that call generate the correct output which then is used by the agent to post to grafana.

            Questions

            • How can I write my custom exporter that is queried by the grafana agent?
            • What is the correct data format?
            • If grafana agent exporter is not the right direction, how can scraping work?

            What I've tried

            • regarding the data structure / format

            According to [1], I tried to create my custom metrics like the following - correct?

            ...

            ANSWER

            Answered 2021-Dec-27 at 11:49

            Grafana Agent works with the same metric format Prometheus does. It is focused on scraping metrics instead of Prometheus and pushing them (remote_write) to the Prometheus instance that Grafana Cloud hosts for you. This is mentioned in the list of product features.

            You can use Prometheus PHP library to create metrics and avoid troubles with the raw format. The best practices are also applicable.

            Once you are done with creating metrics, you need to instruct the agent to scrape them from your server. Use these docs (one, two) for reference.

            Source https://stackoverflow.com/questions/70272871

            QUESTION

            Monitor result of a bash command or shell script using Prometheus
            Asked 2021-Nov-02 at 15:44

            My requirement is to monitor the helpdesk system of the company which is running inside the Kubernetes cluster, for example, URL https://xyz.zendesk.com

            They provide their API set to monitor this efficiently.

            We can easily check the status using curl

            ...

            ANSWER

            Answered 2021-Nov-02 at 15:44

            What you probably (!?) want is something that:

            1. Provides an HTTP(s) (e.g. /metrics) endpoint
            2. Producing metrics in Prometheus' exposition format
            3. From Zendesk's API

            NOTE curl only gives you #3

            There are some examples of solutions that appear to meet the requirements but none is from Zendesk:

            https://www.google.com/search?q=%22zendesk%22+prometheus+exporter

            There are >2 other lists of Prometheus exporters (neither contains Zendesk):

            I recommend you contact Zendesk and ask whether there's a Prometheus Exporter already. It's surprising to not find one.

            It is straightforward to write a Prometheus Exporter. Prometheus Client libraries and Zendesk API client are available and preferred. While it's possible, bash is probably sub-optimal.

            If all you want to do is GET that static endpoint, get a 200 response code and confirm that the body is [], you may be able to use Prometheus Blackbox exporter

            NOTE Logging and monitoring tools often provide a higher-level tool that provides something analogous to a "universal translator", facilitating translation from 3rd-party systems' native logging|monitoring formats into some canonical form using config rather than code. Although in the logging space, fluentd is an example. To my knowledge, there is no such tool for Prometheus but I sense that there's an opportunity for someone to create one.

            Source https://stackoverflow.com/questions/69797881

            QUESTION

            How to see the hostname of the instance that has generated the data for Pushgateway
            Asked 2021-Oct-08 at 05:54

            I have prometheus server that is using self discovery for Azure VMs which are running WMI exporter. In Grafana I am using dashboard variables for filtering (see screenshot).

            On the VMs I have created a custom exporter that outputs the metric with the value of 1 for each server and each server is sending the values to a single Pushgateway that is configured in etc/prometheus/prometheus.yaml

            ...

            ANSWER

            Answered 2021-Oct-08 at 05:54

            You can use metric_relabel_configs to rewrite labels after scraping. An example:

            Source https://stackoverflow.com/questions/69484882

            QUESTION

            How to write a Bash Script for Pushgateway and prometheus
            Asked 2021-Oct-05 at 16:01

            I spend some days to try to use a bash script for Pushgateway and Prometheus.. but this script doesn't work.. Actually I have Pushgateway on my raspberry and Prometheus on another raspberry. All work correctly and I test a simple bash script, this script works correctly. My simple script (test.sh) :

            ...

            ANSWER

            Answered 2021-Sep-10 at 16:07

            If your problem is too complex, divide it into smaller, more manageable pieces and see what they do. Start by analysing output from the awk part.

            AWK can be a bit of a handful.

            Try a simpler approach:

            Source https://stackoverflow.com/questions/69134419

            QUESTION

            Use Flink Prometheous PushGateway Repoter but happened OOM
            Asked 2021-Oct-02 at 02:17

            The FLink version is 1.12, I follow the step(https://ci.apache.org/projects/flink/flink-docs-release-1.12/deployment/metric_reporters.html#prometheuspushgateway-orgapacheflinkmetricsprometheusprometheuspushgatewayreporter), fill my config, run my job in Flink cluster. but after a few hours, I find cannot see metric data on grafana, so i loigin server and see pushgateway log, find like "Out of memory" error log.

            i dont understand, actually i set deleteOnShutdown=true and some of my jobs is closed. why pushgateway will OOM?

            ...

            ANSWER

            Answered 2021-Oct-02 at 02:17

            This problem has always existed, However, it was not described in the previous v1.13 documents. you can see the pull request to get more info.

            If you want to use push model in your Flink cluster, i recommend use influxdb.

            Source https://stackoverflow.com/questions/69413339

            QUESTION

            How to use recording rules from Loki
            Asked 2021-Sep-28 at 13:39

            I'm trying to use Loki new Recording Rules without alerting.

            What is not clear to me is where would the result of the rule evaluation be available?

            Can the ruler be scraped for the metrics values or they have to be pushed to something like Prometheus Pushgateway?

            ...

            ANSWER

            Answered 2021-Sep-27 at 16:51

            Accordingly, to the Loki documentation, metrics must be pushed to Prometheus, Cortex, or Thanos:

            With recording rules, you can run these metric queries continually on an interval and have the resulting metrics written to a Prometheus-compatible remote-write endpoint. They produce Prometheus metrics from log entries.

            At the time of writing, these are the compatible backends that support this:

            • Prometheus (>=v2.25.0)
            • Cortex
            • Thanos (Receiver)

            Source https://stackoverflow.com/questions/69347773

            QUESTION

            Possible to modify generated helm template?
            Asked 2021-Sep-03 at 11:40

            I'm using a static yaml file to install gitlab. Therefore I run

            ...

            ANSWER

            Answered 2021-Sep-03 at 11:40

            In general, it's hard to modify the output of a Helm chart. You can configure things the chart author has specifically allowed using Helm template syntax but not make arbitrary changes.

            Typically I would expect a chart to not include an explicit namespace: at all, and to honor the helm install --namespace option (helm template has a similar option). Configuring a Service is extremely common and I would expect the chart to have settings for that.

            If you're using the official GitLab cloud native Helm Chart then it has a lot of settings, including specifically for the GitLab Shell chart. In your values.yaml file you should be able to specify

            Source https://stackoverflow.com/questions/69042024

            QUESTION

            Combining multiple docker images
            Asked 2021-Aug-12 at 15:51

            I think I might have some misconceptions about how to run docker. So far I had a server and a script to run multiple docker images.

            Now I would like to have a single docker image that contains all of that, but I'm running into some issues.

            This is my Dockerfile:

            ...

            ANSWER

            Answered 2021-Aug-12 at 06:09

            With what you afforded as next, in fact you are using multi-stage-build, but only the last image will be act as the base image of final produced image. The final produced image won't have anything which in the former 3 images, unless you explicitly copy things to the last stage. So this definitely won't meet your requirement:

            Source https://stackoverflow.com/questions/68744156

            QUESTION

            How can I measure the daily rate of a counter event in Prometheus?
            Asked 2021-Aug-07 at 11:37

            I am trying to calculate the number of events (in my example deployments) per day. What I'm doing currently is that I'm sending the following counter events based on the HTTP API of pushgateway's

            ...

            ANSWER

            Answered 2021-Aug-07 at 11:37

            First of all, the rate() function calculate the per-second rate of increase of a counter. That is, even if your counter values were accurate, you would get the number of deployments happening per second (during the past 24 hours), and not per day.

            If you want to calculate the number of deployments during the past 24 hours, there's the increase() function: increase(deployments_count[24h]).

            But the reason that your current expression yields 0, is that the counter value always is 1. A counter must be incremented on every occurrence of an event (see Prometheus docs).

            That is, you must somehow keep track of the current value of the counter and increment it on every deployment before pushing it to the Pushgateway, rather than just pushing 1 on every event. The latter approach doesn't work and it looks to Prometheus as if the value never changes.

            There are two possible approaches for addressing this:

            1. Not using a Pushgateway

            Are you sure you need a Pushgateway or can you incorporate a Prometheus client library in your code? Check When to use the Pushgateway, and, in particular, a Pushgateway is not a distributed counter. In essence, the use case for a Pushgateway is for ephemeral jobs that need to deposit their metrics somewhere before they terminate.

            If your code is permanently running, on the other hand, a Prometheus client library takes care of the counter incrementation logic and exposes the metric so that it can be directly scraped by Prometheus.

            2. Keep track of counter value

            If you must use a Pushgateway, you need to keep track of the current counter value so that you can increment it. You can either do it in your code, or query the current value from the Pushgateway itself, increment it, and push it back. Both of these approaches run into problems when there are multiple processes contributing to the counter (i.e. concurrent updates, race conditions).

            Source https://stackoverflow.com/questions/68690875

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pushgateway

            You can download it from GitHub.

            Support

            Relevant style guidelines are the Go Code Review Comments and the Formatting and style section of Peter Bourgon's Go: Best Practices for Production Environments.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link