This is a way to setup a Grafana + Graphite in your local machine or VPS like the one from Hetzner.
- Copy
docker-compose.ymlto your desired folder - Open
docker-compose.ymland modifyGF_SECURITY_ADMIN_USERandGF_SECURITY_ADMIN_PASSWORDto your desired values. These are your grafana login credentials. - Run
docker compose -p my-grafana-project up -d - IMPORTANT: run
docker compose -p my-grafana-project downto turn it off immediately - Open
./graphite_data/graphite_conf/storage-aggregation.confwith your favorite text editor and change allxFilesFactorvalues to0 - Save file and quit the text editor
- Run
docker compose -p my-grafana-project up -d
Open the browser and visit http://localhost:3001. Login with the username and password from docker-compose.yml file.
When grafana website is loaded, go to Menu -> Connections -> Add new connection -> Search for "graphite" -> Click on it -> Click on "Add new data source" -> HTTP -> URL -> Enter host.docker.internal:2002 -> Scroll to the bottom -> Click "Save & test"
Don't forget to put new grafana and graphite folders to .gitignore:
grafana_data
graphite_data
And that's it!
For instructions check out this video I made: https://drive.google.com/file/d/1YbTEHO40mP2Nmi2cA8Zkk8Vbnk9kLWlu/view?usp=sharing
Ruby:
def measure(path, value, statsd_type)
sock = UDPSocket.new
message = "#{path}:#{value}|#{statsd_type}"
sock.send(message, 0, "localhost", 8125)
sock.close
end
measure("worker.my_worker.execution_time", 123, 'ms')
Same as on your local machine, just use your Hetzner server's IP address instead of localhost.