jvstein / bitcoin-prometheus-exporter

Prometheus exporter for Bitcoin Core nodes
BSD 3-Clause "New" or "Revised" License
71 stars 37 forks source link

no bitcoin metrics #27

Closed haumanto closed 6 months ago

haumanto commented 2 years ago

Hi,

I tried to run this but no bitcoin metrics are generated… almost all of them are 0…

Please help…

jvstein commented 2 years ago

Hi @haumanto,

It sounds like the connection to the bitcoin node is not working.

  1. How are you running the exporter (e.g. via docker, directly with python)?
  2. What is the full output of the exporter when you set LOG_LEVEL=DEBUG as an environment variable, and then visit the metrics endpoint (e.g. http://localhost:9332/metrics)?
xr09 commented 1 year ago

I'm experiencing this same issue, running on a VM with the requirements installed globally on Python 3.6.

The debug log output:

2023-02-09T10:27:17Z DEBUG RPC call: uptime
2023-02-09T10:27:17Z DEBUG Result:   12966863
2023-02-09T10:27:17Z DEBUG RPC call: getmemoryinfo stats
2023-02-09T10:27:17Z DEBUG Bitcoin RPC error refresh
Traceback (most recent call last):
  File "/opt/bitcoin_exporter/bitcoind-monitor.py", line 381, in refresh_app
    refresh_metrics()
  File "/opt/bitcoin_exporter/bitcoind-monitor.py", line 268, in refresh_metrics
    meminfo = bitcoinrpc("getmemoryinfo", "stats")["locked"]
  File "/usr/local/lib/python3.6/site-packages/riprova/retry.py", line 129, in wrapper
    return retrier.run(fn, *args, **_kw)
  File "/usr/local/lib/python3.6/site-packages/riprova/retrier.py", line 291, in run
    self._handle_error(err)
  File "/usr/local/lib/python3.6/site-packages/riprova/retrier.py", line 232, in _handle_error
    raise err
  File "/usr/local/lib/python3.6/site-packages/riprova/retrier.py", line 288, in run
    return self._call(fn, *args, **kw)
  File "/usr/local/lib/python3.6/site-packages/riprova/retrier.py", line 162, in _call
    res = fn(*args, **kw)
  File "/opt/bitcoin_exporter/bitcoind-monitor.py", line 199, in bitcoinrpc
    result = rpc_client().call(*args)
  File "/usr/local/lib/python3.6/site-packages/bitcoin/rpc.py", line 374, in call
    return self._call(service_name, *args)
  File "/usr/local/lib/python3.6/site-packages/bitcoin/rpc.py", line 252, in _call
    'message': err.get('message', 'error message not specified')})
bitcoin.rpc.JSONRPCError: {'code': -1, 'message': 'getmemoryinfo\nReturns an object containing information about memory usage.\n\nResult:\n{\n  "locked": {               (json object) Information about locked memory manager\n    "used": xxxxx,          (numeric) Number of bytes used\n    "free": xxxxx,          (numeric) Number of bytes available in current arenas\n    "total": xxxxxxx,       (numeric) Total number of bytes managed\n    "locked": xxxxxx,       (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.\n    "chunks_used": xxxxx,   (numeric) Number allocated chunks\n    "chunks_free": xxxxx,   (numeric) Number unused chunks\n  }\n}\n\nExamples:\n> bitcoin-cli getmemoryinfo \n> curl --user myusername --data-binary \'{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }\' -H \'content-type: text/plain;\' http://127.0.0.1:8332/\n'}
2023-02-09T10:27:17Z INFO Refresh took 0:00:00.004935 seconds
jvstein commented 1 year ago

@xr09 - What node software and version are you running?

The error message is giving the documentation text back for the getmemoryinfo RPC. I would guess the node software doesn't support the stats argument.

xr09 commented 1 year ago

Indeed, I was pointing to the wrong node, will try again with the right settings.

Thanks @jvstein!