{"id":16042,"date":"2023-04-07T14:13:16","date_gmt":"2023-04-07T11:13:16","guid":{"rendered":"https:\/\/kifarunix.com\/?p=16042"},"modified":"2024-03-10T09:02:05","modified_gmt":"2024-03-10T06:02:05","slug":"monitor-docker-swarm-node-metrics-using-grafana","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/monitor-docker-swarm-node-metrics-using-grafana\/","title":{"rendered":"Monitor Docker Swarm Node Metrics using Grafana"},"content":{"rendered":"\n<p>How can I monitor Docker swarm node metrics? In this tutorial, you will learn how to monitor Docker swarm node metrics using Grafana. Prometheus node exporter can be used to collect hardware and OS metrics that are exposed by the kernel. Such metrics are scraped using Promethes, which acts as data source to Grafana which let&#8217;s you create visualization for all your Docker swarm node metrics for monitoring.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Monitoring Docker Swarm Node Metrics using Grafana<\/h2>\n\n\n\n<p>In this guide, we will use Grafana, Prometheus and Node Exporter to monitor Docker swarm node metrics. <\/p>\n\n\n\n<p>We will run Grafana and Prometheus as swarm services, while Node exporter as separate docker containers on each swarm node.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Install Docker Engine<\/h3>\n\n\n\n<p>If you have not already installed Docker Engine, please refer to appropriate guides in the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/?s=install+docker\" target=\"_blank\" rel=\"noreferrer noopener\">Install Docker in Linux<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Setup Docker Swarm Cluster<\/h3>\n\n\n\n<p>Since we are dealing swarm services, you need to have setup swarm cluster that whose metrics need to be monitored.<\/p>\n\n\n\n<p>If you haven&#8217;t, please refer to this guide to learn how to setup swarm cluster.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/how-to-setup-three-node-docker-swarm-cluster-on-ubuntu\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Setup Docker Swarm Cluster on Ubuntu<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create Docker Swarm Network to Interconnect Monitoring Tools <\/h3>\n\n\n\n<p>The monitoring tools should be in the same network for them to communicate with each other.<\/p>\n\n\n\n<p>Since we are dealing with Docker swarm, then overlay networks can be used to provide communication between services.<\/p>\n\n\n\n<p>If you need to configure Docker containers to use Docker swarm network, then you need to make the Docker swarm network you are creating to be <strong>attachable<\/strong>.<\/p>\n\n\n\n<p>We have already created an overlay network called <code><strong>monitoring_stack<\/strong><\/code>.<\/p>\n\n\n\n<p>You check available Docker networks using the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker network ls<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nNETWORK ID     NAME               DRIVER    SCOPE\n816c7f48bbb3   bridge             bridge    local\n841640b7368f   docker_gwbridge    bridge    local\n45c3672051a1   host               host      local\nsxnbs83rwn5f   ingress            overlay   swarm\n<strong>e5mklugaqapm   monitoring_stack   overlay   swarm<\/strong>\n05990914584e   none               null      local\n<\/code><\/pre>\n\n\n\n<p>You can use this command to create the network, replacing <strong>monitoring_stack<\/strong> with your preferred network name.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker network create --driver overlay --attachable monitoring_stack<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"cadvisor-container\">Deploy Node Exporter Docker Container<\/h3>\n\n\n\n<p>On each Docker Swarm cluster node, deploy the Prometheus Node Exporter to collect individual node metrics;<\/p>\n\n\n\n<p>We have three nodes in our swarm cluster;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker node ls<\/code><\/pre>\n\n\n\n<pre class=\"scroll-sz\"><code>\nID                            HOSTNAME   STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION\nhim49eblt74amba1nghv2f8z1 *   swarm01    Ready     Active         Leader           20.10.22\n4lxyd0f6d9h039y5itjiffqax     swarm02    Ready     Active         Reachable        20.10.12\ndfmdl4wy4e7ouklu8mu7nqqh9     swarm03    Ready     Active         Reachable        20.10.22\n<\/code><\/pre>\n\n\n\n<p>You can simply run the command below to deploy Node Exporter and attach it to our custom Docker network above;<\/p>\n\n\n\n<p>To deploy Node Exporter Docker container on our Swarm Node01;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\ndocker run -d \\\n  --name node-swarm01 \\\n  --restart unless-stopped \\\n  --network monitoring_stack \\\n  --volume \/:\/rootfs:ro \\\n  --volume \/var\/run:\/var\/run:rw \\\n  --volume \/sys:\/sys:ro \\\n  --volume \/var\/lib\/docker\/:\/var\/lib\/docker:ro \\\n  gcr.io\/cadvisor\/cadvisor:v0.47.1\n<\/code><\/pre>\n\n\n\n<p>On the rest of the nodes, run the command, replacing the name of the node exporter on each node.<\/p>\n\n\n\n<p>By default, Node Exporter exposes metrics on port 9100. This port will be reachable within container networks.<\/p>\n\n\n\n<p>You can check the status of the Node exporter container by running the command below on each node;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker ps<\/code><\/pre>\n\n\n\n<p>Also possible to get logs;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker logs -f node-exp-swarm01<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"prometheus-container\">Deploy Prometheus Docker Swarm Service<\/h3>\n\n\n\n<p>Next, let&#8217;s deploy Prometheus as a Docker swarm service to scrape collected swarm node metrics from Node Exporter containers.<\/p>\n\n\n\n<p>First of all, before you can deploy Prometheus swarm service, create a Prometheus configuration file.<\/p>\n\n\n\n<p>In our setup, we placed the Prometheus configuration file under <code><strong>\/opt\/prometheus<\/strong><\/code> directory. While creating Prometheus swarm service, we will mount this configuration file to the default Prometheus configuration file, <strong><code>\/etc\/prometheus\/prometheus.yml<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/opt\/prometheus\/prometheus.yml<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nglobal:\n  scrape_interval: 5s\n  evaluation_interval: 10s\n\nscrape_configs:\n  - job_name: 'cadvisor'\n    metrics_path: '\/metrics'\n    static_configs:\n      - targets: ['cadvisor-swarm01:8080','cadvisor-swarm02:8080','cadvisor-swarm03:8080']\n  <strong>- job_name: 'node-exporter'\n    metrics_path: '\/metrics'\n    static_configs:\n      - targets: ['node-exp-swarm01:9100','node-exp-swarm02:9100','node-exp-swarm03:9100']<\/strong>\n<\/code><\/pre>\n\n\n\n<p>Prometheus will publish the metrics it scrapes from Node exporter and cAdvisor on port 9090.<\/p>\n\n\n\n<p>Thus, let&#8217;s create Prometheus Docker container using the official Prometheus Docker image and configure it to use our custom network created above, <code>monitoring_stack<\/code>.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\ndocker service create \\\n-p 9090:9090 \\\n--mode global \\\n--network monitoring_stack \\\n--mount type=bind,src=\/opt\/prometheus\/prometheus.yml,dst=\/etc\/prometheus\/prometheus.yml \\\n--name prometheus \\\nprom\/prometheus\n<\/code><\/pre>\n\n\n\n<p>If Prometheus is already running as a swarm service then update it;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker service update --force prometheus<\/code><\/pre>\n\n\n\n<p>Your Prometheus container should now be running and exposed via port 9090\/tcp.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker service ls --format '{{.Name}}\\t{{.Ports}}'<\/code><\/pre>\n\n\n\n<pre class=\"scroll-sz\"><code>\nnagios-server\t*:8081->80\/tcp\n<strong>prometheus\t*:9090->9090\/tcp<\/strong>\nwordpress\t*:8880->80\/tcp\n<\/code><\/pre>\n\n\n\n<p>Similarly, ensure you allow port 9090\/tcp on firewall to allow you access the metrics externally!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Verify Prometheus Targets\/Metrics from Prometheus Dashboard<\/h3>\n\n\n\n<p>You can now navigate to <strong><code>http:\/\/docker-host-IP:9090\/targets<\/code><\/strong> to see Prometheus targets,<\/p>\n\n\n\n<p><strong><code>docker-host-IP<\/code><\/strong> can be IP of any of the swarm node.<\/p>\n\n\n\n<p>Targets;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/node-exporter-targets-prometheus.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1897\" height=\"574\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/node-exporter-targets-prometheus.png\" alt=\"Monitor Docker Swarm Node Metrics using Grafana\" class=\"wp-image-16049\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/node-exporter-targets-prometheus.png?v=1680863881 1897w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/node-exporter-targets-prometheus-768x232.png?v=1680863881 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/node-exporter-targets-prometheus-1536x465.png?v=1680863881 1536w\" sizes=\"(max-width: 1897px) 100vw, 1897px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Check Swarm Nodes Metrics on Prometheus<\/h3>\n\n\n\n<p>On the dashboard, click <strong>Prometheus,<\/strong> and open metrics explorer and just type <strong>container<\/strong> and you should see quite a number of metrics;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/prometheus-node-exporter-node-metrics.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1886\" height=\"918\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/prometheus-node-exporter-node-metrics.png\" alt=\"Monitor Docker Swarm Node Metrics using Grafana\" class=\"wp-image-16050\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/prometheus-node-exporter-node-metrics.png?v=1680863966 1886w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/prometheus-node-exporter-node-metrics-768x374.png?v=1680863966 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/prometheus-node-exporter-node-metrics-1536x748.png?v=1680863966 1536w\" sizes=\"(max-width: 1886px) 100vw, 1886px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>For example, you can get Swarm nodes uptime;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(node_time_seconds - node_boot_time_seconds)\/3600<\/code><\/pre>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-uptime.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1902\" height=\"557\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-uptime.png\" alt=\"\" class=\"wp-image-16051\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-uptime.png?v=1680864013 1902w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-uptime-768x225.png?v=1680864013 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-uptime-1536x450.png?v=1680864013 1536w\" sizes=\"(max-width: 1902px) 100vw, 1902px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Deploy Grafana Docker Swarm Service<\/h3>\n\n\n\n<p>You need Grafana Docker swarm service deployed on your cluster to visualize the swarm cluster metrics.<\/p>\n\n\n\n<p>Create Grafana Data, Configuration and home directories volumes. Using a volume for Grafana data ensures that the dashboards, users, and other settings you create are persisted across container restarts. This is important if you want to keep your dashboards and other Grafana settings even if the container is updated or recreated.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>for i in conf data home; do docker volume create grafana-$i; done<\/code><\/pre>\n\n\n\n<p>To deploy Grafana Docker container using the official image, <strong><code>grafana\/grafana-oss<\/code><\/strong> and attach it to the custom network created above.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\ndocker service create \\\n  --name grafana \\\n  --network monitoring_stack \\\n  --mount type=volume,source=grafana-data,target=\/var\/lib\/grafana \\\n  --mount type=volume,source=grafana-home,target=\/usr\/share\/grafana \\\n  --mount type=volume,source=grafana-config,target=\/etc\/grafana \\\n  --publish published=3000,target=3000 \\\n  grafana\/grafana\n<\/code><\/pre>\n\n\n\n<p>Grafana is now running as a single replica on all nodes.<\/p>\n\n\n\n<p>If you run it as global or multi-replicated, you may not be able to login, getting Unauthorized, (user token not found issue in the logs!)<\/p>\n\n\n\n<p>Open port 3000\/tcp on firewall to allow external access to Grafana;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ufw allow 3000\/tcp<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Accessing Grafana Web Interface<\/h3>\n\n\n\n<p>You can now access Grafana web interface http:\/\/docker-host-IP:3000.<\/p>\n\n\n\n<p>Default credentials are <strong>admin\/admin<\/strong>. Reset the password and proceed to the Dashboard;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1888\" height=\"919\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard.png\" alt=\"Monitor Docker swarm node metrics using Grafana\" class=\"wp-image-15421\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard.png?v=1675716247 1888w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-768x374.png?v=1675716247 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-1536x748.png?v=1675716247 1536w\" sizes=\"(max-width: 1888px) 100vw, 1888px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Integrate Prometheus with Grafana For Monitoring<\/h3>\n\n\n\n<p>You can now integrate Prometheus with Grafana by adding Prometheus data source to Grafana. Check the link below;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/integrate-prometheus-with-grafana-for-monitoring\/#add-grafana-prometheus-data-source\" target=\"_blank\" rel=\"noreferrer noopener\">Integrate Prometheus with Grafana For Monitoring<\/a><\/p>\n\n\n\n<p>Data sources, once you have added the Prometheus data source.<\/p>\n\n\n\n<p>As you can see, we specified the name of the Prometheus container on the data source URL because both Grafana and Prometheus are on same network.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-prometheus-docker-container-data-source.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1889\" height=\"457\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-prometheus-docker-container-data-source.png\" alt=\"Monitor Docker swarm node metrics using Grafana\" class=\"wp-image-15429\" title=\"Monitor SSL\/TLS Certificate Expiry with Prometheus and Grafana 4\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-prometheus-docker-container-data-source.png?v=1675785437 1889w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-prometheus-docker-container-data-source-768x186.png?v=1675785437 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-prometheus-docker-container-data-source-1536x372.png?v=1675785437 1536w\" sizes=\"(max-width: 1889px) 100vw, 1889px\" \/><\/figure><\/a><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Create Docker Swarm Node Metrics Dashboards on Grafana<\/h3>\n\n\n\n<p>You can now create your own Grafana visualization dashboards for your Docker swarm cluster.<\/p>\n\n\n\n<p>As a simple example, let&#8217;s create a simple visualization to check swarm nodes uptime<\/p>\n\n\n\n<p>on the nodes, you would usually display system uptime using <strong><code>uptime<\/code><\/strong> command or <code>w<\/code> command.<\/p>\n\n\n\n<p>e.g<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>uptime<\/code><\/pre>\n\n\n\n<p>To create a Grafana dashboard, navigate to dashboards menu &gt; New dashboard.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-menu.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1665\" height=\"571\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-menu.png\" alt=\"\" class=\"wp-image-15430\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-menu.png?v=1675786297 1665w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-menu-768x263.png?v=1675786297 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/grafana-dashboard-menu-1536x527.png?v=1675786297 1536w\" sizes=\"(max-width: 1665px) 100vw, 1665px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Add new panel, we are using <strong>Stats<\/strong> panel in this example.<\/p>\n\n\n\n<p>You have three sections on the dashboard panel;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/new-dashboard-panel.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1895\" height=\"942\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/new-dashboard-panel.png\" alt=\"\" class=\"wp-image-15443\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/new-dashboard-panel.png?v=1675848390 1895w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/new-dashboard-panel-768x382.png?v=1675848390 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/02\/new-dashboard-panel-1536x764.png?v=1675848390 1536w\" sizes=\"(max-width: 1895px) 100vw, 1895px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>So, to create a visualization of specific metric, you need a query to fetch those metrics from the datasource, which in this case is our Preom<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>So from the Query panel, select a datasource (Prometheus in this example).<\/li>\n\n\n\n<li>You can build your query using Builder which lets you select metrics and enter values (<strong>Builder<\/strong>) or simply switch to <strong>code<\/strong> which allows you to type the query manually.\n<ul class=\"wp-block-list\">\n<li>with Builder, you can simply select your metric query from <strong>Metric<\/strong> drop-down and define the filters under <strong>Label filters<\/strong>.<\/li>\n\n\n\n<li>with Code, you can just type your query under metrics browser;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>avg(node_time_seconds{instance=~\"node-exp-$node:9100\"} - node_boot_time_seconds{instance=~\"node-exp-$node:9100\"}) by (instance) \/ 3600<\/code><\/pre>\n\n\n\n<p>Noticed, the use $node variable? We created a variable to extract swarm node name from exporter.<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-query-code.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1371\" height=\"472\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-query-code.png\" alt=\"\" class=\"wp-image-16052\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-query-code.png?v=1680864367 1371w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-query-code-768x264.png?v=1680864367 768w\" sizes=\"(max-width: 1371px) 100vw, 1371px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Under the Panel options;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>change visualization type. We are using <strong>Stat<\/strong> in this example.<\/li>\n\n\n\n<li>Set the panel name e.g <strong>Node Uptime<\/strong>. You can leave other options with default values.<\/li>\n\n\n\n<li>Go through other panel settings and see what you can change!<\/li>\n<\/ul>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-metrics.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1888\" height=\"865\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-metrics.png\" alt=\"Monitor Docker Swarm Node Metrics using Grafana\" class=\"wp-image-16053\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-metrics.png?v=1680864735 1888w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-metrics-768x352.png?v=1680864735 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/uptime-metrics-1536x704.png?v=1680864735 1536w\" sizes=\"(max-width: 1888px) 100vw, 1888px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>When done, click <strong>Save\/Apply<\/strong> to save the dashboard\/visualization.<\/p>\n\n\n\n<p>Docker Swarm Nodes CPU usage, RAM usage, Disk usage, Disk IO, sample dashboard;<\/p>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1887\" height=\"864\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard.png\" alt=\"Monitor Docker Swarm Node Metrics using Grafana\" class=\"wp-image-16054\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard.png?v=1680865507 1887w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-768x352.png?v=1680865507 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1536x703.png?v=1680865507 1536w\" sizes=\"(max-width: 1887px) 100vw, 1887px\" \/><\/figure><\/a><\/div>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1885\" height=\"839\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1.png\" alt=\"Monitor Docker Swarm Node Metrics using Grafana\" class=\"wp-image-16055\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1.png?v=1680865584 1885w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1-768x342.png?v=1680865584 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-1-1536x684.png?v=1680865584 1536w\" sizes=\"(max-width: 1885px) 100vw, 1885px\" \/><\/figure><\/a><\/div>\n\n\n\n<div><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-2.png\" class=\"td-modal-image\"><figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1886\" height=\"929\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-2.png\" alt=\"\" class=\"wp-image-16056\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-2.png?v=1680865602 1886w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-2-768x378.png?v=1680865602 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/04\/swarm-nodes-metrics-dashboard-2-1536x757.png?v=1680865602 1536w\" sizes=\"(max-width: 1886px) 100vw, 1886px\" \/><\/figure><\/a><\/div>\n\n\n\n<p>Here is a sample dashboard JSON file;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n{\n  \"annotations\": {\n    \"list\": [\n      {\n        \"builtIn\": 1,\n        \"datasource\": {\n          \"type\": \"grafana\",\n          \"uid\": \"-- Grafana --\"\n        },\n        \"enable\": true,\n        \"hide\": true,\n        \"iconColor\": \"rgba(0, 211, 255, 1)\",\n        \"name\": \"Annotations & Alerts\",\n        \"target\": {\n          \"limit\": 100,\n          \"matchAny\": false,\n          \"tags\": [],\n          \"type\": \"dashboard\"\n        },\n        \"type\": \"dashboard\"\n      }\n    ]\n  },\n  \"editable\": true,\n  \"fiscalYearStartMonth\": 0,\n  \"graphTooltip\": 0,\n  \"id\": 3,\n  \"links\": [],\n  \"liveNow\": false,\n  \"panels\": [\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"thresholds\"\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              }\n            ]\n          },\n          \"unit\": \"h\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 0\n      },\n      \"id\": 2,\n      \"options\": {\n        \"colorMode\": \"value\",\n        \"graphMode\": \"none\",\n        \"justifyMode\": \"auto\",\n        \"orientation\": \"auto\",\n        \"reduceOptions\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"fields\": \"\",\n          \"values\": false\n        },\n        \"textMode\": \"auto\"\n      },\n      \"pluginVersion\": \"9.4.7\",\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"avg(node_time_seconds{instance=~\\\"node-exp-$node:9100\\\"} - node_boot_time_seconds{instance=~\\\"node-exp-$node:9100\\\"}) by (instance) \/ 3600\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Node Uptime\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \"node-exp-(\\\\S+):9100\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"stat\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"text\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"auto\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          }\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 12,\n        \"y\": 0\n      },\n      \"id\": 10,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"displayMode\": \"table\",\n          \"placement\": \"right\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg(node_load1{instance=~\\\"node-exp-$node:9100\\\"}) by (instance))\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"CPU Load Average 1m\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"text\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"auto\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          }\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 8\n      },\n      \"id\": 4,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [],\n          \"displayMode\": \"list\",\n          \"placement\": \"bottom\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"100 - (avg(irate(node_cpu_seconds_total{instance=~\\\"node-exp-$node:9100\\\",mode=\\\"idle\\\"}[$__rate_interval])) by (instance) * 100)\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Avg CPU Usage (%)\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"text\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"auto\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          }\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 12,\n        \"y\": 8\n      },\n      \"id\": 11,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"displayMode\": \"table\",\n          \"placement\": \"right\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg(node_load5{instance=~\\\"node-exp-$node:9100\\\"}) by (instance))\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"CPU Load Average 5m\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"series\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"axisSoftMin\": 0,\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"never\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          },\n          \"unit\": \"decmbytes\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 16\n      },\n      \"id\": 5,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [],\n          \"displayMode\": \"list\",\n          \"placement\": \"bottom\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"avg((node_memory_MemTotal_bytes{instance=~\\\"node-exp-$node:9100\\\"} - (node_memory_MemFree_bytes{instance=~\\\"node-exp-$node:9100\\\"} + node_memory_Cached_bytes{instance=~\\\"node-exp-$node:9100\\\"} + node_memory_Buffers_bytes{instance=~\\\"node-exp-$node:9100\\\"}))\/1024\/1024) by (instance)\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Memory Usage\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"text\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"auto\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          }\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 12,\n        \"y\": 16\n      },\n      \"id\": 12,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"displayMode\": \"table\",\n          \"placement\": \"right\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg(node_load15{instance=~\\\"node-exp-$node:9100\\\"}) by (instance))\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"CPU Load Average 15m\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"thresholds\"\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              }\n            ]\n          },\n          \"unit\": \"percent\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 24\n      },\n      \"id\": 6,\n      \"options\": {\n        \"orientation\": \"auto\",\n        \"reduceOptions\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"fields\": \"\",\n          \"values\": false\n        },\n        \"showThresholdLabels\": false,\n        \"showThresholdMarkers\": true\n      },\n      \"pluginVersion\": \"9.4.7\",\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg(irate(node_cpu_seconds_total{instance=~\\\"node-exp-$node:9100\\\",mode=\\\"iowait\\\"}[$__rate_interval])) by (instance)) * 100\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"CPU IOWait\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \"node-exp-(\\\\S+):9100\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"gauge\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"thresholds\"\n          },\n          \"mappings\": [],\n          \"max\": 100,\n          \"min\": 0,\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              }\n            ]\n          },\n          \"unit\": \"percent\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 12,\n        \"y\": 24\n      },\n      \"id\": 9,\n      \"options\": {\n        \"orientation\": \"auto\",\n        \"reduceOptions\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"fields\": \"\",\n          \"values\": false\n        },\n        \"showThresholdLabels\": false,\n        \"showThresholdMarkers\": true\n      },\n      \"pluginVersion\": \"9.4.7\",\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg((node_filesystem_size_bytes{mountpoint=\\\"\/\\\"} - node_filesystem_avail_bytes{mountpoint=\\\"\/\\\"}) \/ node_filesystem_size_bytes{mountpoint=\\\"\/\\\"}) by (instance)) * 100\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Disk Usage %\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \"node-exp-(\\\\S+):9100\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"gauge\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"thresholds\"\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              }\n            ]\n          },\n          \"unit\": \"decmbytes\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 32\n      },\n      \"id\": 7,\n      \"options\": {\n        \"orientation\": \"auto\",\n        \"reduceOptions\": {\n          \"calcs\": [\n            \"lastNotNull\"\n          ],\n          \"fields\": \"\",\n          \"values\": false\n        },\n        \"showThresholdLabels\": false,\n        \"showThresholdMarkers\": true\n      },\n      \"pluginVersion\": \"9.4.7\",\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"(avg(node_memory_MemAvailable_bytes{instance=~\\\"node-exp-$node:9100\\\"}) by (instance)) \/ 1024 \/ 1024\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Available Memory\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \"node-exp-(\\\\S+):9100\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"gauge\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"series\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"axisSoftMin\": 0,\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"never\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          },\n          \"unit\": \"s\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 12,\n        \"y\": 32\n      },\n      \"id\": 13,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [\n            \"min\",\n            \"max\"\n          ],\n          \"displayMode\": \"table\",\n          \"placement\": \"right\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"avg(irate(node_disk_io_time_seconds_total{device=\\\"sda\\\",instance=~\\\"node-exp-$node:9100\\\"}[$__rate_interval])) by (instance)\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Disk IO\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    },\n    {\n      \"datasource\": {\n        \"type\": \"prometheus\",\n        \"uid\": \"GbRl4cL4k\"\n      },\n      \"fieldConfig\": {\n        \"defaults\": {\n          \"color\": {\n            \"mode\": \"palette-classic\"\n          },\n          \"custom\": {\n            \"axisCenteredZero\": false,\n            \"axisColorMode\": \"series\",\n            \"axisLabel\": \"\",\n            \"axisPlacement\": \"auto\",\n            \"axisSoftMin\": 0,\n            \"barAlignment\": 0,\n            \"drawStyle\": \"line\",\n            \"fillOpacity\": 0,\n            \"gradientMode\": \"none\",\n            \"hideFrom\": {\n              \"legend\": false,\n              \"tooltip\": false,\n              \"viz\": false\n            },\n            \"lineInterpolation\": \"linear\",\n            \"lineWidth\": 1,\n            \"pointSize\": 5,\n            \"scaleDistribution\": {\n              \"type\": \"linear\"\n            },\n            \"showPoints\": \"never\",\n            \"spanNulls\": false,\n            \"stacking\": {\n              \"group\": \"A\",\n              \"mode\": \"none\"\n            },\n            \"thresholdsStyle\": {\n              \"mode\": \"off\"\n            }\n          },\n          \"mappings\": [],\n          \"thresholds\": {\n            \"mode\": \"absolute\",\n            \"steps\": [\n              {\n                \"color\": \"green\",\n                \"value\": null\n              },\n              {\n                \"color\": \"red\",\n                \"value\": 80\n              }\n            ]\n          },\n          \"unit\": \"KBs\"\n        },\n        \"overrides\": []\n      },\n      \"gridPos\": {\n        \"h\": 8,\n        \"w\": 12,\n        \"x\": 0,\n        \"y\": 40\n      },\n      \"id\": 14,\n      \"options\": {\n        \"legend\": {\n          \"calcs\": [\n            \"min\",\n            \"max\"\n          ],\n          \"displayMode\": \"table\",\n          \"placement\": \"right\",\n          \"showLegend\": true\n        },\n        \"tooltip\": {\n          \"mode\": \"single\",\n          \"sort\": \"none\"\n        }\n      },\n      \"targets\": [\n        {\n          \"datasource\": {\n            \"type\": \"prometheus\",\n            \"uid\": \"GbRl4cL4k\"\n          },\n          \"editorMode\": \"code\",\n          \"expr\": \"avg(irate(node_disk_read_bytes_total{instance=~\\\"node-exp-$node:9100\\\"}[$__rate_interval])) by (instance)\",\n          \"legendFormat\": \"__auto\",\n          \"range\": true,\n          \"refId\": \"A\"\n        }\n      ],\n      \"title\": \"Disk Read\/Write\",\n      \"transformations\": [\n        {\n          \"id\": \"renameByRegex\",\n          \"options\": {\n            \"regex\": \".*node-exp-(\\\\S+):9100.*\",\n            \"renamePattern\": \"$1\"\n          }\n        }\n      ],\n      \"type\": \"timeseries\"\n    }\n  ],\n  \"refresh\": \"\",\n  \"revision\": 1,\n  \"schemaVersion\": 38,\n  \"style\": \"dark\",\n  \"tags\": [],\n  \"templating\": {\n    \"list\": [\n      {\n        \"current\": {\n          \"selected\": true,\n          \"text\": [\n            \"swarm01\",\n            \"swarm02\",\n            \"swarm03\"\n          ],\n          \"value\": [\n            \"swarm01\",\n            \"swarm02\",\n            \"swarm03\"\n          ]\n        },\n        \"datasource\": {\n          \"type\": \"prometheus\",\n          \"uid\": \"GbRl4cL4k\"\n        },\n        \"definition\": \"query_result(node_time_seconds{instance=~\\\".+\\\"})\",\n        \"hide\": 0,\n        \"includeAll\": false,\n        \"label\": \"Swarm Node\",\n        \"multi\": true,\n        \"name\": \"node\",\n        \"options\": [],\n        \"query\": {\n          \"query\": \"query_result(node_time_seconds{instance=~\\\".+\\\"})\",\n          \"refId\": \"StandardVariableQuery\"\n        },\n        \"refresh\": 1,\n        \"regex\": \"\/instance=\\\"node-exp-(\\\\S+):9100.*\/\",\n        \"skipUrlSync\": false,\n        \"sort\": 0,\n        \"type\": \"query\"\n      }\n    ]\n  },\n  \"time\": {\n    \"from\": \"now-1h\",\n    \"to\": \"now\"\n  },\n  \"timepicker\": {},\n  \"timezone\": \"\",\n  \"title\": \"Swarm Nodes Metrics\",\n  \"uid\": \"11N3xhY4k\",\n  \"version\": 23,\n  \"weekStart\": \"\"\n}\n<\/code><\/pre>\n\n\n\n<p>You can also check <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/?category=docker\" target=\"_blank\" rel=\"noreferrer noopener\">community created dashboards<\/a> and import any that might impress you.<\/p>\n\n\n\n<p>That marks the end of our guide on how to monitoring Docker swarm node metrics using Grafana.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/monitor-docker-containers-metrics-using-grafana\/\" target=\"_blank\" rel=\"noreferrer noopener\">Monitor Docker Containers Metrics using Grafana<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/connect-to-remote-docker-environment-on-docker-desktop\/\" target=\"_blank\" rel=\"noreferrer noopener\">Connect to Remote Docker Environment on Docker Desktop<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can I monitor Docker swarm node metrics? In this tutorial, you will learn how to monitor Docker swarm node metrics using Grafana. Prometheus node<\/p>\n","protected":false},"author":10,"featured_media":16054,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[72,1076,1077,121],"tags":[6509,6506,6505,6507,6508],"class_list":["post-16042","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-monitoring","category-containers","category-docker","category-howtos","tag-monitor-docker-swarm-node-metrics-using-grafana","tag-monitor-swarm-cluster-disk-usage","tag-monitor-swarm-node-metrics","tag-swarm-cluster-resource-usage","tag-use-grafana-to-monitor-swarm-nodes","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/16042"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=16042"}],"version-history":[{"count":7,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/16042\/revisions"}],"predecessor-version":[{"id":20735,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/16042\/revisions\/20735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/16054"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=16042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=16042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=16042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}