I'm looking into installing a timeseries database like InfluxDB or Prometheus to handle data for our Grafana monitoring system.

One of the things I like to do is run a couple of MySQL queries every few minutes to gather business metrics (like number of subscribers or application usage metrics).

Documentation for these timeseries databases feature plenty of examples of how to get MySQL performance metrics into their stores but I can't find any that demonstrates how to store data from queries.

Google search results seem to be completely drowned out by the more typical use case of gathering MySQL performance metrics.

Is this at all possible with either InfluxDB or Prometheus and where can I find information on how to set this up?

  • 1
    I am not familiar with InfluxDB, but with prometheus, the model is normally setup "exporter" scripts like a web service- For example, this one is to monitor mysql status (not the data it contains, as you want), but it may help to understand the query + pull model: github.com/prometheus/mysqld_exporter
    – jynus
    Nov 29 '18 at 10:31
  • @Martijn - DMARC Analyzer ... I use Grafana with MySQL datasources and have examples too I can share. You don't need to convert the MySQL to TSDB to get it to work for monitoring in Grafana so ping me back with the @TagName of mine when you see this if you still need something and the provided answers aren't sufficient. You can run MySQL queries right in Grafana and show those as objects or metrics, etc. I have tons of stuff I've done but yes you are right, there aren't my MySQL examples out there still. Jul 17 '20 at 0:02

You can write a simple script, which would periodically execute SQL query and push its results to a TSDB via one of the supported data ingestion protocols. Various TSDBs support various data ingestion protocols: Influx line protocol, Graphite plaintext protocol, OpenTSDB telnet put protocol, JSON, CSV, etc. For example, all these protocols are supported by VictoriaMetrics - see these docs for details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.