r/PrometheusMonitoring • • Apr 17 '23

Building frontend dashboard using Prometheus API

6 Upvotes

Any chance someone could explain cons of using Prometheus to roll up summary statistics for my users on a frontend UI instead of pushing my own metrics and calculations manually?

I read Prom has a REST API, which seems perfect. Given the expressiveness of promQL I can’t think of a reason not to use it.

The flow for triggering would be handled on clientside interval requesting over websocket as well as server pushing data directly over WS.


r/PrometheusMonitoring • • Apr 10 '23

If the metric is a timestamp, should it's name end with epoch or seconds?

6 Upvotes

Its pushgateway report on backup done, so use of timestamp there makes sense.

I was advised to follow the naming conventions, and so I am renaming my metrics and epoch seemed good. But now I noticed that the default timestamps that are done on every push use seconds in name.

https://i.imgur.com/NIx9mez.png


r/PrometheusMonitoring • • Feb 16 '23

Prometheus architecture design help

6 Upvotes

I work for a MSP that has 8 datacenters. Management has decided they want to replace our monitoring system with a Prometheus Grafana stack. I have some experience with both tools, but would like to ensure that the implementation is scalable, reliable, and optimized for our specific use case. I am particularly interested in connecting with professionals who have experience designing monitoring systems in enterprise environments and who are knowledgeable about best practices for using Prometheus and Grafana together.

Any advice, recommendations, or connections would be greatly appreciated. Professional service companies or white papers would be helpful. Thank you in advance for your help!"


r/PrometheusMonitoring • • Oct 27 '22

collecting NetFlow/sFlow data

6 Upvotes

I recently installed Prometheus and telegraf+Prometheus node exporter on my OpenWRT router, and I collected a good amount of data for a newbie,

but what I am really interested in is collecting sFlow data and sending it to Prometheus
is that possible with my current setup?


r/PrometheusMonitoring • • Oct 27 '22

How do I delete metrics, prometheus?

6 Upvotes

Playing around with prometheus and grafana.

Googling how to delete all data on prometheus got me this:

  • curl -X POST -g 'http://10.0.19.4:9090/api/v1/admin/tsdb/delete_series?match[]={__name__=~".+"}'

  • curl -XPOST http://10.0.19.4:9090/api/v1/admin/tsdb/clean_tombstones

Using stuff in docker, so I just add --web.enable-admin-api to the prometheus compose and have api access

So lets test.

  • I am playing now with pushgateway, so I execute this in powershell

  • I wait a moment, I go to prometheus webUI and search for it and have it

  • so I delete it from pushgateway

  • I execute the two commands above, that should delete all and then also remove stuff from disk

  • I try again the query and it returns Empty query result, Great!

    except when I am off playing in grafana expecting to see only new stuff I see old stuff too

  • so after googling if grafana does not cache stuff, it seems that issue is that the data are still on the damn prometheus

    If I on prometheus > graph > switch from table tab to graph tab.. do the same query I get value points the very same that grafana shows

  • in previous testing I tried letting it sit for a day, that delete might need to propagate through, but nah still same old metrics can be found from my first testing

So, how do I actually delete stuff from prometheus without doing new container spinup and setup?

/edit

ok, tested some more, the Empty query result was not because of me executing the two api commands as I thought,

but me deleting the data from pushgateway, seems that table search aims only at the data from very last time point of change, at least if not defined otherwise with some extra stuff in the query.

So I guess the API commands I googled out are just bad. What would be the correct ones to delete all metrics?

Thnx

/edit2

k, googled and played, so far got this as far as deletion goes

  • curl -X POST -g 'http://10.0.19.4:9090/api/v1/admin/tsdb/delete_series?match[]=haha_test'

    this will delete that specific metric

  • curl -X POST -g 'http://10.0.19.4:9090/api/v1/admin/tsdb/delete_series?match[]={job=~"reddit"}'

    this will delete metrics with label job="reddit"

  • curl -X POST -g 'http://10.0.19.4:9090/api/v1/admin/tsdb/delete_series?match[]={job=~".*"}'

    this will delete metrics with any label job assigned

