{"id":19374609,"url":"https://github.com/ditatompel/xmr-metrics","last_synced_at":"2025-08-13T23:08:01.814Z","repository":{"id":142119453,"uuid":"356700876","full_name":"ditatompel/xmr-metrics","owner":"ditatompel","description":"Bash + InfluxDB + Grafana ","archived":false,"fork":false,"pushed_at":"2021-10-23T06:04:42.000Z","size":21,"stargazers_count":12,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T21:55:42.775Z","etag":null,"topics":["grafana","indodax","influxdb","kraken","monero","p2pool","pool-metrics","xmr","xmrig","xmrig-worker-metrics"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ditatompel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-10T21:38:28.000Z","updated_at":"2024-05-31T07:27:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c493fa0a-1a0e-4f7f-a8e8-8ed3fdbc59c2","html_url":"https://github.com/ditatompel/xmr-metrics","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ditatompel/xmr-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditatompel%2Fxmr-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditatompel%2Fxmr-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditatompel%2Fxmr-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditatompel%2Fxmr-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ditatompel","download_url":"https://codeload.github.com/ditatompel/xmr-metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ditatompel%2Fxmr-metrics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270330595,"owners_count":24565816,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-13T02:00:09.904Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grafana","indodax","influxdb","kraken","monero","p2pool","pool-metrics","xmr","xmrig","xmrig-worker-metrics"],"created_at":"2024-11-10T08:35:41.819Z","updated_at":"2025-08-13T23:08:01.797Z","avatar_url":"https://github.com/ditatompel.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# XMR Metrics\nExample setup to collect Monero related metrics using bash + InfluxDB and Grafana.\n\n![screenshoot](https://i.imgur.com/oKAvqg9.png)\nDemo: [https://monitor.ditatompel.com/d/xmr_metrics/monero-metrics?orgId=2](https://monitor.ditatompel.com/d/xmr_metrics/monero-metrics?orgId=2)\n\n## Prepare the system\nIn this article, I use :\nUbuntu 18.04 for Grafana and InfluxDB.\n\n### Install Grafana (OSS Version)\nIf you already have Grafana, you can skip this step. For detailed installation guide on Debian based, please follow [official installation guide](https://grafana.com/docs/grafana/latest/installation/debian/).\n\nAdd stable Grafana OSS repository:\n```bash\nsudo apt-get install -y apt-transport-https\nsudo apt-get install -y software-properties-common wget curl\nwget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -\necho \"deb https://packages.grafana.com/oss/deb stable main\" | sudo tee -a /etc/apt/sources.list.d/grafana.list\n```\nInstall Grafana:\n```bash\nsudo apt-get update\nsudo apt-get install grafana\n```\n\nStart Grafana service and make sure service is running (systemd):\n```bash\nsudo systemctl daemon-reload\nsudo systemctl start grafana-server\nsudo systemctl status grafana-server\n```\n\nTo make Grafana server to start at boot:\n```bash\nsudo systemctl enable grafana-server.service\n```\n\n### Install InfluxDB\nAdd the InfluxData repository:\n```bash\necho \"deb https://repos.influxdata.com/ubuntu bionic stable\" | sudo tee /etc/apt/sources.list.d/influxdb.list\nsudo curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -\n```\nInstall InfluxDB:\n```bash\nsudo apt-get update\nsudo apt-get install influxdb\n```\n\nStart InfluxDB service and make sure service is running (systemd):\n```bash\nsudo systemctl daemon-reload\nsudo systemctl start influxdb\nsudo systemctl status influxdb\n```\nTo make InfluxDB server to start at boot:\n```bash\nsudo systemctl enable influxdb.service\n```\n#### Configure InfluxDB\nLaunch InfluxDB’s command line interface (`influx`)\n```\ninflux -precision rfc3339\n```\nOnce you’ve entered the shell and successfully connected to InfluxDB, create at least one InfluxDB admin user:\n```\nCREATE USER \u003cYOUR_INFLUXDB_ADMIN_USER\u003e WITH PASSWORD '\u003cYOUR_INFLUXDB_ADMIN_PASSWORD\u003e' WITH ALL PRIVILEGES\n```\n\u003e Change `\u003cYOUR_INFLUXDB_ADMIN_USER\u003e` and `\u003cYOUR_INFLUXDB_ADMIN_PASSWORD\u003e` with your desired username and password\n\nCreate database to store Monero Metrics:\n```\nCREATE DATABASE MoneroMetrics\n```\nCreate non-admin user (for Grafana and bash script we use latter) and grant privileges to `MoneroMetrics` database:\n```\nCREATE USER grafana WITH PASSWORD 'some_password'\nGRANT READ ON MoneroMetrics TO grafana\n\nCREATE USER monero WITH PASSWORD 'some_password'\nGRANT ALL ON MoneroMetrics TO monero\n```\n\nEnable authentication in your configuration file (`/etc/influxdb/influxdb.conf`) by setting the `auth-enabled` option to `true` in the `[http]` section:\n\n\u003e **Note**: You might also need to disable queue limit and timeout by setting the `max-enqueued-write-limit` and `enqueued-write-timeout` to `0` in the `[http]` section.\n\nRestart InfluxDB service\n```bash\nsystemctl restart influxdb\n```\n\n## Collect and storing metrics\nIn this article, there are 5 types of metric we will collect and store it to InfluxDB:\n* Node metrics via `monerod` RPC ([NodeMetrics.sh](examples/bash/NodeMetrics.sh))\n* XMRig worker metrics ([XmrigMetrics.sh](examples/bash/XmrigMetrics.sh))\n* Pool metrics ([PoolMetrics.sh](examples/bash/PoolMetrics.sh))\n* Exchange metrics ([IndodaxExchange.sh](examples/bash/IndodaxExchange.sh) \u0026 [KrakenExchange.sh](examples/bash/KrakenExchange.sh))\n* `monero-project/monero` GitHub metrics ([GitHubMetrics.sh](examples/bash/GitHubMetrics.sh))\n* `r/Monero` Reddit metrics ([RedditMetrics.sh](examples/bash/RedditMetrics.sh))\n\nYou can find all example files under [examples](examples) directory.\n\nAll script written in bash, `jq` and `curl` package is required to run all of these script. In additional, and `bc` package is required to run `PoolMetrics.sh`.\n\nMake sure all bash script is executable and run them using cron job.\n\n### Node metrics\nFile: [examples/bash/NodeMetrics.sh](examples/bash/NodeMetrics.sh)\n\nIf you run local or public Monero node, you can scrap `monerod` metrics using its `rpc` or `restricted-rpc`.\nRestrict RPC is view only commands and do not return privacy sensitive data in RPC calls. So, some data like `*_connections_count`, `*_peerlist_size` will return `0`.\n\n\n### XMRig worker metrics  \nFile: [examples/bash/XmrigMetrics.sh](examples/bash/XmrigMetrics.sh)\n\nIn order to grab XMRig worker metrics, we need to enable XMRig HTTP API for each your XMRig devices. Eg:\n```\n{\n    \"api\": {\n        \"id\": null,\n        \"worker-id\": null\n    },\n    \"http\": {\n        \"enabled\": true,\n        \"host\": \"i.i.i.i\",\n        \"port\": 54321,\n        \"access-token\": \"your password\",\n        \"restricted\": true\n    },\n    ...\n```\n\n\n### Pool metrics  \nFile: [examples/bash/PoolMetrics.sh](examples/bash/PoolMetrics.sh)\n\nFor now, only mining pool who use [jtgrassie/monero-pool](https://github.com/jtgrassie/monero-pool), [Snipa22/nodejs-pool](https://github.com/Snipa22/nodejs-pool) and [SChernykh/p2pool](https://github.com/SChernykh/p2pool) backend is supported. Feel free to edit the script and add your favorite mining pool backend.\n\nit's quite easy to find pool backend and usually each frontend design quite similar. For example: monerop.com, xmrvsbeast.com using jtgrassie and moneroocean.stream, moneromine.co using snipa22.\n\n**Important About Pool Metrics**:   \n\nYou may doesn't need to grab *Network Difficulty* and *Network Height* data from your mining pool server, especially those who use nodejs-pool by Snipa22. This because we need to fetch  one additional API request to the server and may cause DOS effect on high traffic pool.\n\nAvoid doing that by comment out `NetworkInfo=$(curl -s ${POOLPARAMS[1]}/network/stats ...` and remove `NetDiff=$NetworkDiff` and `NetHeight=$NetworkHeight` InfluxDB data post. Eg:\n```bash\ncurl -i -XPOST 'http://192.168.100.1:8086/write?db=MoneroMetrics' -u monero:some_password --data-binary \"PoolInfo,Node=${POOLPARAMS[0]} PoolHR=$PoolHR,RoundHR=$RoundHashes,LastBlock=$LastBlockFound,BlockFound=$PoolBlockFound,CountMiners=$ConnectedMiners,MyHashrate=$MinerHashrate,MyBalance=$MinerBalance\"\n```\n\n### Coin Exchange metrics\nFiles: [examples/bash/IndodaxExchange.sh](examples/bash/IndodaxExchange.sh) and [examples/bash/KrakenExchange.sh](examples/bash/KrakenExchange.sh)\n\nIf you like to add coin price, market, etc, you can use your favorite exchange API. In this example, I use Indodax API as my local currency exchange. You may create your own script to do that. Some exchange like [Kraken provide an example API client](https://www.kraken.com/features/api#example-api-code), but if you like to use simple bash script, you can take a look into [examples/bash/KrakenExchange.sh](examples/bash/KrakenExchange.sh).  \n\n\n## Create the dashboard\nAfter all data is collected, lets create the Grafana dashboard. We need to add our InfluxDB data source first.\nLogin to Grafana \u003e `Configuration` \u003e `Data Sources` \u003e `Add Data Source` and choose `InfluxDB`.\nLeave Query Language to default (`InfluxQL`)\n\nIn the `HTTP` section, fill `URL` to your InfluxDB server.\n\nIn `InfluxDB` Details section, fill your database access details:\n\nDatabase: `MoneroMetrics`   \nUser: `grafana`   \nPassword: `your_configured_password`   \n\n![InfluxDB example setting](https://i.imgur.com/NsyVyTM.png)\n\nSave and Test.\n\nNow you can create your Monero dashboard. You may export my dashboard template from the [demo site](https://monitor.ditatompel.com/d/xmr_metrics/monero-metrics?orgId=2) by clicking share icon.\n\n![grafana share button](https://i.imgur.com/b706cBe.png)\n\n\u003e **Note**: In order to use my dashboard, you may need to install [Blendstat panel plugin](https://grafana.com/grafana/plugins/farski-blendstat-panel/).\n\n## Resources and Credits\n* [Grafana Installation](https://grafana.com/docs/grafana/latest/installation/) (Grafana Docs)\n* [Install InfluxDB on Ubuntu 20.04/18.04 and Debian 9](https://computingforgeeks.com/install-influxdb-on-ubuntu-and-debian/) by\n[Josphat Mutai](https://computingforgeeks.com/author/mutai-josphat/)\n* [Authentication and authorization in InfluxDB](https://docs.influxdata.com/influxdb/v1.8/administration/authentication_and_authorization/) (InfluxDB Docs)\n* [Using InfluxDB in Grafana](https://grafana.com/docs/grafana/latest/datasources/influxdb/) (Grafana Docs)\n* [Create Fancy Graph with metrics from XMRIG (1/3)](https://ecency.com/monero/@master-lamps/create-fancy-graph-with-metrics-from-xmrig-1-3) by [master-lamps](https://ecency.com/@master-lamps)\n* [Create Fancy Graph with metrics from XMRIG (2/3)](https://ecency.com/monero/@master-lamps/create-fancy-graph-with-metrics-from-xmrig-2-3) by [master-lamps](https://ecency.com/@master-lamps)\n* [Create Fancy Graph with metrics from XMRIG (3/3)](https://ecency.com/monero/@master-lamps/create-fancy-graph-with-metrics-from-xmrig-3-3) by [master-lamps](https://ecency.com/@master-lamps)\n\nIf you want to create data scraping using your desired programming language, feel free to create a pull request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditatompel%2Fxmr-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fditatompel%2Fxmr-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fditatompel%2Fxmr-metrics/lists"}