I built a tool for instance admins to export metrics from their Lemmy database into InfluxDB

russjr08@outpost.zeuslink.net to Lemmy@lemmy.ml – 24 points –
GitHub - russjr08/lemmy-stats-exporter: A utility for exporting administrative/moderation statistics from your Lemmy's PostgreSQL database to InfluxDB
github.com

Hello folks!

My apologies if this is not the appropriate place for this, I'll take it down if so. I spent the better part of the last 11 hours getting this project put together.

The README in the repository goes over just about everything regarding what this tool is about (and how to get it up and running), but the quick elevator pitch is that I wanted a way to monitor the stats of my instance because of the bot spam issues that have been going around in a lot of places. As of now, Lemmy keeps track of a lot of data that could be useful to at least be cognizant of what is going on, but doesn't actually expose it on the UI side.

Originally my idea was to just read the database info straight into Grafana, but of course due to my very little experience with Grafana I didn't realize that this wasn't going to quite work out the way I wanted, as the data in Lemmy's table isn't super well suited for what Grafana expects in terms of time-series data. Which then lead me to wanting to connect it with InfluxDB - another thing that I "knew of" but didn't have any experience with.

The end result was building a tool that could export/stream data from Lemmy's PostgreSQL database over to Influx, allowing me to then make some really nice visuals in Grafana! There are a couple of screenshots at the bottom of the README (I don't know how to scale images when inlining them into posts here and don't want a massive image in the post), along with a link to a snapshot/demo version of the dashboard.

Maybe it'll help some other instance admins, or maybe everyone will think its terrible (I do mention that I'm quite new at Rust), but either way its been frustrating, yet fun, and a good learning experience thus far!

1