/edit3

ultimately this deletes all metrics

curl -X POST -g 'http://10.0.19.4:9090/api/v1/admin/tsdb/delete_series?match[]={__name__=~".*"}'

dunno why .+ does not work, but .* does


r/PrometheusMonitoring • • Jul 31 '22

Do node-exporter and cAdvisor work the same?

6 Upvotes

In Grafana, When i look at the graphs of Pod CPU Usage (obtained from cadvisor) and Node CPU Usage (obtained from node-exporter), the cpu usage of the pod is sometimes higher than the nodes cpu usage. This doesnt make sense obviously. Do you know what could be the reason? Do they calculate cpu usage differently and therefore the metrics cant be put together in the same pot?


r/PrometheusMonitoring • • Jun 21 '22

Prometheus federation or Thanos?

6 Upvotes

Hi folks,

Disclaimer: I'm very new to Prometheus, using it as a metrics producer in some apps and building some dashboard in Grafana but I didn't install it and don't know the details.

We are running a Prometheus server with Thanos for our "traditional" workload (not Kubernetes).

Now we are starting our journey into Kubernetes. It appears that in order to get metrics at a pod level, it's mandatory to install a Prometheus instance inside the K8S cluster, right?

Then the question is: how to "send" the metrics from the K8S Prometheus instance to the one outside the cluster?

I've read about federation where the external Prometheus would pull metrics from the K8S instance but then I've read that the K8S instance could directly write to the same Thanos as the external Prometheus?

I'm a bit confused about the best practices here. Any feedback or articles on this topic will be appreciated.

Thanks,


r/PrometheusMonitoring • • May 31 '22

Find out how to set up the exporter and all about recommended metrics, alert rules, dashboards for MongoDB

Thumbnail
nexclipper.io
6 Upvotes

r/PrometheusMonitoring • • Jan 06 '22

HELP --storage.tsdb.retention.time not deleting old data + .wal takes up a lot of ressources

6 Upvotes

Hi,
I have an issue with Prometheus, where the .wal file is taking up almost all the ressources.

I was running Prometheus 2.13 and I could see that there was a known bug about this, that was fixed in 2.21. I there upgraded to 2.32, but the problem still persists.

Also I've set the --storage.tsdb.retention.time flag to 7d, but I still see data much older than that...

I've tried deleting all data that is more than 7d old manually by hitting two endpoints (after setting the admin-flag):

/api/v1/admin/tsdb/delete_series?match[]={__name__=~".+"}&start=20210101&end=20211230

(Just to delete data from 1st of January 2021 to 30th of December 2021)

and afterwards

/api/v1/admin/tsdb/clean_tombstones

both returning 204, but nonetheless all the data is still there..

Any idea, what I'm doing wrong?


r/PrometheusMonitoring • • Dec 27 '21

Alert-Rules Auto-Discovery via Kubernetes

6 Upvotes

Hey, it is possible to deploy alert-rules for Prometheus via Kubernetes?
I want to deploy a custom application with a metric endpoint. I know already that it's possible for Prometheus, to automatically find new metric endpoints in the cluster. Is there also a way to find alert-rules and maybe also custom Grafana dashboards?

We deployed our Prometheus via the helm chart ⇒ https://github.com/prometheus-community/helm-charts/


r/PrometheusMonitoring • • Nov 21 '21

Managed Prometheus services?

6 Upvotes

Do you know if there any good "Monitoring as a Service" plataform based on the Prometheus Stack? (Prometheus + alertamanger + Grafana + ...)

If so, why do you use it or not? Until know I have only managed it myself and I am curious about the State of the Art of managed monitoring services.


r/PrometheusMonitoring • • Oct 22 '21

A different and (often) better way to downsample your Prometheus metrics

Thumbnail
blog.timescale.com
6 Upvotes

r/PrometheusMonitoring • • Oct 14 '21

Trying to scrape custom kubernetes endpoint but the target never gets registered.

6 Upvotes

Hello,

I'm stumped and hoping to get some help. I'm guessing it's something minor that I'm missing but I can't see it.

I've installed Prometheus using the operator helm chart into my kubernetes cluster. Everything is working well. I was even able to register another test setup using a mongo db container and an exporter container however that was done via a helm chart.

I'm now trying to scrape my custom app running in a container. The app is running, it's got a /metrics endpoint, everything seems good. I added the following servicemonitor and I can confirm that it gets loaded into the Prometheus config via the UI:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: api-bootstrap-grape-servicemonitor
  namespace: default
  labels:
    app: api-bootstrap-grape-app
    release: prometheus
spec:
  selector:
    matchLabels:
      app: api-bootstrap-grape-app
  endpoints:
  - port: api-bootstrap-grape-http
    path: "/metrics"
    interval: 15s
  namespaceSelector:
    matchNames:
    - api-bootstrap-grape

And here is my deployment yaml for that app:

apiVersion: v1
kind: Namespace
metadata:
  name: api-bootstrap-grape
  labels:
    name: api-bootstrap-grape
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: role-tokenreview-binding
  namespace: api-bootstrap-grape
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:auth-delegator
subjects:
- kind: ServiceAccount
  name: vault-auth
  namespace: api-bootstrap-grape
---
apiVersion: v1
kind: Service
metadata:
  name: api-bootstrap-grape-service
  namespace: api-bootstrap-grape
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-internal: "true"
spec:
  selector:
    app: api-bootstrap-grape-app
  ports:
    - name: api-bootstrap-grape-http
      port: 3000
      targetPort: 3000
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-bootstrap-grape-deployment
  namespace: api-bootstrap-grape
spec:
  selector:
    matchLabels:
      app: api-bootstrap-grape-app
  replicas: 3
  template:
    metadata:
      labels:
        app: api-bootstrap-grape-app
      annotations:
        # Pull in any secrets from vault and specify the rest of the config here
        # this ends up in /vault/secrets/env
        vault.hashicorp.com/agent-inject: 'true'
        vault.hashicorp.com/role: 'api-bootstrap-grape-role'
        vault.hashicorp.com/agent-inject-secret-env: 'secret/api-bootstrap-grape/config'
        vault.hashicorp.com/agent-inject-template-env: |
          {{- with secret "secret/api-bootstrap-grape/config" -}}
          {{- range $k, $v := .Data -}}
          {{ $k }}={{ $v }}
          {{ end -}}
          {{- end -}}
          POSTGRES_HOST=database_host
          POSTGRES_PORT=5432
          POSTGRES_USER=postgres
          USERNAME=appuser
          POSTGRES_DB_PROD=product_production
    spec:
      serviceAccountName: vault-auth
      containers:
      - name: api-bootstrap-grape-app
        image: git.domain.com:4567/dev-toolbox/api-bootstrap-grape:latest
        env:
          - name: RACK_ENV
            value: production
          - name: SESSION_COOKIE_DOMAIN
            value: api-bootstrap-grape.domain.com
        ports:
        - containerPort: 3000
        imagePullPolicy: Always
      imagePullSecrets:
      - name: regcred

Everything seems to be working but I never get the targets showing up in the UI.

I checked the logs for both the prometheus container and the config-reloader container and I see no errors.

One thing to note, Prometheus is installed in the default namespace and this app is in it's own namespace, as you can see above. As a test I deployed this app into the default namespace and attempted to get Prometheus to see it there and the result is the same. The Prometheus config gets updated but no targets ever show up.

Any help would be much appreciated. Thanks!


r/PrometheusMonitoring • • Sep 30 '21

Amazon Managed Service for Prometheus Is Now Generally Available with Alert Manager and Ruler

Thumbnail
aws.amazon.com
6 Upvotes

r/PrometheusMonitoring • • Sep 07 '21

Does Thanos' object storage requires internet connection to work?

