Install/InfluxDB: Difference between revisions
Jump to navigation
Jump to search
(Created page with "category:Rpicategory:links == Links == == influxdb ==") |
|||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[category:Rpi]][[category:links]] | [[category:Rpi]][[category:links]] | ||
== Links == | == Links == | ||
:[http://gridengine.eu/index.php/other-stories/230-installing-grafana-on-raspberry-pi-2-2015-10-24 view influx using grafana on RPi] | |||
:[http://www.philipotoole.com/tag/influxdb/ Howto article] | |||
== influxdb == | == influxdb == | ||
=== Write available disk space every 5 min === | |||
Crontab lets you edit the task scheduler. Run crontab as super user to edit the task scheduler of root. That way the running task will never be under privileged. | |||
sudo crontab -e | |||
Add this line to the end: | |||
*/5 * * * * M=`df|grep /dev/root|awk '{print $4}'`&&curl -i -XPOST 'http://localhost:8086/write?db=rocket' --data-binary "cpu,host=rpi2 mem_available=$M" | |||
* M=`...` : executes the back-quoted command and assigns the output to variable M | |||
* df : dumps some disk info, which gets piped into grep | |||
* grep /dev/root : finds the line containing '/dev/root' which gets piped into awk | |||
* awk '{print $4}' : parses the line and outputs the 4th (space separated?) string which is the number we are looking for | |||
* &&curl : runs curl if the previous command (assignment to M) succeeded | |||
* curl -i -XPOST : writes data via POST request | |||
:* 'http://localhost:8086/write?db=rocket' - target server is an influxdb server at 'localhost:8086', the target database is named 'rocket' | |||
:* --data-binary "cpu,host=rpi2 mem_available=$M" : the measurement is called 'cpu', the value is called 'mem_available' and is tagged with the optional key and value host=rpi2 | |||
Latest revision as of 03:55, 8 June 2016
Links
influxdb
Write available disk space every 5 min
Crontab lets you edit the task scheduler. Run crontab as super user to edit the task scheduler of root. That way the running task will never be under privileged.
sudo crontab -e
Add this line to the end:
*/5 * * * * M=`df|grep /dev/root|awk '{print $4}'`&&curl -i -XPOST 'http://localhost:8086/write?db=rocket' --data-binary "cpu,host=rpi2 mem_available=$M"
- M=`...` : executes the back-quoted command and assigns the output to variable M
- df : dumps some disk info, which gets piped into grep
- grep /dev/root : finds the line containing '/dev/root' which gets piped into awk
- awk '{print $4}' : parses the line and outputs the 4th (space separated?) string which is the number we are looking for
- &&curl : runs curl if the previous command (assignment to M) succeeded
- curl -i -XPOST : writes data via POST request
- 'http://localhost:8086/write?db=rocket' - target server is an influxdb server at 'localhost:8086', the target database is named 'rocket'
- --data-binary "cpu,host=rpi2 mem_available=$M" : the measurement is called 'cpu', the value is called 'mem_available' and is tagged with the optional key and value host=rpi2