2

Q: I currently have MQTT client that dumps data in a csv file, is it possible to convert this data into a graph with BASH or Python [automatically]? Can such a thing be done? Or would this be an Excel thing?

Data in file looks:

timestamp,2313,4242,53453
timestamp,142342,234242,2343
timestamp,123132,132123,132
...
Anthon
  • 79,293
3kstc
  • 4,706

2 Answers2

3

There are a number of command-driven plot tools that you could use for such a task - see for example the answers to this recent very similar question How can I make a graphical plot of a sequence of numbers from the standard input?

For example, using gnuplot

gnuplot -p -e 'set datafile separator ","; plot for [col=2:5] "file.csv" using 1:col with lines'
steeldriver
  • 81,074
2

You don't indicate precisely what your data is, so I'll offer a suggestion that may not be entirely suitable for your need.

I really like RRDTool, which is utility build around monitoring system metrics and graphing them. Your data looks like it's timestamp series, which might mean RRDtool is appropriate.

One of the major things RRDtool does is applying sampling and archiving. It'll 'roll up' data points to make a MIN/MAX/AVERAGE for a sampling interval, and allow you to scale your sampling intervals - so you might keep 5m resolution for a week, 1hr resolution for a month, and daily resolution for a couple of years.

The only reason I mention it is I notice your data includes timestamps, and one of the things that RRDtool does very nicely is sampled updates and near-ish realtime graph redrawing.

E.g.:

RRDTool output

Sobrique
  • 4,424