3.10 Feeding Graphite(Native Install) - MartinWong06/grafana GitHub Wiki
Graphite is very flexible when it comes to the origin of data. There are three main methods for sending data to Graphite: Plaintext, Pickle, and AMQP.
- Edit storage-schemas file
sudo nano /etc/carbon/storage-schemas.conf
- Insert the following test block in the file
[test]
pattern = ^test\.
retentions = 10s:10m,1m:1h,10m:1d
Test block has been created in the storage-schemas file. It will used to receive data from terminal
Restart Graphite container
sudo docker restart graphite
Type the following command in a terminal. You can replace the value value with some different numbers to see what it does:
for i in 4 6 8 16 69 42 21 0 98 75 64 41 35 3 2; do echo "test.count $i `date +%s`" | nc -q0 127.0.0.1 2003; sleep 15; done
Explaination of the nc code
nc stands for "netcat" and it is a command-line tool used for reading from and writing to network connections using TCP or UDP protocols. The -q0 option tells nc to exit immediately after sending any data to the server, without waiting for a response. In the context of nc -q0 127.0.0.1 2003, this command is used to send data to a Graphite server running on the same machine ("localhost") over port 2003. The data is sent in plaintext format and should be in the format of .
Metric messages need to contain a metric name, a value, and a timestamp.
Go back to the Graphite Web Interface and reload it. The new storage scheme test will appear in the menu. Set the time range to a few minutes, by clicking on the clock-icon:
The values that you have sent will appear in the graph