Plotti.co: the simplest micro service to monitor schedules in real-time

hi gebrauchen!

In this article we will talk about Plotti.co — hell easy-to-use tool that does exactly one thing but does it quickly and well. We will talk about the online drawing charts and update them in real time.

The creation of living graphs on the fly, I think, is not the task for which you want to read first 10 pages of documentation, to pay for the subscription at $20 per month, and sometimes both at once. So it is impossible. Not in 2016.

image

In Plotti.co the client portion is a SVG image, which is signed on the EventSource to the data source from the server, and updates the schedule in accordance with them. It integrates in the page is simple:

the
<object data="http://plotti.co/U0N5G5FQigwC/plot.svg" type="image/svg+xml"></object>


Yeah, that's all. Here U0N5G5FQigwC is a hash of the picture. Below the picture is updated in all browsers in which it is now opened, you just need to send a GET request at the relevant address. For example,

the
wget "http://plotti.co/U0N5G5FQigwC?d=1.5,3.6,7.8 mbps" -O /dev/null



The values of the variables passed in the d parameter, separated by commas. The maximum number of variables (and therefore the lines on the chart) — 9; colour each of them is fixed. If you want to get a line of any specific color, you can skip the desired number of variables before it (for example, like this: http://plotti.co/U0N5G5FQigwC?d=,,,,,,1.0).

The project is made according to the principle "eat your dogfood", so right on the title you can see a graph of the current CPU usage of the server on which it revolves. The data fed to the graph using a simple shell script:

the
#!/bin/sh
while true; do
wget -O /dev/null -q http://plotti.co/lock/plottycocpu?d=`mpstat -P ALL 1 1 | awk '/Average:/ && $2 ~ /[0-9]/ {print $3}' | sort-r-g | xargs | sed s/\ /,/g`\%cpuload
done


P. S. the Project was written in two days by one person and run on ARM server from Scaleway for $3 a month, and almost survived the invasion of the users with Hacker News the night before last (up to 4 thousand concurrent connections). Gevent FTW! Further studies showed that the use of Xeon instance at Vultr for $5 a month more than justified.
P. P. S. the Project openany, welcome bug reports and pull requests!
P. P. P. S. a Moped is not mine, but a good man; I'm basically just holding a candle.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

ODBC Firebird, Postgresql, executing queries in Powershell

garage48 for the first time in Kiev!

The Ministry of communications wants to ban phones without GLONASS