A Guide to Monitor Linux Server using Prometheus and Grafana

running a lemmy instance has learned me a lot about devops already!

I love playing around with this, the lemmy instance was a great reason. lemmyfly.org doesn't have a lot of traffic yet, I think it can handle some more. Currently running on 2 vcpu/4gb ram.

After chatting to my devops colleague at work I wanted to set up a Grafana dashboard with metrics on the server. Seems it's pretty pretty doable!

  • I installed prometheus node_exporter on my lemmy server
  • I created a second server at my VPS. Very cheap, and don't think I'll be running the Prometheus/Grafana 24/7 so I'll just create a snapshot of it, destroy the server and re-create when wanted
  • Created an internal private network so the instances can communicate without exposing ports to the public
  • Installed Prometheus on the new prometheus server
  • Installed Grafana
  • log in to Grafana, admin:admin then change password
  • Go to the Grafana home dashboard, click on + sign and click on Import. In Import via grafana.com, put the dashboard id 1860 (preset for all prometheus node_exporter metrics) and click on Load.
  • Done!

Last 2 hours in the garden with a beer on the side, WFH FTW

https://lemmyfly.org/pictrs/image/5cb1ff42-c452-4a39-b49c-e5beca49cade.png

Wesleysnoops,

Very cool! What’s bandwidth and system consumption been like so far?

mayniac,

This would be nice to run on my home server to monitor my Lemmy instance in the cloud. It would also be nice to be able to check some Lemmy stats as well as general server stats. I'm not a grafana or Prometheus expert though.

Jardincorenda,

Very timely thank you! I was in research mode today and was planning on getting Prometheus and Grafana setup on my home server to monitor my VMs and docker images.

kunic,
kunic avatar

I've been using Cockpit to monitor my server, but this is super clean. Will have to try it out!

JasonWeen,

Uuuh I absolutely love grafana. Worked half a year with it for my job. I am happy it worked out great for you.

Wander,
@Wander@yiffit.net avatar

Oh wow, I need to check this out. I might do this with LXC containers

majorswitcher,

Let us know your findings when you did!

tkohhh,

Influxdb + grafana for me! Good stuff!

manned_meatball,
@manned_meatball@lemmy.ml avatar

lol I literally did this yesterday for my job, using dashboard 1860 too. I used a docker compose stack following their guide here.

majorswitcher,

i'm now looking into logging more specific http request data. Maybe https://github.com/martin-helmich/prometheus-nginxlog-exporter?

manned_meatball,
@manned_meatball@lemmy.ml avatar

I'm not looking into logging http traffic, but that seems like a popular option

majorswitcher,
  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • cubers
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • osvaldo12
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • everett
  • Durango
  • cisconetworking
  • khanakhh
  • ethstaker
  • tester
  • anitta
  • Leos
  • normalnudes
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines