Linux ip-172-26-2-223 5.4.0-1018-aws #18-Ubuntu SMP Wed Jun 24 01:15:00 UTC 2020 x86_64
Apache
: 172.26.2.223 | : 18.227.111.48
Cant Read [ /etc/named.conf ]
8.1.13
www
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
BLACK DEFEND!
README
+ Create Folder
+ Create File
/
snap /
lxd /
33085 /
share /
lxd-documentation /
metrics /
[ HOME SHELL ]
Name
Size
Permission
Action
index.html
87.28
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : index.html
<!doctype html> <html class="no-js" lang="en" data-content_root="../"> <head><meta charset="utf-8"/> <meta name="viewport" content="width=device-width,initial-scale=1"/> <meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" /> <meta property="og:title" content="How to monitor metrics" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://documentation.ubuntu.com/lxd/en/latest/metrics/" /> <meta property="og:site_name" content="LXD documentation" /> <meta property="og:description" content="LXD collects metrics for all running instances as well as some internal metrics. These metrics cover the CPU, memory, network, disk and process usage. They are meant to be consumed by Prometheus, a..." /> <meta property="og:image" content="https://documentation.ubuntu.com/lxd/en/latest/_static/tag.png" /> <meta property="og:image:alt" content="LXD documentation" /> <meta name="description" content="LXD collects metrics for all running instances as well as some internal metrics. These metrics cover the CPU, memory, network, disk and process usage. They are meant to be consumed by Prometheus, a..." /> <link rel="index" title="Index" href="../genindex/" /><link rel="search" title="Search" href="../search/" /><link rel="next" title="How to send logs to Loki" href="../howto/logs_loki/" /><link rel="prev" title="How to increase the network bandwidth" href="../howto/network_increase_bandwidth/" /> <link rel="shortcut icon" href="../_static/favicon.ico"/><!-- Generated with Sphinx 8.2.3 and Furo 2024.08.06 --> <title>How to monitor metrics</title> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=8f2a1f02" /> <link rel="stylesheet" type="text/css" href="../_static/styles/furo.css?v=354aac6f" /> <link rel="stylesheet" type="text/css" href="../_static/copybutton.css?v=76b2166b" /> <link rel="stylesheet" type="text/css" href="../_static/youtube.css" /> <link rel="stylesheet" type="text/css" href="../_static/related-links.css" /> <link rel="stylesheet" type="text/css" href="../_static/terminal-output.css" /> <link rel="stylesheet" type="text/css" href="../_static/config-options.css" /> <link rel="stylesheet" type="text/css" href="../_static/sphinx-design.min.css?v=95c83b7e" /> <link rel="stylesheet" type="text/css" href="../_static/styles/furo-extensions.css?v=302659d7" /> <link rel="stylesheet" type="text/css" href="../_static/custom.css?v=bec1b194" /> <link rel="stylesheet" type="text/css" href="../_static/header.css?v=84f70f09" /> <link rel="stylesheet" type="text/css" href="../_static/github_issue_links.css?v=af88fb93" /> <link rel="stylesheet" type="text/css" href="../_static/furo_colors.css?v=c4ccdb8a" /> <link rel="stylesheet" type="text/css" href="../_static/footer.css?v=bd05fc90" /> </head> <body> <header id="header" class="p-navigation"> <div class="p-navigation__nav" role="menubar"> <ul class="p-navigation__links" role="menu"> <li> <a class="p-logo" href="https://canonical.com/lxd" aria-current="page"> <img src="../_static/tag.png" alt="Logo" class="p-logo-image"> <div class="p-logo-text p-heading--4">LXD </div> </a> </li> <li class="nav-ubuntu-com"> <a href="https://canonical.com/lxd" class="p-navigation__link">canonical.com/lxd</a> </li> <li> <a href="#" class="p-navigation__link nav-more-links">More resources</a> <ul class="more-links-dropdown"> <li> <a href="https://ubuntu.com/lxd/install/" class="p-navigation__sub-link p-dropdown__link">Install LXD</a> </li> <li> <a href="https://ubuntu.com/lxd/manage/" class="p-navigation__sub-link p-dropdown__link">Manage LXD</a> </li> <li> <a href="https://discourse.ubuntu.com/c/lxd/" class="p-navigation__sub-link p-dropdown__link">Forum</a> </li> <li> <a href="https://github.com/canonical/lxd" class="p-navigation__sub-link p-dropdown__link">GitHub</a> </li> </ul> </li> </ul> </div> </header> <script> document.body.dataset.theme = localStorage.getItem("theme") || "auto"; </script> <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="svg-toc" viewBox="0 0 24 24"> <title>Contents</title> <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024"> <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/> </svg> </symbol> <symbol id="svg-menu" viewBox="0 0 24 24"> <title>Menu</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu"> <line x1="3" y1="12" x2="21" y2="12"></line> <line x1="3" y1="6" x2="21" y2="6"></line> <line x1="3" y1="18" x2="21" y2="18"></line> </svg> </symbol> <symbol id="svg-arrow-right" viewBox="0 0 24 24"> <title>Expand</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right"> <polyline points="9 18 15 12 9 6"></polyline> </svg> </symbol> <symbol id="svg-sun" viewBox="0 0 24 24"> <title>Light mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun"> <circle cx="12" cy="12" r="5"></circle> <line x1="12" y1="1" x2="12" y2="3"></line> <line x1="12" y1="21" x2="12" y2="23"></line> <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line> <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line> <line x1="1" y1="12" x2="3" y2="12"></line> <line x1="21" y1="12" x2="23" y2="12"></line> <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line> <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line> </svg> </symbol> <symbol id="svg-moon" viewBox="0 0 24 24"> <title>Dark mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" /> </svg> </symbol> <symbol id="svg-sun-with-moon" viewBox="0 0 24 24"> <title>Auto light/dark, in light mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-custom-derived-from-feather-sun-and-tabler-moon"> <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/> <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/> <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/> <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/> <line x1="19" y1="14.05" x2="20.414" y2="15.464"/> <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/> <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/> <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/> <line x1="19" y1="5.05" x2="20.414" y2="3.636"/> <circle cx="14.5" cy="9.55" r="3.6"/> </svg> </symbol> <symbol id="svg-moon-with-sun" viewBox="0 0 24 24"> <title>Auto light/dark, in dark mode</title> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-custom-derived-from-feather-sun-and-tabler-moon"> <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/> <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/> <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/> <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/> <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/> <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/> <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/> <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/> <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/> <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/> </svg> </symbol> <symbol id="svg-pencil" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code"> <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" /> <path d="M13.5 6.5l4 4" /> <path d="M20 21l2 -2l-2 -2" /> <path d="M17 17l-2 2l2 2" /> </svg> </symbol> <symbol id="svg-eye" viewBox="0 0 24 24"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code"> <path stroke="none" d="M0 0h24v24H0z" fill="none" /> <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" /> <path d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" /> <path d="M20 21l2 -2l-2 -2" /> <path d="M17 17l-2 2l2 2" /> </svg> </symbol> </svg> <input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"> <input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"> <label class="overlay sidebar-overlay" for="__navigation"> <div class="visually-hidden">Hide navigation sidebar</div> </label> <label class="overlay toc-overlay" for="__toc"> <div class="visually-hidden">Hide table of contents sidebar</div> </label> <a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a> <div class="page"> <header class="mobile-header"> <div class="header-left"> <label class="nav-overlay-icon" for="__navigation"> <div class="visually-hidden">Toggle site navigation sidebar</div> <i class="icon"><svg><use href="#svg-menu"></use></svg></i> </label> </div> <div class="header-center"> <a href="../"><div class="brand">LXD</div></a> </div> <div class="header-right"> <div class="theme-toggle-container theme-toggle-header"> <button class="theme-toggle"> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> </button> </div> <label class="toc-overlay-icon toc-header-icon" for="__toc"> <div class="visually-hidden">Toggle table of contents sidebar</div> <i class="icon"><svg><use href="#svg-toc"></use></svg></i> </label> </div> </header> <aside class="sidebar-drawer"> <div class="sidebar-container"> <div class="sidebar-sticky"><a class="sidebar-brand" href="../"> </a><form class="sidebar-search-container" method="get" action="../search/" role="search"> <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search"> <input type="submit" value="Go"> <input type="hidden" name="check_keywords" value="yes"> <input type="hidden" name="area" value="default"> </form> <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../">LXD</a></li> <li class="toctree-l1 has-children"><a class="reference internal" href="../tutorial/">Tutorials</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of Tutorials</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="../tutorial/first_steps/">First steps with LXD</a></li> <li class="toctree-l2"><a class="reference internal" href="../tutorial/ui/">Getting started with the UI</a></li> </ul> </li> <li class="toctree-l1 current has-children"><a class="reference internal" href="../howto/">How-to guides</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of How-to guides</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> <li class="toctree-l2 has-children"><a class="reference internal" href="../getting_started/">Getting started</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><div class="visually-hidden">Toggle navigation of Getting started</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../installing/">Install LXD</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/initialize/">Initialize LXD</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/snap/">Manage the snap</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/access_ui/">Access the UI</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/access_documentation/">Access documentation</a></li> <li class="toctree-l3"><a class="reference internal" href="../support/">Get support</a></li> <li class="toctree-l3"><a class="reference internal" href="../contributing/">Contribute to LXD</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../operation/">LXD server and client</a><input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><div class="visually-hidden">Toggle navigation of LXD server and client</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/server_expose/">Expose LXD to the network</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/server_configure/">Configure the LXD server</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/oidc_entra_id/">Configure OIDC authentication with Microsoft Entra ID</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/oidc_auth0/">Configure OIDC authentication with Auth0</a></li> <li class="toctree-l3"><a class="reference internal" href="../remotes/">Add remote servers</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/lxc_alias/">Add command aliases</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../instances/">Instances</a><input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><div class="visually-hidden">Toggle navigation of Instances</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_create/">Create instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_configure/">Configure instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_manage/">Manage instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../profiles/">Use profiles</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_troubleshoot/">Troubleshoot errors</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_access_files/">Access files</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_console/">Access the console</a></li> <li class="toctree-l3"><a class="reference internal" href="../instance-exec/">Run commands</a></li> <li class="toctree-l3"><a class="reference internal" href="../cloud-init/">Use cloud-init</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_routed_nic_vm/">Add a routed NIC to a VM</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_backup/">Back up instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/move_instances/">Move instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/import_machines_to_instances/">Import existing machines</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/migrate_from_lxc/">Migrate from LXC</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/container_gpu_passthrough_with_docker/">Pass NVIDIA GPUs</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../images/">Images</a><input class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><div class="visually-hidden">Toggle navigation of Images</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/images_remote/">Use remote images</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/images_manage/">Manage images</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/images_profiles/">Associate profiles</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/images_copy/">Copy and import images</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/images_create/">Create images</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../projects/">Projects</a><input class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><div class="visually-hidden">Toggle navigation of Projects</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/projects_create/">Create and configure</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/projects_work/">Work with projects</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/projects_confine/">Confine users to projects</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../storage/">Storage</a><input class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><div class="visually-hidden">Toggle navigation of Storage</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_pools/">Manage pools</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_volumes/">Manage volumes</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_buckets/">Manage buckets</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_create_instance/">Create an instance in a pool</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_backup_volume/">Back up a volume</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/storage_move_volume/">Move or copy a volume</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../networks/">Networking</a><input class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><div class="visually-hidden">Toggle navigation of Networking</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/network_create/">Create a network</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_configure/">Configure a network</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_bgp/">Configure as BGP server</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_acls/">Configure network ACLs</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_forwards/">Configure forwards</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_zones/">Configure network zones</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_bridge_firewalld/">Configure your firewall</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_bridge_resolved/">Integrate with resolved</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_ovn_setup/">Set up OVN</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_load_balancers/">Configure load balancers</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_ovn_peers/">Configure peer routing</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_ipam/">Display IPAM information</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../howto/troubleshoot/">Troubleshooting</a><input class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><div class="visually-hidden">Toggle navigation of Troubleshooting</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/network_bridge_firewalld/">Configure your firewall</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/instances_troubleshoot/">Troubleshoot instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/dqlite_troubleshoot/">Troubleshoot Dqlite</a></li> <li class="toctree-l3"><a class="reference internal" href="../debugging/">Debug LXD</a></li> <li class="toctree-l3"><a class="reference internal" href="../faq/">Frequently asked</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../clustering/">Clustering</a><input class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><div class="visually-hidden">Toggle navigation of Clustering</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_form/">Form a cluster</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_manage/">Manage a cluster</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_config_networks/">Configure networks</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_config_storage/">Configure storage</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_manage_instance/">Manage instances</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_groups/">Set up cluster groups</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/cluster_recover/">Recover a cluster</a></li> </ul> </li> <li class="toctree-l2 current has-children"><a class="reference internal" href="../production-setup/">Production setup</a><input checked="" class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><div class="visually-hidden">Toggle navigation of Production setup</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul class="current"> <li class="toctree-l3"><a class="reference internal" href="../howto/benchmark_performance/">Benchmark performance</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/network_increase_bandwidth/">Increase bandwidth</a></li> <li class="toctree-l3 current current-page"><a class="current reference internal" href="#">Monitor metrics</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/logs_loki/">Send logs to Loki</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/grafana/">Set up Grafana</a></li> <li class="toctree-l3"><a class="reference internal" href="../backup/">Back up a server</a></li> <li class="toctree-l3"><a class="reference internal" href="../howto/disaster_recovery/">Recover instances</a></li> </ul> </li> </ul> </li> <li class="toctree-l1 has-children"><a class="reference internal" href="../explanation/">Explanation</a><input class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><div class="visually-hidden">Toggle navigation of Explanation</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="../explanation/lxd_lxc/"><code class="docutils literal notranslate"><span class="pre">lxd</span></code> and <code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/instances/">Containers and VMs</a></li> <li class="toctree-l2"><a class="reference internal" href="../image-handling/">Local and remote images</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/storage/">Storage pools, volumes, and buckets</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/networks/">Networking setups</a></li> <li class="toctree-l2"><a class="reference internal" href="../database/">The LXD Dqlite database</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/lxc_show_info/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code> <code class="docutils literal notranslate"><span class="pre">show</span></code> and <code class="docutils literal notranslate"><span class="pre">info</span></code></a></li> <li class="toctree-l2"><a class="reference internal" href="../authentication/">Remote API authentication</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/authorization/">Remote API authorization</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/projects/">Instances grouping with projects</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/clusters/">Clusters</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/performance_tuning/">Performance tuning</a></li> <li class="toctree-l2"><a class="reference internal" href="../explanation/security/">Security</a></li> </ul> </li> <li class="toctree-l1 has-children"><a class="reference internal" href="../reference/">Reference</a><input class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><div class="visually-hidden">Toggle navigation of Reference</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l2"><a class="reference internal" href="../requirements/">Requirements</a></li> <li class="toctree-l2"><a class="reference internal" href="../architectures/">Architectures</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/remote_image_servers/">Remote image servers</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/image_format/">Image format</a></li> <li class="toctree-l2"><a class="reference internal" href="../guest-os-compatibility/">Guest OS compatibility</a></li> <li class="toctree-l2"><a class="reference internal" href="../container-environment/">Container environment</a></li> <li class="toctree-l2"><a class="reference internal" href="../config-options/">Configuration option index</a></li> <li class="toctree-l2"><a class="reference internal" href="../server/">Server configuration</a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="../explanation/instance_config/">Instance configuration</a><input class="toctree-checkbox" id="toctree-checkbox-15" name="toctree-checkbox-15" role="switch" type="checkbox"/><label for="toctree-checkbox-15"><div class="visually-hidden">Toggle navigation of Instance configuration</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../reference/instance_properties/">Instance properties</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/instance_options/">Instance options</a></li> <li class="toctree-l3 has-children"><a class="reference internal" href="../reference/devices/">Devices</a><input class="toctree-checkbox" id="toctree-checkbox-16" name="toctree-checkbox-16" role="switch" type="checkbox"/><label for="toctree-checkbox-16"><div class="visually-hidden">Toggle navigation of Devices</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l4"><a class="reference internal" href="../reference/standard_devices/">Standard devices</a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_none/">Type: <code class="docutils literal notranslate"><span class="pre">none</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_nic/">Type: <code class="docutils literal notranslate"><span class="pre">nic</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_disk/">Type: <code class="docutils literal notranslate"><span class="pre">disk</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_unix_char/">Type: <code class="docutils literal notranslate"><span class="pre">unix-char</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_unix_block/">Type: <code class="docutils literal notranslate"><span class="pre">unix-block</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_usb/">Type: <code class="docutils literal notranslate"><span class="pre">usb</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_gpu/">Type: <code class="docutils literal notranslate"><span class="pre">gpu</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_infiniband/">Type: <code class="docutils literal notranslate"><span class="pre">infiniband</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_proxy/">Type: <code class="docutils literal notranslate"><span class="pre">proxy</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_unix_hotplug/">Type: <code class="docutils literal notranslate"><span class="pre">unix-hotplug</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_tpm/">Type: <code class="docutils literal notranslate"><span class="pre">tpm</span></code></a></li> <li class="toctree-l4"><a class="reference internal" href="../reference/devices_pci/">Type: <code class="docutils literal notranslate"><span class="pre">pci</span></code></a></li> </ul> </li> <li class="toctree-l3"><a class="reference internal" href="../reference/instance_units/">Units for storage and network limits</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="../reference/preseed_yaml_fields/">Preseed YAML file fields</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/projects/">Project configuration</a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="../reference/storage_drivers/">Storage drivers</a><input class="toctree-checkbox" id="toctree-checkbox-17" name="toctree-checkbox-17" role="switch" type="checkbox"/><label for="toctree-checkbox-17"><div class="visually-hidden">Toggle navigation of Storage drivers</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_btrfs/">Btrfs - <code class="docutils literal notranslate"><span class="pre">btrfs</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_cephfs/">CephFS - <code class="docutils literal notranslate"><span class="pre">cephfs</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_cephobject/">Ceph Object - <code class="docutils literal notranslate"><span class="pre">cephobject</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_ceph/">Ceph RBD - <code class="docutils literal notranslate"><span class="pre">ceph</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_powerflex/">Dell PowerFlex - <code class="docutils literal notranslate"><span class="pre">powerflex</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_pure/">Pure Storage - <code class="docutils literal notranslate"><span class="pre">pure</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_dir/">Directory - <code class="docutils literal notranslate"><span class="pre">dir</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_lvm/">LVM - <code class="docutils literal notranslate"><span class="pre">lvm</span></code></a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/storage_zfs/">ZFS - <code class="docutils literal notranslate"><span class="pre">zfs</span></code></a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../reference/networks/">Networks</a><input class="toctree-checkbox" id="toctree-checkbox-18" name="toctree-checkbox-18" role="switch" type="checkbox"/><label for="toctree-checkbox-18"><div class="visually-hidden">Toggle navigation of Networks</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../reference/network_bridge/">Bridge network</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/network_ovn/">OVN network</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/network_macvlan/">Macvlan network</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/network_physical/">Physical network</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/network_sriov/">SR-IOV network</a></li> </ul> </li> <li class="toctree-l2"><a class="reference internal" href="../reference/cluster_member_config/">Cluster configuration</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/server_settings/">Production server settings</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/provided_metrics/">Provided metrics</a></li> <li class="toctree-l2"><a class="reference internal" href="../reference/permissions/">Permissions</a></li> <li class="toctree-l2 has-children"><a class="reference internal" href="../restapi_landing/">REST API</a><input class="toctree-checkbox" id="toctree-checkbox-19" name="toctree-checkbox-19" role="switch" type="checkbox"/><label for="toctree-checkbox-19"><div class="visually-hidden">Toggle navigation of REST API</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../rest-api/">Main API documentation</a></li> <li class="toctree-l3"><a class="reference internal" href="../api/">Main API specification</a></li> <li class="toctree-l3"><a class="reference internal" href="../api-extensions/">Main API extensions</a></li> <li class="toctree-l3"><a class="reference internal" href="../events/">Events API documentation</a></li> <li class="toctree-l3"><a class="reference internal" href="../dev-lxd/">Instance API</a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../reference/manpages/">Man pages</a><input class="toctree-checkbox" id="toctree-checkbox-20" name="toctree-checkbox-20" role="switch" type="checkbox"/><label for="toctree-checkbox-20"><div class="visually-hidden">Toggle navigation of Man pages</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../reference/manpages/lxc/"><code class="docutils literal notranslate"><span class="pre">lxc</span></code></a></li> </ul> </li> <li class="toctree-l2 has-children"><a class="reference internal" href="../internals/">Internals</a><input class="toctree-checkbox" id="toctree-checkbox-21" name="toctree-checkbox-21" role="switch" type="checkbox"/><label for="toctree-checkbox-21"><div class="visually-hidden">Toggle navigation of Internals</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul> <li class="toctree-l3"><a class="reference internal" href="../environment/">Environment variables</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/uefi_variables/">UEFI variables for VMs</a></li> <li class="toctree-l3"><a class="reference internal" href="../daemon-behavior/">Daemon behavior</a></li> <li class="toctree-l3"><a class="reference internal" href="../syscall-interception/">System call interception</a></li> <li class="toctree-l3"><a class="reference internal" href="../userns-idmap/">User namespace setup</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/ovn-internals/">OVN implementation</a></li> <li class="toctree-l3"><a class="reference internal" href="../reference/vm_live_migration_internals/">VM live migration implementation</a></li> </ul> </li> <li class="toctree-l2"><a class="reference external" href="https://github.com/canonical/lxd">Project repository</a></li> <li class="toctree-l2"><a class="reference external" href="https://images.lxd.canonical.com">Image server</a></li> </ul> </li> </ul> </div> </div> </div> </div> </aside> <div class="main"> <div class="content"> <div class="article-container"> <a href="#" class="back-to-top muted-link"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path> </svg> <span>Back to top</span> </a> <div class="content-icon-container"> <div class="view-this-page"> <a class="muted-link" href="../_sources/metrics.md.txt" title="View this page"> <svg><use href="#svg-eye"></use></svg> <span class="visually-hidden">View this page</span> </a> </div> <div class="theme-toggle-container theme-toggle-content"> <button class="theme-toggle"> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg> <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg> <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg> <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg> </button> </div> <label class="toc-overlay-icon toc-content-icon" for="__toc"> <div class="visually-hidden">Toggle table of contents sidebar</div> <i class="icon"><svg><use href="#svg-toc"></use></svg></i> </label> </div> <article role="main" id="furo-main-content"> <section id="how-to-monitor-metrics"> <span id="metrics"></span><h1>How to monitor metrics<a class="headerlink" href="#how-to-monitor-metrics" title="Link to this heading">¶</a></h1> <p class="youtube_link"> <a href="https://www.youtube.com/watch?v=EthK-8hm_fY" target="_blank"> <span title="LXD metrics with Prometheus and Grafana - YouTube" class="play_icon">▶</span> <span title="LXD metrics with Prometheus and Grafana - YouTube">Watch on YouTube</span> </a> </p><!-- Include start metrics intro --> <p>LXD collects metrics for all running instances as well as some internal metrics. These metrics cover the CPU, memory, network, disk and process usage. They are meant to be consumed by Prometheus, and you can use Grafana to display the metrics as graphs. See <a class="reference internal" href="../reference/provided_metrics/#provided-metrics"><span class="std std-ref">Provided metrics</span></a> for lists of available metrics and <a class="reference internal" href="../howto/grafana/#grafana"><span class="std std-ref">Set up a Grafana dashboard</span></a> for instructions on how to display the metrics in Grafana.</p> <!-- Include end metrics intro --> <p>In a cluster environment, LXD returns only the values for instances running on the server that is being accessed. Therefore, you must scrape each cluster member separately.</p> <p>The instance metrics are updated when calling the <code class="docutils literal notranslate"><span class="pre">/1.0/metrics</span></code> endpoint. To handle multiple scrapers, they are cached for 8 seconds. Fetching metrics is a relatively expensive operation for LXD to perform, so if the impact is too high, consider scraping at a higher than default interval.</p> <section id="query-the-raw-data"> <h2>Query the raw data<a class="headerlink" href="#query-the-raw-data" title="Link to this heading">¶</a></h2> <p>To view the raw data that LXD collects, use the <a class="reference internal" href="../reference/manpages/lxc/query/#lxc-query-md"><span class="std std-ref"><code class="docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">query</span></code></span></a> command to query the <code class="docutils literal notranslate"><span class="pre">/1.0/metrics</span></code> endpoint:</p> <div class="terminal docutils container"> <div class="input docutils container"> <code class="prompt docutils literal notranslate"><span class="pre">~$</span> </code><code class="command docutils literal notranslate"><span class="pre">lxc</span> <span class="pre">query</span> <span class="pre">/1.0/metrics</span></code></div> <code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_api_requests_completed_total</span> <span class="pre">The</span> <span class="pre">total</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">completed</span> <span class="pre">API</span> <span class="pre">requests.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_api_requests_completed_total</span> <span class="pre">counter</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="server",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="server",result="succeeded"}</span> <span class="pre">9</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="server",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="network",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="network",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="network",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="cluster_member",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="cluster_member",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="cluster_member",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="project",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="project",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="project",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="image",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="image",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="image",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="operation",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="operation",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="operation",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="storage_pool",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="storage_pool",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="storage_pool",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="warning",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="warning",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="warning",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="identity",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="identity",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="identity",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="profile",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="profile",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="profile",result="succeeded"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="instance",result="succeeded"}</span> <span class="pre">2</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="instance",result="error_server"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_completed_total{entity_type="instance",result="error_client"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_api_requests_ongoing</span> <span class="pre">The</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">API</span> <span class="pre">requests</span> <span class="pre">currently</span> <span class="pre">being</span> <span class="pre">handled.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_api_requests_ongoing</span> <span class="pre">gauge</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="server"}</span> <span class="pre">1</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="network"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="cluster_member"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="project"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="image"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="operation"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="storage_pool"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="warning"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="identity"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="profile"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_api_requests_ongoing{entity_type="instance"}</span> <span class="pre">0</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_cpu_effective_total</span> <span class="pre">The</span> <span class="pre">total</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">effective</span> <span class="pre">CPUs.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_cpu_effective_total</span> <span class="pre">gauge</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_cpu_effective_total{name="c",project="default",type="container"}</span> <span class="pre">8</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_cpu_seconds_total</span> <span class="pre">The</span> <span class="pre">total</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">CPU</span> <span class="pre">time</span> <span class="pre">used</span> <span class="pre">in</span> <span class="pre">seconds.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_cpu_seconds_total</span> <span class="pre">counter</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_cpu_seconds_total{cpu="0",mode="system",name="c",project="default",type="container"}</span> <span class="pre">1.53794</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_cpu_seconds_total{cpu="0",mode="user",name="c",project="default",type="container"}</span> <span class="pre">2.613658</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_disk_read_bytes_total</span> <span class="pre">The</span> <span class="pre">total</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">bytes</span> <span class="pre">read.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_disk_read_bytes_total</span> <span class="pre">counter</span></code><code class="output docutils literal notranslate"><span class="pre">lxd_disk_read_bytes_total{device="nvme0n1",name="c",project="default",type="container"}</span> <span class="pre">3.6151296e+07</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">HELP</span> <span class="pre">lxd_disk_reads_completed_total</span> <span class="pre">The</span> <span class="pre">total</span> <span class="pre">number</span> <span class="pre">of</span> <span class="pre">completed</span> <span class="pre">reads.</span></code><code class="output docutils literal notranslate"><span class="pre">#</span> <span class="pre">TYPE</span> <span class="pre">lxd_disk_reads_completed_total</span> <span class="pre">counter</span></code><code class="output docutils literal notranslate"><span class="pre">...</span></code></div> </section> <section id="set-up-prometheus"> <h2>Set up Prometheus<a class="headerlink" href="#set-up-prometheus" title="Link to this heading">¶</a></h2> <p>To gather and store the raw metrics, you should set up <a class="reference external" href="https://prometheus.io/">Prometheus</a>. You can then configure it to scrape the metrics through the metrics API endpoint.</p> <section id="expose-the-metrics-endpoint"> <h3>Expose the metrics endpoint<a class="headerlink" href="#expose-the-metrics-endpoint" title="Link to this heading">¶</a></h3> <p>To expose the <code class="docutils literal notranslate"><span class="pre">/1.0/metrics</span></code> API endpoint, you must set the address on which it should be available.</p> <p>To do so, you can set either the <a class="configref reference internal" href="../server/#server-core:core.metrics_address"><code class="docutils literal notranslate"><span class="pre">core.metrics_address</span></code></a> server configuration option or the <a class="configref reference internal" href="../server/#server-core:core.https_address"><code class="docutils literal notranslate"><span class="pre">core.https_address</span></code></a> server configuration option. The <code class="docutils literal notranslate"><span class="pre">core.metrics_address</span></code> option is intended for metrics only, while the <code class="docutils literal notranslate"><span class="pre">core.https_address</span></code> option exposes the full API. So if you want to use a different address for the metrics API than for the full API, or if you want to expose only the metrics endpoint but not the full API, you should set the <code class="docutils literal notranslate"><span class="pre">core.metrics_address</span></code> option.</p> <p>For example, to expose the full API on the <code class="docutils literal notranslate"><span class="pre">8443</span></code> port, enter the following command:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc config set core.https_address ":8443" </pre></div> </div> <p>To expose only the metrics API endpoint on the <code class="docutils literal notranslate"><span class="pre">8444</span></code> port, enter the following command:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc config set core.metrics_address ":8444" </pre></div> </div> <p>To expose only the metrics API endpoint on a specific IP address and port, enter a command similar to the following:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc config set core.metrics_address "192.0.2.101:8444" </pre></div> </div> </section> <section id="add-a-metrics-certificate-to-lxd"> <h3>Add a metrics certificate to LXD<a class="headerlink" href="#add-a-metrics-certificate-to-lxd" title="Link to this heading">¶</a></h3> <p>Authentication for the <code class="docutils literal notranslate"><span class="pre">/1.0/metrics</span></code> API endpoint is done through a metrics certificate. A metrics certificate (type <code class="docutils literal notranslate"><span class="pre">metrics</span></code>) is different from a client certificate (type <code class="docutils literal notranslate"><span class="pre">client</span></code>) in that it is meant for metrics only and doesn’t work for interaction with instances or any other LXD entities.</p> <p>To create a certificate, enter the following command:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 -sha384 -keyout metrics.key -nodes -out metrics.crt -days 3650 -subj "/CN=metrics.local" </pre></div> </div> <div class="admonition note"> <p class="admonition-title">Note</p> <p>The command requires OpenSSL version 1.1.0 or later.</p> </div> <p>Then add this certificate to the list of trusted clients, specifying the type as <code class="docutils literal notranslate"><span class="pre">metrics</span></code>:</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>lxc config trust add metrics.crt --type=metrics </pre></div> </div> <p>If requiring TLS client authentication isn’t possible in your environment, the <code class="docutils literal notranslate"><span class="pre">/1.0/metrics</span></code> API endpoint can be made available to unauthenticated clients. While not recommended, this might be acceptable if you have other controls in place to restrict who can reach that API endpoint. To disable the authentication on the metrics API:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Disable authentication (NOT RECOMMENDED)</span> lxc<span class="w"> </span>config<span class="w"> </span><span class="nb">set</span><span class="w"> </span>core.metrics_authentication<span class="w"> </span><span class="nb">false</span> </pre></div> </div> </section> <section id="make-the-metrics-certificate-available-for-prometheus"> <h3>Make the metrics certificate available for Prometheus<a class="headerlink" href="#make-the-metrics-certificate-available-for-prometheus" title="Link to this heading">¶</a></h3> <p>If you run Prometheus on a different machine than your LXD server, you must copy the required certificates to the Prometheus machine:</p> <ul class="simple"> <li><p>The metrics certificate (<code class="docutils literal notranslate"><span class="pre">metrics.crt</span></code>) and key (<code class="docutils literal notranslate"><span class="pre">metrics.key</span></code>) that you created</p></li> <li><p>The LXD server certificate (<code class="docutils literal notranslate"><span class="pre">server.crt</span></code>) located in <code class="docutils literal notranslate"><span class="pre">/var/snap/lxd/common/lxd/</span></code> (if you are using the snap) or <code class="docutils literal notranslate"><span class="pre">/var/lib/lxd/</span></code> (otherwise)</p></li> </ul> <p>Copy these files into a <code class="docutils literal notranslate"><span class="pre">tls</span></code> directory that is accessible to Prometheus, for example, <code class="docutils literal notranslate"><span class="pre">/var/snap/prometheus/common/tls</span></code> (if you are using the snap) or <code class="docutils literal notranslate"><span class="pre">/etc/prometheus/tls</span></code> (otherwise). See the following example commands:</p> <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># Create tls directory</span> mkdir<span class="w"> </span>/var/snap/prometheus/common/tls <span class="c1"># Copy newly created certificate and key to tls directory</span> cp<span class="w"> </span>metrics.crt<span class="w"> </span>metrics.key<span class="w"> </span>/var/snap/prometheus/common/tls/ <span class="c1"># Copy LXD server certificate to tls directory</span> cp<span class="w"> </span>/var/snap/lxd/common/lxd/server.crt<span class="w"> </span>/var/snap/prometheus/common/tls/ <span class="c1"># Create a symbolic link pointing to tls directory that you created</span> <span class="c1"># https://bugs.launchpad.net/prometheus-snap/+bug/2066910</span> ln<span class="w"> </span>-s<span class="w"> </span>/var/snap/prometheus/common/tls/<span class="w"> </span>/var/snap/prometheus/current/tls </pre></div> </div> <p>If you are not using the snap, you must also make sure that Prometheus can read these files (usually, Prometheus is run as user <code class="docutils literal notranslate"><span class="pre">prometheus</span></code>):</p> <div class="highlight-none notranslate"><div class="highlight"><pre><span></span>chown -R prometheus:prometheus /etc/prometheus/tls </pre></div> </div> </section> <section id="configure-prometheus-to-scrape-from-lxd"> <h3>Configure Prometheus to scrape from LXD<a class="headerlink" href="#configure-prometheus-to-scrape-from-lxd" title="Link to this heading">¶</a></h3> <p>Finally, you must add LXD as a target to the Prometheus configuration.</p> <p>To do so, edit <code class="docutils literal notranslate"><span class="pre">/var/snap/prometheus/current/prometheus.yml</span></code> (if you are using the snap) or <code class="docutils literal notranslate"><span class="pre">/etc/prometheus/prometheus.yaml</span></code> (otherwise) and add a job for LXD.</p> <p>Here’s what the configuration needs to look like:</p> <div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">global</span><span class="p">:</span> <span class="w"> </span><span class="c1"># How frequently to scrape targets by default. The Prometheus default value is 1m.</span> <span class="w"> </span><span class="nt">scrape_interval</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">15s</span> <span class="nt">scrape_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lxd</span> <span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="s">'/1.0/metrics'</span> <span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="s">'https'</span> <span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'foo.example.com:8443'</span><span class="p p-Indicator">]</span> <span class="w"> </span><span class="nt">tls_config</span><span class="p">:</span> <span class="w"> </span><span class="nt">ca_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/server.crt'</span> <span class="w"> </span><span class="nt">cert_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.crt'</span> <span class="w"> </span><span class="nt">key_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.key'</span> <span class="w"> </span><span class="c1"># XXX: server_name is required if the target name</span> <span class="w"> </span><span class="c1"># is not covered by the certificate (not in the SAN list)</span> <span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="s">'foo'</span> </pre></div> </div> <div class="admonition note"> <p class="admonition-title">Note</p> <ul> <li><p>By default, the Grafana Prometheus data source assumes the <code class="docutils literal notranslate"><span class="pre">scrape_interval</span></code> to be 15 seconds. If you decide to use a different <code class="docutils literal notranslate"><span class="pre">scrape_interval</span></code> value, you must change it in both the Prometheus configuration and the Grafana Prometheus data source configuration. Otherwise, the Grafana <code class="docutils literal notranslate"><span class="pre">$__rate_interval</span></code> value will be calculated incorrectly, which might cause a <code class="docutils literal notranslate"><span class="pre">no</span> <span class="pre">data</span></code> response in queries that use it.</p></li> <li><p>The <code class="docutils literal notranslate"><span class="pre">server_name</span></code> must be specified if the LXD server certificate does not contain the same host name as used in the <code class="docutils literal notranslate"><span class="pre">targets</span></code> list. To verify this, open <code class="docutils literal notranslate"><span class="pre">server.crt</span></code> and check the Subject Alternative Name (SAN) section.</p> <p>For example, assume that <code class="docutils literal notranslate"><span class="pre">server.crt</span></code> has the following content:</p> <div class="terminal docutils container"> <div class="input docutils container"> <code class="prompt docutils literal notranslate"><span class="pre">~$</span> </code><code class="command docutils literal notranslate"><span class="pre">openssl</span> <span class="pre">x509</span> <span class="pre">-noout</span> <span class="pre">-text</span> <span class="pre">-in</span> <span class="pre">/var/snap/prometheus/common/tls/server.crt</span></code></div> <code class="output docutils literal notranslate"><span class="pre">...</span></code><code class="output docutils literal notranslate">            <span class="pre">X509v3</span> <span class="pre">Subject</span> <span class="pre">Alternative</span> <span class="pre">Name:</span></code><code class="output docutils literal notranslate">                <span class="pre">DNS:foo,</span> <span class="pre">IP</span> <span class="pre">Address:127.0.0.1,</span> <span class="pre">IP</span> <span class="pre">Address:0:0:0:0:0:0:0:1</span></code><code class="output docutils literal notranslate"><span class="pre">...</span></code></div> <p>Since the Subject Alternative Name (SAN) list doesn’t include the host name provided in the <code class="docutils literal notranslate"><span class="pre">targets</span></code> list (<code class="docutils literal notranslate"><span class="pre">foo.example.com</span></code>), you must override the name used for comparison using the <code class="docutils literal notranslate"><span class="pre">server_name</span></code> directive.</p> </li> </ul> </div> <p>Here is an example of a <code class="docutils literal notranslate"><span class="pre">prometheus.yml</span></code> configuration where multiple jobs are used to scrape the metrics of multiple LXD servers:</p> <div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="nt">global</span><span class="p">:</span> <span class="w"> </span><span class="c1"># How frequently to scrape targets by default. The Prometheus default value is 1m.</span> <span class="w"> </span><span class="nt">scrape_interval</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">15s</span> <span class="nt">scrape_configs</span><span class="p">:</span> <span class="w"> </span><span class="c1"># abydos, langara and orilla are part of a single cluster (called `hdc` here)</span> <span class="w"> </span><span class="c1"># initially bootstrapped by abydos which is why all 3 targets</span> <span class="w"> </span><span class="c1"># share the same `ca_file` and `server_name`. That `ca_file` corresponds</span> <span class="w"> </span><span class="c1"># to the `/var/snap/lxd/common/lxd/cluster.crt` file found on every member of</span> <span class="w"> </span><span class="c1"># the LXD cluster.</span> <span class="w"> </span><span class="c1">#</span> <span class="w"> </span><span class="c1"># Note: the `project` param is are provided when not using the `default` project</span> <span class="w"> </span><span class="c1"># or when multiple projects are used.</span> <span class="w"> </span><span class="c1">#</span> <span class="w"> </span><span class="c1"># Note: each member of the cluster only provide metrics for instances it runs locally</span> <span class="w"> </span><span class="c1"># this is why the `lxd-hdc` cluster lists 3 targets</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="s">"lxd-hdc"</span> <span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="s">'/1.0/metrics'</span> <span class="w"> </span><span class="nt">params</span><span class="p">:</span> <span class="w"> </span><span class="nt">project</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'jdoe'</span><span class="p p-Indicator">]</span> <span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="s">'https'</span> <span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="s">'abydos.hosts.example.net:8444'</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="s">'langara.hosts.example.net:8444'</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="s">'orilla.hosts.example.net:8444'</span> <span class="w"> </span><span class="nt">tls_config</span><span class="p">:</span> <span class="w"> </span><span class="nt">ca_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/abydos.crt'</span> <span class="w"> </span><span class="nt">cert_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.crt'</span> <span class="w"> </span><span class="nt">key_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.key'</span> <span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="s">'abydos'</span> <span class="w"> </span><span class="c1"># jupiter, mars and saturn are 3 standalone LXD servers.</span> <span class="w"> </span><span class="c1"># Note: only the `default` project is used on them, so it is not specified.</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="s">"lxd-jupiter"</span> <span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="s">'/1.0/metrics'</span> <span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="s">'https'</span> <span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'jupiter.example.com:9101'</span><span class="p p-Indicator">]</span> <span class="w"> </span><span class="nt">tls_config</span><span class="p">:</span> <span class="w"> </span><span class="nt">ca_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/jupiter.crt'</span> <span class="w"> </span><span class="nt">cert_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.crt'</span> <span class="w"> </span><span class="nt">key_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.key'</span> <span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="s">'jupiter'</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="s">"lxd-mars"</span> <span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="s">'/1.0/metrics'</span> <span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="s">'https'</span> <span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'mars.example.com:9101'</span><span class="p p-Indicator">]</span> <span class="w"> </span><span class="nt">tls_config</span><span class="p">:</span> <span class="w"> </span><span class="nt">ca_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/mars.crt'</span> <span class="w"> </span><span class="nt">cert_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.crt'</span> <span class="w"> </span><span class="nt">key_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.key'</span> <span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="s">'mars'</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">job_name</span><span class="p">:</span><span class="w"> </span><span class="s">"lxd-saturn"</span> <span class="w"> </span><span class="nt">metrics_path</span><span class="p">:</span><span class="w"> </span><span class="s">'/1.0/metrics'</span> <span class="w"> </span><span class="nt">scheme</span><span class="p">:</span><span class="w"> </span><span class="s">'https'</span> <span class="w"> </span><span class="nt">static_configs</span><span class="p">:</span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">targets</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'saturn.example.com:9101'</span><span class="p p-Indicator">]</span> <span class="w"> </span><span class="nt">tls_config</span><span class="p">:</span> <span class="w"> </span><span class="nt">ca_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/saturn.crt'</span> <span class="w"> </span><span class="nt">cert_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.crt'</span> <span class="w"> </span><span class="nt">key_file</span><span class="p">:</span><span class="w"> </span><span class="s">'tls/metrics.key'</span> <span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="s">'saturn'</span> </pre></div> </div> <p>After editing the configuration, restart Prometheus (<code class="docutils literal notranslate"><span class="pre">snap</span> <span class="pre">restart</span> <span class="pre">prometheus</span></code> if using the snap, otherwise <code class="docutils literal notranslate"><span class="pre">systemctl</span> <span class="pre">restart</span> <span class="pre">prometheus</span></code>) to start scraping.</p> </section> </section> </section> </article> </div> <footer> <div class="related-pages"> <a class="next-page" href="../howto/logs_loki/"> <div class="page-info"> <div class="context"> <span>Next</span> </div> <div class="title">How to send logs to Loki</div> </div> <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> </a> <a class="prev-page" href="../howto/network_increase_bandwidth/"> <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg> <div class="page-info"> <div class="context"> <span>Previous</span> </div> <div class="title">How to increase the network bandwidth</div> </div> </a> </div> <div class="bottom-of-page"> <div class="left-details"> <div class="copyright"> Copyright © 2014-2025 LXD contributors </div> <div class="last-updated"> Last updated on Mar 28, 2025</div> <div class="show-source"> <a class="muted-link" href="../_sources/metrics.md.txt" rel="nofollow">Show source</a> </div> </div> <div> <a class="display-contributors">Thanks to the 14 contributors!</a> <div id="overlay"></div> <ul class="all-contributors"> <li> <a href="https://github.com/canonical/lxd/commit/007cca12ed9a5f19e89390899cb92c2da148c9d3" class="contributor">Daniel Vos</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/15689a991007037165e18fa2c8a1b62474f278a9" class="contributor">Eric Gelinas</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/675995fa97b3b5769a0cae79f0cfef0d4cc1b0b4" class="contributor">Hiroaki Nakamura</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/883bf5b557e9662959eda1d812310961d15b915a" class="contributor">JohnHammell</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/b15618883058d334807ab0c35502928cd03d8947" class="contributor">Kadin Sayani</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/8f2f29b51feeec0830c031df03d8223d7f22ee62" class="contributor">Minae Lee</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/6e575422146211376d50696a31c05a54a82c76d6" class="contributor">Ruth Fuchss</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/712f119d62605a965e8dc519f0af44a8151da3b7" class="contributor">Simon Deziel</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/715a39ecefebe6a2da2e8f19e629f2e644259d8a" class="contributor">Stéphane Graber</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/96341679af25f784e8bf499001026713c5611454" class="contributor">Thomas Hipp</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/7afe58be954fcca56ade7dae17e497206dd5b957" class="contributor">Tom Parrott</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/7cb5d1dcd128563cb8febf32a741e243447d9469" class="contributor">hamistao</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/e54e9fd6fdb6c1c283b1802b469a10edc1f76c9d" class="contributor">jalbstmeijer</a> </li> <li> <a href="https://github.com/canonical/lxd/commit/2258ce0cc5c4827ba35592f6e70b56d85e944110" class="contributor">pmarini</a> </li> </ul> </div> <div class="right-details"> <div class="ask-discourse"> <a class="muted-link" href="https://discourse.ubuntu.com/c/lxd/">Ask a question on Discourse</a> </div> <div class="ask-matrix"> <a class="muted-link" href="https://matrix.to/#/#documentation:ubuntu.com">Ask a question on Matrix</a> </div> <div class="issue-github"> <a class="muted-link" href="https://github.com/canonical/lxd/issues/new?title=doc%3A+ADD+A+TITLE&body=DESCRIBE+THE+ISSUE%0A%0A---%0ADocument: metrics.md">Open a GitHub issue for this page</a> </div> <div class="edit-github"> <a class="muted-link" href="https://github.com/canonical/lxd/edit/main/doc/metrics.md">Edit this page on GitHub</a> </div> </div> </div> </div> </footer> </div> <aside class="toc-drawer"> <div class="toc-sticky toc-scroll"> <div class="toc-title-container"> <span class="toc-title"> Contents </span> </div> <div class="toc-tree-container"> <div class="toc-tree"> <ul> <li><a class="reference internal" href="#">How to monitor metrics</a><ul> <li><a class="reference internal" href="#query-the-raw-data">Query the raw data</a></li> <li><a class="reference internal" href="#set-up-prometheus">Set up Prometheus</a><ul> <li><a class="reference internal" href="#expose-the-metrics-endpoint">Expose the metrics endpoint</a></li> <li><a class="reference internal" href="#add-a-metrics-certificate-to-lxd">Add a metrics certificate to LXD</a></li> <li><a class="reference internal" href="#make-the-metrics-certificate-available-for-prometheus">Make the metrics certificate available for Prometheus</a></li> <li><a class="reference internal" href="#configure-prometheus-to-scrape-from-lxd">Configure Prometheus to scrape from LXD</a></li> </ul> </li> </ul> </li> </ul> </div> </div> <div class="relatedlinks-title-container"> <span class="relatedlinks-title"> Related links </span> </div> <div class="relatedlinks-container"> <div class="relatedlinks"> <ul><li><a href="https://discuss.linuxcontainers.org/t/12281" target="_blank">Retrieve LXD metrics with Telegraf and InfluxDB 2.x</a></li><li><a href="https://discuss.linuxcontainers.org/t/11735" target="_blank">Metric exporter for instances</a></li></ul> </div> </div> </div> </aside> </div> </div><script src="../_static/jquery.js?v=5d32c60e"></script> <script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> <script src="../_static/documentation_options.js?v=187304be"></script> <script src="../_static/doctools.js?v=9bcbadda"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <script src="../_static/scripts/furo.js?v=5fa4622c"></script> <script src="../_static/clipboard.min.js?v=a7894cd8"></script> <script src="../_static/copybutton.js?v=f281be69"></script> <script src="../_static/config-options.js"></script> <script src="../_static/design-tabs.js?v=f930bc37"></script> <script src="../_static/header-nav.js?v=e117ad08"></script> <script src="../_static/footer.js?v=5acea47a"></script> <script src="../_static/github_issue_links.js?v=32bb732f"></script> <script> const github_url = "https://github.com/canonical/lxd"; </script> </body> </html>
Close