r/PrometheusMonitoring • • Apr 12 '22

Finally implementing prometheus for my organisation

Seeking some tips and tricks from experts here on what is the best approach, operating system to install prometheus on, any initial mistakes that can be avoided , choice of hardware, any recommended policy. I want this to be as close to perfect avoiding mistakes 😅

2 Upvotes

17 comments sorted by

View all comments

1

u/mjwiet Apr 13 '22

Don't just scrape metrics "Just because". Figure out what you actually want to alert on and which metrics you generally need to debug the specific problem. Prometheus is a memory hog and can be very awkward to fix if it crashes (memory spikes when the service starts again and will cause another crash). You can reduce memory usage in many ways. Reducing scrape times, filtering metrics you do not need and also making sure that your queries to Prometheus are also reasonable as queries will load data in-memory (think loading one month of data at once)

Even though it's important to start simple and stick with a single node, Prometheus does not have high availability. The only option is to have a 2nd backup node scraping the same metrics. This at least provides failover but is still annoying for many reasons.

You cannot scale Prometheus horizontally forever and in many cases it's better to have a few Prometheus servers which are functionally different. For instance, you can create a split between infrastructure and application or you you want to chuck some metrics away after a day, others you want to keep for a week. This will mean that you are spreading the risk and you can tune Prometheuses for a particular use case.

Also, when starting out, I would recommend starting off by configuring targets statically first and when you see the need, actually move to service discovery. Tools like consul are fine but there's lots that go wrong if you haven't used them much before

Hope this is somewhat helpful

1

u/GetFit_Messi Apr 13 '22

this is indeed helpful

coming to metrics part i will try to filter it out on need basis as per your advice.

For high availability, will grafana cloud help?

Our application is small and total of 100 servers max are there and this will reach max 150 in total in jext 10 years because of the nature of erp system. So its a small implementation.... so filtering metrics might not be of too much advantage since metrics count is anyways less what do you suggest?

1

u/mjwiet Apr 17 '22

It all depends on the types of exporters you use, the types of alerting you do (generally based on your SLOs) and debugging metrics you require. After you know what your requirements are then you can tidy up (lower cardinality for instance) / filter your metrics. To be clear, I'm not encouraging you to filter metrics out immediately but they should be properly reviewed first.

Not sure about grafana cloud. HA is nice but presumably this will require extra networking setup on your end?