Geth monitor plots metrics exposed by Geth on a terminal but I want to dump Geth metrics (all or some of them) in a file for further programmatical processing.

For example, instead of getting an aggregated output as shown below, I need an timeseries output for each metric.

> debug.metrics(true).eth.db.chaindata.user.reads
  AvgRate01Min: 58352658.845165044,
  AvgRate05Min: 42789394.99537952,
  AvgRate15Min: 22764439.80511231,
  MeanRate: 2213178.435842236,
  Overall: 28113856922

go-ethereum wiki on github mentions raw metrics value can be retrieved using an optional flag, but the page doesn't mention which flag and how.


This is the response I got from bas-vk on github

You can use the RPC interface with the debug module enabled. The IPC interface has the debug module enabled by default. Retrieving this data from the command line can be done using netcat and jq can be using for filtering.

echo '{"id": 0, "jsonrprc": "2.0", "method": "debug_metrics", "params": [true]}' | nc -U ~/.ethereum/geth.ipc  | jq -S .result.eth.db.chaindata.user.reads

The http and ws interface don't have the debug module enabled by default. But you can enable them with the rpcapi and wsapi flags. Be careful that exposing the debug module of an RPC interface that can be accessed by non-trusted parties have security implications.

  • Are these metrics the block times and read and writes out of blockchain or they infer something else ?
    – NaN
    Oct 16 '17 at 13:41
  • Most of them are internal metrics. They do not provide details about block times or read/writes out of blockchain. You can get more details about them here Oct 26 '17 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.