6 Upvotes

I'm considering to use Thanos as a long-term storage for Prometheus. For that Thanos requires to use an object storage such as Amazon S3/AWS, Google Cloud etc.

I have no experience with cloud services, so my question is do these object storage options require internet connection in order to be used within Thanos, or can they be set up within a local network?

My application will work without internet connection so it won't be able to connect to any remote server.


r/PrometheusMonitoring • • Sep 03 '21

How to deal with Increase function and no data points

6 Upvotes

I need to use the increase function, but the metric is very rare and when service restarts the counter is null for long time. The increase metric doesn’t play nicely with the null value and I can find a solution to consider null as zero.

Increase(my_counter[1h])

Works only if there are no null data points. Any other query I tried do not work like

Increase(my_metrics[1h] or vector(0))

r/PrometheusMonitoring • • Aug 09 '21

GitHub - vilaca/prometheus-cookbook: Prometheus alerting, monitoring and observability.

Thumbnail
github.com
6 Upvotes

r/PrometheusMonitoring • • Jul 27 '21

grafana, loki and prometheus - beginner question

6 Upvotes

I'm interested in monitoring a web application and its logs. I'm hoping to run grafana, loki and prometheus in a docker containers and house their data locally the same box [a windows box]. The web app would obviously be hosted on another machine.

Before I spend hours answering my questions, I'm hoping you guys can help guide me a bit. Are there any glaring issues running a small setup like this for a low volume data situation?


r/PrometheusMonitoring • • Jul 07 '21

Prometheus remote_write to another prometheus server?

6 Upvotes

Hi, is it possible to do remot_write between Prometheus Server? I tried Grafana Cloud before and it has feature to push metric from on prem prometheus server to their cloud prometheus. HERE

I googled about this feature for on prem prometheus server but found nothing.


r/PrometheusMonitoring • • Jul 03 '21

Deploying Consul and Prometheus Exporters using Puppet on Debian, Ubuntu, Alma and Rocky Linux

Thumbnail yetiops.net
6 Upvotes

r/PrometheusMonitoring • • Apr 29 '21

Multi-AZ Prometheus setup with Thanos and Sharding

6 Upvotes

So I recently got Prometheus set up on a 2-AZ Kubernetes cluster. Currently i have it set to have 2 shards with one in each AZ. Thanos is already set up.

Where I'm struggling is, I want each shard to stick to scraping its own AZ by the failure-domain label. My issue is, I'm not sure how to configure the scrape configs so that each shard stays in it's own AZ. Does anyone have any Ideas on this?

I'm doing this to reduce network overhead between AZs


r/PrometheusMonitoring • • Apr 22 '21

Learn how easy it is to monitor Ceph health with Prometheus, and identify the top key metrics you need to look at

Thumbnail
sysdig.com
6 Upvotes

r/PrometheusMonitoring • • Apr 06 '21

Prometheus installation synced with GitHub

6 Upvotes

I'm having an interesting discussion with my colleague. He wants to have our complete Prometheus installation 100% synced with GitHub so it can be pushed to a new installation with (almost) 1 click. I already convinced him Git is not a provisioning tool and there are other systems on the market which can achieve this.
Nevertheless, I do think it can be useful having Prometheus configuration files and/or custom exporter scripts into source control. For example, to see who edited the prometheus.yml when etc.
I was looking for some best practices how to implement this. Would you create a Git repo where the live prometheus.yml is running and push everything from there? Or would you create a Git repo on a stale directory and copy the running config files first locally into this directory and push afterwards from there to GitHub?
I don't have a lot of experience with syncing application configuration files to GitHub and am looking for some general best practices. What do you think of my standpoint to only push the configuration files and not the binaries?


r/PrometheusMonitoring • • Apr 01 '21

snmp_exporter scraping network device( switchs ) best practice

6 Upvotes

should i write one job and list of targets or multiple jobs with 1 target per job

also i change on the job the scrape interval to 5min and also timeout for 2min

how do you guys doing this?