{"id":22951568,"url":"https://github.com/lifailon/docker-stats-to-influxdb","last_synced_at":"2025-08-12T02:37:32.763Z","repository":{"id":196215283,"uuid":"695012628","full_name":"Lifailon/docker-stats-to-influxdb","owner":"Lifailon","description":"Monitoring Docker containers with data sent to Influx database and visualized in Grafana","archived":false,"fork":false,"pushed_at":"2023-10-20T16:16:20.000Z","size":3777,"stargazers_count":1,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"rsa","last_synced_at":"2025-04-15T07:19:05.854Z","etag":null,"topics":["bash","bash-script","container-monitoring","devops","docker","docker-monitoring","grafana","grafana-dashboard","influxdb","linux","monitoring","shell","shell-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lifailon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-22T07:01:20.000Z","updated_at":"2025-03-06T08:19:05.000Z","dependencies_parsed_at":"2023-10-20T17:42:39.487Z","dependency_job_id":null,"html_url":"https://github.com/Lifailon/docker-stats-to-influxdb","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"4391c3553d5b5c31af24adb092abca3bdd270444"},"previous_names":["lifailon/docker-stats-to-influxdb"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fdocker-stats-to-influxdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fdocker-stats-to-influxdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fdocker-stats-to-influxdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lifailon%2Fdocker-stats-to-influxdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lifailon","download_url":"https://codeload.github.com/Lifailon/docker-stats-to-influxdb/tar.gz/refs/heads/rsa","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249188368,"owners_count":21227013,"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","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":["bash","bash-script","container-monitoring","devops","docker","docker-monitoring","grafana","grafana-dashboard","influxdb","linux","monitoring","shell","shell-script"],"created_at":"2024-12-14T15:16:50.262Z","updated_at":"2025-04-16T02:59:13.965Z","avatar_url":"https://github.com/Lifailon.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## docker-stats-to-influxdb\n\nScript for monitoring Docker containers (using **docker stats** and **docker ps**) with data sent to Influx database and visualized in Grafana. Added convert GB/GiB (from rounding) and kB/KiB to MB (**all output to MByte**).\n\n### 🚀 Install\n\nFor creat service (unit systemd) and download script from github repository can be used [deploy](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/deploy.sh) script.\n\nRun at the command prompt (**root privileges required**):\n\n`curl https://raw.githubusercontent.com/Lifailon/docker-stats-to-influxdb/rsa/deploy.sh | bash`\n\nCheck the status of the service:\n\n```bash\nroot@netbox-01:~# systemctl status docker-stats-to-influxdb\n● docker-stats-to-influxdb.service - Select docker statistics and output to Influx Database\n     Loaded: loaded (/etc/systemd/system/docker-stats-to-influxdb.service; enabled; vendor preset: enabled)\n     Active: active (running) since Sun 2023-09-24 01:21:32 MSK; 22s ago\n   Main PID: 1607314 (bash)\n      Tasks: 2 (limit: 2220)\n     Memory: 32.8M\n     CGroup: /system.slice/docker-stats-to-influxdb.service\n             ├─1607314 /bin/bash /root/docker-stats-to-influxdb.sh\n             └─1610358 sleep 5\n\nSep 24 01:21:44 netbox-01 bash[1608384]: 0.10        0.20        3.80/1895.00        0.05/0.02        5.43/0.09        5  \u003e\nSep 24 01:21:44 netbox-01 bash[1608384]: 0.82        4.66        90.38/1895.00       15.39/12.17      1571.18/51.18    33 \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.01        0.76        14.66/1895.00       0.00/0.00        20.00/0.00       6  \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.13        0.65        12.66/1895.00       0.84/9.94        34.40/0.00       4  \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.00        0.82        15.97/1895.00       13.30/1.50       35.70/50.90      4  \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.01        0.96        18.67/1895.00       1.04/0.15        1370.00/0.00     3  \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.09        0.15        2.89/1895.00        0.02/0.00        3.65/0.00        5  \u003e\nSep 24 01:21:52 netbox-01 bash[1609432]: 0.00        1.12        21.73/1895.00       0.14/0.56        102.00/0.19      6  \u003e\nSep 24 01:21:53 netbox-01 bash[1609432]: 0.09        0.20        3.80/1895.00        0.05/0.02        5.43/0.09        5  \u003e\nSep 24 01:21:53 netbox-01 bash[1609432]: 0.33        4.66        90.38/1895.00       15.39/12.17      1571.18/51.18    33 \u003e\n```\n\nFor connect to the Influx database, specify the your values of the variables:\n\n```bash\n5 ip=\"192.168.3.104\" # IP address influx server\n6 port=\"8086\"        # Port influx server\n7 db=\"docker\"        # Databases name\n8 table=\"stats\"      # Measurement\n```\n\nOr do a [fork](https://github.com/login?return_to=%2FLifailon%2Fdocker-stats-to-influxdb) of the repository, change the variables to connect to the database and run the deploy or use the configuration system to remote start.\n\n### 📑 Debug output\n\nExample original output and after convert\n\n```bash\n00.00%  0.76%   14.66MiB/1.895GiB       1.89kB/0B       20MB/0B         6       stage_back.1.x3o95788jnrr9puxy5x0h0arm\n00.11%  0.65%   12.7MiB/1.895GiB        836kB/9.86MB    34.4MB/0B       4       portainer_agent.rb0eurxmxegg1at1ukcbki6de.scs3y0p57fyjbczx0w6itxya1\n00.00%  0.82%   15.91MiB/1.895GiB       13.2MB/1.49MB   35.7MB/50.5MB   4       portainer_portainer.1.ep75bz1qhn2x9tx6js0u1ap39\n00.00%  0.96%   18.67MiB/1.895GiB       1.04MB/152kB    1.37GB/0B       3       netbox-docker-netbox-housekeeping-1\n00.09%  0.15%   2.895MiB/1.895GiB       20.2kB/0B       3.65MB/0B       5       netbox-docker-redis-1\n00.00%  1.12%   21.73MiB/1.895GiB       138kB/555kB     102MB/188kB     6       netbox-docker-postgres-1\n00.09%  0.20%   3.801MiB/1.895GiB       50.5kB/19kB     5.43MB/90.1kB   5       netbox-docker-redis-cache-1\n\n0.00    0.76    14.66/1895.00           0.00/0.00       20.00/0.00      6       562.00  stage_back.1.x3o95788jnrr9puxy5x0h0arm\n0.11    0.65    12.70/1895.00           0.84/9.86       34.40/0.00      4       154.00  portainer_agent.rb0eurxmxegg1at1ukcbki6de.scs3y0p57fyjbczx0w6itxya1\n0.00    0.82    15.91/1895.00           13.20/1.49      35.70/50.50     4       280.00  portainer_portainer.1.ep75bz1qhn2x9tx6js0u1ap39\n0.00    0.96    18.67/1895.00           1.04/0.15       1370.00/0.00    3       684.00  netbox-docker-netbox-housekeeping-1\n0.09    0.15    2.89/1895.00            0.02/0.00       3.65/0.00       5       37.80   netbox-docker-redis-1\n0.00    1.12    21.73/1895.00           0.14/0.56       102.00/0.19     6       237.00  netbox-docker-postgres-1\n0.09    0.20    3.80/1895.00            0.05/0.02       5.43/0.09       5       37.80   netbox-docker-redis-cache-1\n0.29    4.66    90.36/1895.00           15.29/12.08     1571.18/50.78   33      1992.6  SUM\n```\n\n### 📊 Influx data\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/influxdb-data.jpg)\n\nTag key **container**:\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/tag-key-container.jpg)\n\nTag key **host**:\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/tag-key-host.jpg)\n\nFiltering by **summary load (sum)** in the last one minute:\n\n`SELECT * FROM \"stats\" WHERE container = 'sum' and time \u003e now() - 1m`\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/select-sum.jpg)\n\n### 📈 Grafana dashboard\n\nExample dashboard for sum all containers\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/grafana-dashboard-sum.jpg)\n\nSelected container:\n\n![Image alt](https://github.com/Lifailon/docker-stats-to-influxdb/blob/rsa/screen/grafana-dashboard-uptime.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Fdocker-stats-to-influxdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifailon%2Fdocker-stats-to-influxdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifailon%2Fdocker-stats-to-influxdb/lists"}