shua / graf Goto Github PK
View Code? Open in Web Editor NEWprint grafana data in your terminal
License: MIT License
print grafana data in your terminal
License: MIT License
grafana allows you to define dashboard variables and then use them in queries like $foo
. When we pull down the dashboard though, it tries to query with $foo
instead of the value and gets no data.
There isn't really any good info on how to query a streaming data source in the grafana docs and I haven't managed to get the grafana "View Query" web ui to actually show me what requests are sent for streaming data.
I've noticed influxdb returns no data for small timespans (eg now-2s
to now
). This is unhelpful when we have --interval 1 -f
because it's only requesting a small enough window of data to plot the next line, but influxdb will never return anything.
One possible way to improve this is to fetch a larger span of time with each refresh. This is what grafana web ui does, and it replots everything with every refresh (I guess unless it's a streaming data source, see #4). However, I don't want to fill up the terminal history with copies of the same plotted data, so if graf
replots, it should move the cursor up to the line that corresponds with whatever the first time value is in the current data.
Let's say we've already plotted from 07:20-07:23 using 30 lines in the terminal. This would put the line corresponding to 07:21 at line 10 from the start, while the cursor is at line 30. If we wait 1 minute, and fetch data for 07:21-07:24, then in order to plot that data we should move the cursor up 20 lines (30 - 20 = 10). So we need to send \e[20A
to the terminal and then plot the data.
Not clear yet what happens when we try to move up 20 lines but the screen only has eg 10 rows.
One alternative is to ditch the line-by-line updates and instead limit the plotting to only be as big as the current terminal size, and clear the screen with each refresh. I kind of like the scrolling plot though, so I want to keep it for now, but maybe there can be another mode that jumps into terminal alt-screen to plot without filling up the terminal scroll history.
If you try to query from: now-2s
to: now
in grafana, it will just print no data
, and it's expected that the user figures out their error and requests a larger timespan. Similarly, we could just expect the user to set --interval
to a high enough value that influxdb returns data.
trying to compile results in an error that libc::strftime
is not defined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.