{"id":14996,"date":"2023-10-30T12:43:23","date_gmt":"2023-10-30T19:43:23","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=14996"},"modified":"2023-12-18T12:31:06","modified_gmt":"2023-12-18T20:31:06","slug":"scraping-database-metrics-from-couchbase-capella-with-prometheus","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/","title":{"rendered":"Scraping Database Metrics from Couchbase Capella with Prometheus"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">In this blog post, the first in a series, we&#8217;re going to show you how to set up a Prometheus server and connect it to your Couchbase Capella Database in order to collect metrics.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">What is Prometheus?<\/span><\/h2>\n<p><a href=\"https:\/\/prometheus.io\/\"><span style=\"font-weight: 400;\">Prometheus<\/span><\/a><span style=\"font-weight: 400;\"> is a very popular open-source systems monitoring and alerting toolkit, with a very active developer and user community. It was originally built at <\/span><a href=\"https:\/\/soundcloud.com\/\"><span style=\"font-weight: 400;\">SoundCloud<\/span><\/a><span style=\"font-weight: 400;\">, but is now a standalone open source project, maintained independently of any company, and it joined the <\/span><a href=\"https:\/\/cncf.io\/\"><span style=\"font-weight: 400;\">Cloud Native Computing Foundation<\/span><\/a><span style=\"font-weight: 400;\"> in 2016 as the second hosted project, after <\/span><a href=\"https:\/\/kubernetes.io\/\"><span style=\"font-weight: 400;\">Kubernetes<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">What is Couchbase Capella?<\/span><\/h2>\n<p><a href=\"https:\/\/cloud.couchbase.com\/\"><span style=\"font-weight: 400;\">Couchbase Capella<\/span><\/a><span style=\"font-weight: 400;\"> is our fully-managed Database as a Service (DBaaS) offering, the easiest and fastest way to begin with Couchbase and to eliminate ongoing database management efforts. Your Capella Database contains a native Prometheus scrape target, allowing you to connect your Prometheus (or Prometheus-compatible) monitoring systems to collect metrics.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Prerequisites<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To follow the steps in this guide, you&#8217;ll need a working Docker installation (which we&#8217;ll use to deploy Prometheus), a Capella Database, and some common shell utilities.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">Note: It is outside of the scope of this post to show how to install and configure <\/span><\/i><a href=\"https:\/\/www.docker.com\/\"><i><span style=\"font-weight: 400;\">Docker<\/span><\/i><\/a><i><span style=\"font-weight: 400;\">. There are many tutorials out there, including Docker&#8217;s own <\/span><\/i><a href=\"https:\/\/www.docker.com\/get-started\/\"><i><span style=\"font-weight: 400;\">Get Started with Docker<\/span><\/i><\/a><i><span style=\"font-weight: 400;\">. We&#8217;ll assume at this point that you have successfully installed and tested it (with e.g. <\/span><\/i><a href=\"https:\/\/hub.docker.com\/_\/hello-world\"><i><span style=\"font-weight: 400;\">Hello, World!<\/span><\/i><\/a><i><span style=\"font-weight: 400;\">).<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">At the time of writing, the latest version of Prometheus was 2.46. The steps here were carried out using Rancher Desktop 1.9.1, with the Container Engine set to dockerd (moby), and using the provided docker CLI. The expectation is that the steps should work as is on any current Docker installation, or an equivalent stack such as containerd with the nerdctl CLI.<\/span><\/i><\/p>\n<p><i><span style=\"font-weight: 400;\">Lastly, the commands shared here are suitable for short-lived, standalone development environments &#8211; you should of course follow your local best practices for networking and security where appropriate.<\/span><\/i><\/p>\n<h2><span style=\"font-weight: 400;\">Running a Prometheus Server in Docker<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Let&#8217;s just jump right in and run the latest Prometheus container (<\/span><a href=\"https:\/\/hub.docker.com\/r\/prom\/prometheus\"><span style=\"font-weight: 400;\">prom\/prometheus<\/span><\/a><span style=\"font-weight: 400;\">) with its default settings.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The <\/span><span style=\"font-weight: 400;\">docker run<\/span><span style=\"font-weight: 400;\"> command has many options, but for this example we&#8217;ll just use a <\/span><span style=\"font-weight: 400;\"><em>-p<\/em> \/ <em>&#8211;publish<\/em><\/span><span style=\"font-weight: 400;\"> to expose the Prometheus port (which defaults to <em>9090<\/em>) so that we can access it from our local browser, and an <\/span><em><span style=\"font-weight: 400;\">&#8211;rm<\/span><\/em><span style=\"font-weight: 400;\"> to make sure that the container is cleaned up when it exits.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">By default the running container will remain &#8220;attached&#8221;, streaming the logs to Standard Output (in this case, your terminal). Let&#8217;s do that for the first run so we can make sure it starts up correctly:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true\">docker run --rm --publish 9090:9090 prom\/prometheus<\/pre>\n<p><span style=\"font-weight: 400;\">Unless you see any errors in the console output, you should now have a Prometheus server running at <\/span><a href=\"https:\/\/localhost:9090\/\"><span style=\"font-weight: 400;\"><em>https:\/\/localhost:9090\/<\/em><\/span><\/a><span style=\"font-weight: 400;\">. Open it up in a browser window, and you should see something like this:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/01.Prometheus.Console.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14999\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/01.Prometheus.Console-1024x260.png\" alt=\"\" width=\"900\" height=\"229\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-1024x260.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-300x76.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-768x195.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-1536x390.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-2048x520.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/01.Prometheus.Console-1320x335.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Now go back to your terminal window and hit <em>Ctrl+C<\/em> to kill the running container, then we&#8217;ll start it again, but this time using a <\/span><span style=\"font-weight: 400;\"><em>-d<\/em> \/ <em>&#8211;detach<\/em><\/span><span style=\"font-weight: 400;\"> to background it and free up our terminal:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker run --detach --rm --publish 9090:9090 prom\/prometheus<\/pre>\n<p><span style=\"font-weight: 400;\">On success, Docker will print out the Container ID, and you can also find it with <\/span><span style=\"font-weight: 400;\"><em>docker ps<\/em>.<\/span><span style=\"font-weight: 400;\">\u00a0As you&#8217;ll need it for some of the later steps anyway, let&#8217;s filter (with <\/span><span style=\"font-weight: 400;\"><em>-f<\/em> \/<em> &#8211;filter<\/em><\/span><span style=\"font-weight: 400;\">) the output of <\/span><em><span style=\"font-weight: 400;\">docker ps<\/span><\/em><span style=\"font-weight: 400;\"> to show just the container ID that we want, based on the network ports that we&#8217;re using (in this case we&#8217;re publishing port <em>9090<\/em>):<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker ps --filter publish=9090<\/pre>\n<p><span style=\"font-weight: 400;\">We can add a <\/span><span style=\"font-weight: 400;\"><em>-q<\/em> \/<em> &#8211;quiet<\/em><\/span><span style=\"font-weight: 400;\"> to <\/span><i><span style=\"font-weight: 400;\">only<\/span><\/i><span style=\"font-weight: 400;\"> output the Container ID, and use the result in another command. For example, to view the logs of the Prometheus container you just started:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker logs $(docker ps --quiet --filter publish=9090)<\/pre>\n<p><span style=\"font-weight: 400;\">That command will output something similar to when you started the Prometheus server the first time, when the container was still attached to the terminal. You can use the same technique with (for example) <\/span><em><span style=\"font-weight: 400;\">docker exec<\/span><\/em><span style=\"font-weight: 400;\"> (if you want to start a shell in a running container), or <\/span><em><span style=\"font-weight: 400;\">docker kill<\/span><\/em><span style=\"font-weight: 400;\"> (to send a signal to the container).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s take a deeper look at the Prometheus server you have running on <\/span><em><a href=\"https:\/\/localhost:9090\/\"><span style=\"font-weight: 400;\">https:\/\/localhost:9090\/<\/span><\/a><\/em><span style=\"font-weight: 400;\">. If you navigate to <strong>Status -&gt; Targets<\/strong>, you can see that there is already a job running:<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/02.Prometheus.Targets.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15000\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/02.Prometheus.Targets-1024x208.png\" alt=\"\" width=\"900\" height=\"183\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-1024x208.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-300x61.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-768x156.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-1536x312.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-2048x417.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/02.Prometheus.Targets-1320x268.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/span><\/p>\n<p><span style=\"font-weight: 400;\">This Prometheus server has been configured to scrape <\/span><i><span style=\"font-weight: 400;\">itself<\/span><\/i><span style=\"font-weight: 400;\"> as a target, which you can confirm by viewing its configuration (<strong>Status -&gt; Configuration<\/strong>):<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/03.Prometheus.Config.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15001\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/03.Prometheus.Config-1024x417.png\" alt=\"\" width=\"900\" height=\"367\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-1024x417.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-300x122.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-768x312.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-1536x625.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-2048x833.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/03.Prometheus.Config-1320x537.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">You can see in the above that there is a job named <\/span><em><span style=\"font-weight: 400;\">prometheus<\/span><\/em><span style=\"font-weight: 400;\">, which is targeting <\/span><em><span style=\"font-weight: 400;\">localhost:9090\/metrics<\/span><\/em><span style=\"font-weight: 400;\"> (<\/span><em><span style=\"font-weight: 400;\">targets + metrics_path<\/span><\/em><span style=\"font-weight: 400;\">). See <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/getting_started\/#configuring-prometheus-to-monitor-itself\"><span style=\"font-weight: 400;\">Configuring Prometheus to monitor itself<\/span><\/a><span style=\"font-weight: 400;\"> for a sample configuration.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Before we go back to our terminal, let&#8217;s take a quick look at metrics being scraped in the above job. If you click on Graph, you&#8217;ll find the <\/span><a href=\"https:\/\/prometheus.io\/docs\/visualization\/browser\/\"><span style=\"font-weight: 400;\">Expression Browser<\/span><\/a><span style=\"font-weight: 400;\">, which allows you to enter PromQL expressions (see <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/querying\/basics\/\"><span style=\"font-weight: 400;\">Querying Prometheus<\/span><\/a><span style=\"font-weight: 400;\"> for an overview), and view the results.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Note the <strong>Expression Browser<\/strong> is only meant for adhoc usage &#8211; the recommendation is to use <\/span><a href=\"https:\/\/prometheus.io\/docs\/visualization\/grafana\/\"><span style=\"font-weight: 400;\">Grafana<\/span><\/a><span style=\"font-weight: 400;\"> as a fully-fledged graphing solution, and we&#8217;ll look at that in a future post. In the meantime, as a quick example, this is the number of time series currently stored in its own database (<\/span><em><span style=\"font-weight: 400;\">prometheus_tsdb_head_series<\/span><\/em><span style=\"font-weight: 400;\">):<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/04.Prometheus.Graphs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15002\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/04.Prometheus.Graphs-1024x590.png\" alt=\"\" width=\"900\" height=\"519\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-1024x590.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-300x173.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-768x443.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-1536x885.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-2048x1180.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/04.Prometheus.Graphs-1320x761.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">If we want to add our Capella Database as a Scrape Job in our Prometheus server, this means we need to make changes to the configuration we saw above, but the configuration is baked into our container image. Once we have a final configuration we can rebuild the image, but for now it would be much more convenient if we could apply new configuration options and test without going to that much effort.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s make use of Docker&#8217;s<\/span><span style=\"font-weight: 400;\"><em> -v<\/em> \/ <em>&#8211;volume<\/em><\/span><span style=\"font-weight: 400;\"> option, which allows you to mount a local file or directory in the container. The Prometheus configuration file in the container is <\/span><em><span style=\"font-weight: 400;\">\/etc\/prometheus\/prometheus.yml<\/span><\/em><span style=\"font-weight: 400;\"> &#8211; if that was the only file we needed then we could simply mount the file directly, but we&#8217;ll need a few more than that so we&#8217;ll mount a directory instead.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In your working directory, create a sub-directory that we&#8217;ll use to keep our configuration (<\/span><em><span style=\"font-weight: 400;\">prometheus.yml<\/span><\/em><span style=\"font-weight: 400;\">) and other associated files.<\/span><\/p>\n<pre class=\"nums:false lang:miva decode:true \">mkdir prometheus<\/pre>\n<p><span style=\"font-weight: 400;\">Now we need a copy of the configuration file that we can work with. As always, there&#8217;s more than one way to do this, but by far the simplest is to use the <\/span><span style=\"font-weight: 400;\">docker cp<\/span><span style=\"font-weight: 400;\"> command, to copy <\/span><em><span style=\"font-weight: 400;\">\/etc\/prometheus\/prometheus.yml<\/span><\/em><span style=\"font-weight: 400;\"> from your running container, out to a local file:<\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">docker cp $(docker ps --quiet --filter publish=9090):\/etc\/prometheus\/prometheus.yml prometheus\/<\/pre>\n<p><span style=\"font-weight: 400;\">Now kill your currently-running container:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker kill $(docker ps --quiet --filter publish=9090)<\/pre>\n<p><span style=\"font-weight: 400;\">And then start a new container, this time mounting your local <\/span><em><span style=\"font-weight: 400;\">prometheus<\/span><\/em><span style=\"font-weight: 400;\"> directory as <\/span><em><span style=\"font-weight: 400;\">\/etc\/prometheus\/<\/span><\/em><span style=\"font-weight: 400;\"> in the container:<\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">docker run --detach --rm --publish 9090:9090 --volume $(pwd)\/prometheus\/:\/etc\/prometheus\/ prom\/prometheus<\/pre>\n<p><span style=\"font-weight: 400;\">If, like the author, you find yourself wondering how to tell if the Prometheus server is really using your copy of <\/span><em><span style=\"font-weight: 400;\">prometheus.yml<\/span><\/em><span style=\"font-weight: 400;\"> or not, you can check the mounts inside the container to make sure that <\/span><em><span style=\"font-weight: 400;\">\/etc\/prometheus\/ <\/span><\/em><span style=\"font-weight: 400;\">is specifically mounted with:<\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">docker exec $(docker ps --quiet --filter publish=9090) mount | grep '\/etc\/prometheus'<\/pre>\n<p><span style=\"font-weight: 400;\">You could also make a small change to the configuration (for example, the name of the existing scrape job), and this should be reflected in the console (at <\/span><a href=\"https:\/\/localhost:9090\/config\"><span style=\"font-weight: 400;\">https:\/\/localhost:9090\/config<\/span><\/a><span style=\"font-weight: 400;\">).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Lastly for this section, as we&#8217;ll be making a few changes to our configuration file, it would be good if we didn&#8217;t have to recreate the container to apply the changes. Prometheus does have a built-in API method for this, discussed in <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/\"><span style=\"font-weight: 400;\">Configuration<\/span><\/a><span style=\"font-weight: 400;\">, but the <\/span><em><span style=\"font-weight: 400;\">&#8211;web.enable-lifecycle<\/span><\/em><span style=\"font-weight: 400;\"> option is not enabled by default in the official container. Fortunately (for MacOS and Linux users at least), there is the option to send a SIGHUP with <\/span><em><span style=\"font-weight: 400;\">docker kill<\/span><\/em><span style=\"font-weight: 400;\"> (resulting in a &#8220;Loading configuration file&#8221; message in the logs):<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker kill --signal SIGHUP $(docker ps --quiet --filter publish=9090)<\/pre>\n<p><span style=\"font-weight: 400;\">In summary so far then, we now have a running Prometheus server, we know how to check its logs, browse the metrics that it is scraping, and how to update and reload its configuration, making it easy for us to add in our Capella Database as a scrape target.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Adding a Capella Database to your Prometheus Server<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Now we have a Prometheus server, let&#8217;s take a look at adding a Couchbase Capella database.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Prerequisites<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">For each database that you want to collect metrics from, you&#8217;re going to need:<\/span><\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">The Connection Hostname<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">User Credentials with the appropriate Database Access<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">A Security Certificate<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">One or more Allowed IP Addresses<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4><span style=\"font-weight: 400;\">Connection Hostname<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">This is the hostname from your Connection String. Go to the <\/span><strong>Connect<\/strong><span style=\"font-weight: 400;\"> tab on your Database in the Capella UI and copy everything after the <\/span><em><span style=\"font-weight: 400;\">couchbases:\/\/<\/span><\/em><span style=\"font-weight: 400;\"> scheme prefix. The one we&#8217;re using in our examples is: <\/span><span style=\"font-weight: 400;\"><em>cb.plmvshfqolmyxvpt.cloud.couchbase.com<\/em>.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">User Credentials<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">A set of credentials (<\/span><span style=\"font-weight: 400;\">username<\/span><span style=\"font-weight: 400;\">\/<\/span><span style=\"font-weight: 400;\">password<\/span><span style=\"font-weight: 400;\">) that has <\/span><i><span style=\"font-weight: 400;\">Read Access<\/span><\/i><span style=\"font-weight: 400;\"> to <\/span><i><span style=\"font-weight: 400;\">All Buckets<\/span><\/i><span style=\"font-weight: 400;\"> and <\/span><i><span style=\"font-weight: 400;\">All Scopes <\/span><\/i><span style=\"font-weight: 400;\">in your Database (as <\/span><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html#_footnoteref_1\"><span style=\"font-weight: 400;\">noted<\/span><\/a><span style=\"font-weight: 400;\">, the required <\/span><em><span style=\"font-weight: 400;\">external_stats_reader<\/span><\/em><span style=\"font-weight: 400;\"> role is only granted when a <\/span><span style=\"font-weight: 400;\">Database Credential is given Read Access to <\/span><i><span style=\"font-weight: 400;\">all<\/span><\/i><span style=\"font-weight: 400;\"> Buckets in a Database<\/span><span style=\"font-weight: 400;\">). If you don&#8217;t have one, you can create one from <strong>Settings -&gt; Database Access -&gt; Create Database Access<\/strong> (see <\/span><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/manage-database-users.html\"><span style=\"font-weight: 400;\">Configure Database Credentials<\/span><\/a><span style=\"font-weight: 400;\">). In our examples, we&#8217;ll use <\/span><em><span style=\"font-weight: 400;\">metrics_user<\/span><\/em><span style=\"font-weight: 400;\"> \/ <\/span><em><span style=\"font-weight: 400;\">metrics_Passw0rd<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Security Certificate<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">The Security Certificate for your Database. From your Database, go to <strong>Settings -&gt; Security Certificate<\/strong>, and click on Download. This will give you a PEM-formatted text file named after your cluster (in our case <\/span><em><span style=\"font-weight: 400;\">bravetimbernerslee-root-certificate.txt<\/span><\/em><span style=\"font-weight: 400;\">). Actually, the same signing certificate is used for all Capella Databases, so you only need to download it once, and can use the same Root Certificate to verify all your Capella Databases. To that end, we&#8217;ve renamed our local certificate file to <\/span><em><span style=\"font-weight: 400;\">couchbase-cloud-root-certificate.pem<\/span><\/em><span style=\"font-weight: 400;\"> for clarity, and copied into our <\/span><em><span style=\"font-weight: 400;\">prometheus<\/span><\/em><span style=\"font-weight: 400;\"> directory (in a subdirectory named <\/span><em><span style=\"font-weight: 400;\">certs<\/span><\/em><span style=\"font-weight: 400;\">) so that Prometheus can access it later.<\/span><\/p>\n<h4><span style=\"font-weight: 400;\">Allowed IP Addresses<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">Before any client can connect to a Capella Database, the client&#8217;s IP address must be added to the Database&#8217;s <\/span><a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/allow-ip-address.html\"><span style=\"font-weight: 400;\">Allowed IP list<\/span><\/a><span style=\"font-weight: 400;\">. For the purposes of following the steps here you most likely want to add your current IP address, in which case you can use the <strong>Add My IP<\/strong> button. For a production deployment you will need the public-facing IP address of your Prometheus server(s).<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Defining a new Scrape Config<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Let&#8217;s start by taking a look at the existing job, that tells Prometheus to scrape from itself.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If we ignore the global settings and defaults, it becomes the following:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true\">scrape_configs:\r\n\u00a0\u00a0- job_name: \"prometheus\"\r\n\r\n \u00a0\u00a0\u00a0static_configs:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0- targets: [\"localhost:9090\"]<\/pre>\n<p><span style=\"font-weight: 400;\">If you look at the documentation for <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/#scrape_config\"><span style=\"font-weight: 400;\">scrape_config<\/span><\/a><span style=\"font-weight: 400;\"> you can see that this is essentially the smallest possible definition of a job. There&#8217;s no TLS, no authentication, just a name and a single target (which with the defaults added becomes <\/span><em><span style=\"font-weight: 400;\">https:\/\/localhost:9090\/metrics<\/span><\/em><span style=\"font-weight: 400;\">).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As an aside, you can test this out if you&#8217;re interested by loading up that URL in your browser, or by using <\/span><em><span style=\"font-weight: 400;\">curl<\/span><\/em><span style=\"font-weight: 400;\"> on the CLI. The resulting output is in Prometheus&#8217; text-based <\/span><a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exposition_formats\/\"><span style=\"font-weight: 400;\">Exposition Format<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Our new job will need a name &#8211; this needs to be unique across all scrape definitions, which is worth bearing in mind if you&#8217;re planning on adding multiple Capella Databases. For our example we&#8217;ll use the unique component of our Connection Hostname to differentiate, giving us:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true \">- job_name: \"capella-plmvshfqolmyxvpt\"<\/pre>\n<p><span style=\"font-weight: 400;\">We know that we&#8217;ll need to authenticate to access the metrics endpoint, using the credentials above:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true\">basic_auth:\r\n\u00a0\u00a0username: \"metrics_user\"\r\n\u00a0\u00a0password: \"metrics_Passw0rd\"<\/pre>\n<p><span style=\"font-weight: 400;\">All Capella communication is encrypted with TLS, so we&#8217;ll need to add a <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/#tls_config\"><span style=\"font-weight: 400;\">tls_config<\/span><\/a><span style=\"font-weight: 400;\"> parameter using the certificate we downloaded earlier:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true\">tls_config:\r\n\u00a0\u00a0ca_file: \"certs\/couchbase-cloud-root-certificate.pem\"<\/pre>\n<p><span style=\"font-weight: 400;\">And relatedly, <\/span><span style=\"font-weight: 400;\">scheme<\/span><span style=\"font-weight: 400;\"> defaults to <\/span><span style=\"font-weight: 400;\">http<\/span><span style=\"font-weight: 400;\">, so we&#8217;ll need:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true \">scheme: https<\/pre>\n<p><span style=\"font-weight: 400;\">The last thing we need to do is tell Prometheus the hostname(s)\/address(es) to use to connect to your Database, otherwise known as <\/span><em><span style=\"font-weight: 400;\">targets<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In the <\/span><em><span style=\"font-weight: 400;\">prometheus<\/span><\/em><span style=\"font-weight: 400;\"> job above, a single hostname is provided using the <\/span><em><span style=\"font-weight: 400;\">static_config<\/span><\/em><span style=\"font-weight: 400;\"> parameter. As the name suggests, this is a way to statically define one or more <\/span><em><span style=\"font-weight: 400;\">targets<\/span><\/em><span style=\"font-weight: 400;\">, and these will not be updated or refreshed unless the Prometheus server is restarted, or its configuration file is reloaded.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is fine in this case, as the hostname (<\/span><em><span style=\"font-weight: 400;\">localhost<\/span><\/em><span style=\"font-weight: 400;\">) is never going to change. It might also be manageable if you have hostnames that change occasionally, and are only updated under controlled circumstances (for example a scheduled maintenance period where you can update your Prometheus configuration at the same time).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But what if your hostnames do change frequently, and the timing of those changes is out of your control?\u00a0 If the application you are monitoring is hosted in any kind of cloud environment, where there is on-demand scaling, server replacement on failure, automated upgrades, then you&#8217;ll need a much more flexible method of specifying your <\/span><em><span style=\"font-weight: 400;\">targets<\/span><\/em><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This is where Service Discovery comes in.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Service Discovery<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Prometheus Service Discovery (SD) is a mechanism that allows your Prometheus server to dynamically discover (and update) the list of targets to monitor for a particular application or service. At time of writing there are 28 different mechanisms, including generic options such as <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/#file_sd_config\"><span style=\"font-weight: 400;\">File-<\/span><\/a><span style=\"font-weight: 400;\"> and <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/#http_sd_config\"><span style=\"font-weight: 400;\">HTTP-based<\/span><\/a><span style=\"font-weight: 400;\"> Service Discovery, as well specific implementations for a large number of cloud platforms and applications (see the Prometheus <\/span><a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/\"><span style=\"font-weight: 400;\">configuration documentation<\/span><\/a><span style=\"font-weight: 400;\"> for the full list).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s look at those two generic options in relation to your Couchbase Capella Database.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">File-based Service Discovery<\/span><\/i><span style=\"font-weight: 400;\"> (<\/span><em><span style=\"font-weight: 400;\">file_sd_configs<\/span><\/em><span style=\"font-weight: 400;\">) is where one or more filenames are provided to Prometheus, each file containing zero or more <\/span><em><span style=\"font-weight: 400;\">static_config<\/span><\/em><span style=\"font-weight: 400;\"> entries. Prometheus will apply any well-formed <\/span><em><span style=\"font-weight: 400;\">targets<\/span><\/em><span style=\"font-weight: 400;\"> it finds in those files, and will automatically load any changes when the files are updated.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This mechanism is useful in that you can use it to connect to any arbitrary system, as long as you can get the host details into a correctly-formatted file (either manually or by any appropriate automation). However, you do need to make sure that the automation to update the file(s) is reliable.<\/span><\/p>\n<p><i><span style=\"font-weight: 400;\">HTTP-based Service Discovery<\/span><\/i><span style=\"font-weight: 400;\"> (<\/span><em><span style=\"font-weight: 400;\">http_sd_configs<\/span><\/em><span style=\"font-weight: 400;\">) is similar to File-based, in that it provides a generic interface, with a payload containing zero or more <\/span><em><span style=\"font-weight: 400;\">static_config<\/span><\/em><span style=\"font-weight: 400;\"> entries, but uses an HTTP connection to fetch the payload rather than reading a local file. This removes the dependency on any automation or human intervention, and as long as your target application provides the relevant API, would be preferred over the File-based option.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">At time of writing, we are in the process of upgrading the Capella estate from Couchbase Server 7.1 to 7.2 (see <a href=\"https:\/\/docs.couchbase.com\/cloud\/clusters\/upgrade-database.html\">Upgrading a Database<\/a> for more details). Server 7.1 only provides a basic File-based Service Discovery API, but in Server 7.2 we have added HTTP-based SD, as well as improved File-based SD.<\/span><\/p>\n<p>We&#8217;ll look first at the File-based Service Discovery method in Server 7.1. Feel free to skip ahead one section if you&#8217;re already running Server 7.2.<\/p>\n<h4>File-based Service Discovery in Couchbase Server 7.1<\/h4>\n<p><span style=\"font-weight: 400;\">The endpoint is <\/span><em><span style=\"font-weight: 400;\">prometheus_sd_config.yaml<\/span><\/em><span style=\"font-weight: 400;\">, you&#8217;ll need to authenticate with the same credentials as above, and provide the Capella Root Certificate we downloaded earlier.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First, we&#8217;ll just use <\/span><em><span style=\"font-weight: 400;\">curl<\/span><\/em><span style=\"font-weight: 400;\"> and stream the result to our terminal:<\/span><\/p>\n<pre class=\"nums:false wrap:true lang:sh decode:true\">curl --cacert \/path\/to\/couchbase-cloud-root-certificate.pem -u 'metrics_user:metrics_password' https:\/\/cb.plmvshfqolmyxvpt.cloud.couchbase.com:18091\/prometheus_sd_config.yaml<\/pre>\n<p>For our cluster this gives:<\/p>\n<pre class=\"nums:false lang:yaml decode:true\">- targets:\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-001.plmvshfqolmyxvpt.cloud.couchbase.com:8091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-002.plmvshfqolmyxvpt.cloud.couchbase.com:8091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-003.plmvshfqolmyxvpt.cloud.couchbase.com:8091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-qi-node-004.plmvshfqolmyxvpt.cloud.couchbase.com:8091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-qi-node-005.plmvshfqolmyxvpt.cloud.couchbase.com:8091'<\/pre>\n<p><span style=\"font-weight: 400;\">Here we can see the limitation of the current Service Discovery API &#8211; it will always return the insecure port (8091), which is no use to us in Capella as all communication is over the secure port (18091). This issue is fixed with the improvements in Server 7.2, but until those are available we need to add an extra step to update those port numbers.<\/span><\/p>\n<p>For the sake of this demo we&#8217;ll just pipe through <em>sed<\/em>, but you can do whatever is most appropriate for your environment:<\/p>\n<pre class=\"wrap:true lang:sh decode:true\">curl --cacert \/path\/to\/couchbase-cloud-root-certificate.pem -u 'metrics_user:metrics_password' https:\/\/cb.plmvshfqolmyxvpt.cloud.couchbase.com:18091\/prometheus_sd_config.yaml | sed 's\/:8091\/:18091\/'<\/pre>\n<p><span style=\"font-weight: 400;\">For our cluster this now gives:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true\">- targets:\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-001.plmvshfqolmyxvpt.cloud.couchbase.com:18091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-002.plmvshfqolmyxvpt.cloud.couchbase.com:18091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-d-node-003.plmvshfqolmyxvpt.cloud.couchbase.com:18091'\r\n \u00a0\u00a0\u00a0- 'svc-qi-node-004.plmvshfqolmyxvpt.cloud.couchbase.com:18091'\r\n\u00a0\u00a0\u00a0\u00a0- 'svc-qi-node-005.plmvshfqolmyxvpt.cloud.couchbase.com:18091'<\/pre>\n<p><span style=\"font-weight: 400;\">Now we have the correct output, we can redirect it to a file to use later in our job definition.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In our working directory, we&#8217;ll use a subdirectory to keep our targets together, naming the files after the job name (in our case <\/span><em><span style=\"font-weight: 400;\">capella-plmvshfqolmyxvpt<\/span><\/em><span style=\"font-weight: 400;\">):<\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true\">curl --cacert \/path\/to\/couchbase-cloud-root-certificate.pem -u 'metrics_user:metrics_password' https:\/\/cb.plmvshfqolmyxvpt.cloud.couchbase.com:18091\/prometheus_sd_config.yaml | sed 's\/:8091\/:18091\/' &gt; $(pwd)\/prometheus\/targets\/capella-plmvshfqolmyxvpt.yml<\/pre>\n<p><span style=\"font-weight: 400;\">This is fine for our demo, but obviously you&#8217;ll want to make sure it&#8217;s robust and suitable for your own environment, adding error handling as appropriate. And crucially, you&#8217;ll need to schedule this to be run regularly to make sure that the list of targets is updated with any topology changes as they happen (running once per minute via <\/span><em><span style=\"font-weight: 400;\">cron<\/span><\/em><span style=\"font-weight: 400;\"> for example, would be sufficient).<\/span><\/p>\n<p><span style=\"font-weight: 400;\">We can now take everything we have above, add in our <\/span><em><span style=\"font-weight: 400;\">file_sd_configs<\/span><\/em><span style=\"font-weight: 400;\">, and our new job looks like this:<\/span><\/p>\n<pre class=\"nums:false lang:yaml decode:true\">- job_name: \"capella-plmvshfqolmyxvpt\"\r\n\u00a0\u00a0basic_auth:\r\n\u00a0\u00a0\u00a0\u00a0username: \"metrics_user\"\r\n\u00a0\u00a0\u00a0\u00a0password: \"metrics_Passw0rd\"\r\n\u00a0\u00a0tls_config:\r\n\u00a0\u00a0\u00a0\u00a0ca_file: \"certs\/couchbase-cloud-root-certificate.pem\"\r\n\u00a0\u00a0scheme: https\r\n\u00a0\u00a0file_sd_configs:\r\n\u00a0\u00a0\u00a0\u00a0- files:\u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0- \"targets\/capella-plmvshfqolmyxvpt.yml\"<\/pre>\n<p>&nbsp;<\/p>\n<h4><span style=\"font-weight: 400;\">HTTP-based Service Discovery in Couchbase Server 7.2<\/span><\/h4>\n<p><span style=\"font-weight: 400;\">In Server 7.2 we&#8217;ve added a new endpoint (<\/span><em><span style=\"font-weight: 400;\">prometheus_sd_config<\/span><\/em><span style=\"font-weight: 400;\">), and similar to above you&#8217;ll need to authenticate with the credentials that you created, and provide the Capella Root Certificate we downloaded earlier.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First, we&#8217;ll use <\/span><em><span style=\"font-weight: 400;\">curl<\/span><\/em><span style=\"font-weight: 400;\"> and stream the result to our terminal. In the new API the default output is JSON, so we&#8217;re piping to <\/span><em><span style=\"font-weight: 400;\">jq<\/span><\/em><span style=\"font-weight: 400;\"> for clarity:<\/span><\/p>\n<pre class=\"wrap:true lang:sh decode:true \">curl --cacert \/path\/to\/couchbase-cloud-root-certificate.pem -u 'metrics_user:metrics_password' https:\/\/cb.plmvshfqolmyxvpt.cloud.couchbase.com:18091\/prometheus_sd_config | jq<\/pre>\n<p><span style=\"font-weight: 400;\">For our upgraded cluster (where the hostnames have changed during the upgrade process), this gives:<\/span><\/p>\n<pre class=\"nums-toggle:false lang:js decode:true\">[\r\n\u00a0\u00a0{\r\n\u00a0\u00a0\u00a0\u00a0\"targets\": [\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"svc-d-node-006.plmvshfqolmyxvpt.cloud.couchbase.com:18091\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"svc-d-node-007.plmvshfqolmyxvpt.cloud.couchbase.com:18091\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"svc-d-node-008.plmvshfqolmyxvpt.cloud.couchbase.com:18091\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"svc-qi-node-009.plmvshfqolmyxvpt.cloud.couchbase.com:18091\",\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"svc-qi-node-010.plmvshfqolmyxvpt.cloud.couchbase.com:18091\"\r\n\u00a0\u00a0\u00a0\u00a0]\r\n\u00a0\u00a0}\r\n]<\/pre>\n<p><span style=\"font-weight: 400;\">This output is exactly what Prometheus is expecting, so we can take the arguments we used in the <\/span><em><span style=\"font-weight: 400;\">curl<\/span><\/em><span style=\"font-weight: 400;\"> command and use them in an <\/span><em><span style=\"font-weight: 400;\">http_sd_configs<\/span><\/em><span style=\"font-weight: 400;\"> scrape configuration in our new Prometheus job:\u00a0\u00a0<\/span><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"nums:false wrap:true lang:yaml decode:true\">- job_name: \"capella-plmvshfqolmyxvpt\"\r\n\u00a0\u00a0basic_auth:\r\n\u00a0\u00a0\u00a0\u00a0username: \"metrics_user\"\r\n\u00a0\u00a0\u00a0\u00a0password: \"metrics_Passw0rd\"\r\n\u00a0\u00a0tls_config:\r\n\u00a0\u00a0\u00a0\u00a0ca_file: \"certs\/couchbase-cloud-root-certificate.pem\"\r\n\u00a0\u00a0scheme: https\r\n\u00a0\u00a0http_sd_configs:\r\n\u00a0\u00a0\u00a0\u00a0- url: https:\/\/cb.plmvshfqolmyxvpt.cloud.couchbase.com:18091\/prometheus_sd_config\r\n\u00a0\u00a0\u00a0\u00a0basic_auth:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0username: \"metrics_user\"\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0password: \"metrics_Passw0rd\"\r\n\u00a0\u00a0\u00a0\u00a0tls_config:\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0ca_file: \"certs\/couchbase-cloud-root-certificate.pem\"<\/pre>\n<h3><span style=\"font-weight: 400;\">Running your new Job<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">At this point you should have all you need to add the new scrape job to your Prometheus server.\u00a0 If you&#8217;re still using Couchbase Server 7.1 then it&#8217;ll be the <\/span><em><span style=\"font-weight: 400;\">file_sd_configs<\/span><\/em><span style=\"font-weight: 400;\"> based one (with whatever steps you need to create the <\/span><span style=\"font-weight: 400;\">targets<\/span><span style=\"font-weight: 400;\"> file), and if you&#8217;re running Server 7.2 then the <\/span><em><span style=\"font-weight: 400;\">http_sd_configs<\/span><\/em><span style=\"font-weight: 400;\"> based version.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Add the new job to your <\/span><em><span style=\"font-weight: 400;\">prometheus.yml<\/span><\/em><span style=\"font-weight: 400;\">, then reload the configuration with the <\/span><em><span style=\"font-weight: 400;\">kill<\/span><\/em><span style=\"font-weight: 400;\"> command we used earlier:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker kill --signal SIGHUP $(docker ps --quiet --filter publish=9090)<\/pre>\n<p><span style=\"font-weight: 400;\">You can then check the logs to make sure that the configuration loaded cleanly:<\/span><\/p>\n<pre class=\"nums:false lang:sh decode:true \">docker logs $(docker ps --quiet --filter publish=9090)<\/pre>\n<p><span style=\"font-weight: 400;\">Remember you&#8217;re looking for a <em>Loading configuration file<\/em> log message, and as long as your config is valid, you should see a <em>Completed loading of configuration file<\/em>\u00a0message immediately after. If you don&#8217;t have a successful reload, then you need to address any issues and try again. Once you do, let&#8217;s go back over and look at the Prometheus console\u00a0 at <\/span><a href=\"https:\/\/localhost:9090\/\"><span style=\"font-weight: 400;\">https:\/\/localhost:9090\/<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First let&#8217;s look at our new configuration (<strong>Status -&gt; Configuration<\/strong>), which should show the extra job we just added.<\/span><\/p>\n<p>This is the full configuration using File-based Service Discovery:<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/05.Prometheus.Config.with_.Capella.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15003\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/05.Prometheus.Config.with_.Capella-1024x642.png\" alt=\"\" width=\"900\" height=\"564\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-1024x642.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-300x188.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-768x482.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-1536x963.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-2048x1284.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/05.Prometheus.Config.with_.Capella-1320x828.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p>And here&#8217;s a snippet showing the HTTP-based scrape instead:<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/image_2023-11-02_172542859.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15037\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/image_2023-11-02_172542859-1024x140.png\" alt=\"\" width=\"885\" height=\"121\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859-1024x140.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859-300x41.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859-768x105.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859-1536x210.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859-1320x180.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172542859.png 1748w\" sizes=\"auto, (max-width: 885px) 100vw, 885px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Now, if we look at <strong>Status -&gt; Targets<\/strong>, it should show all the nodes from your Capella Database. For example, this is our cluster before the upgrade to Server 7.2:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/06.Prometheus.Targets.with_.Capella.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15004\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/06.Prometheus.Targets.with_.Capella-1024x469.png\" alt=\"\" width=\"900\" height=\"412\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-1024x469.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-300x137.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-768x351.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-1536x703.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-2048x937.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/06.Prometheus.Targets.with_.Capella-1320x604.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p>Relatedly, if the Targets aren&#8217;t what you expected, <strong>Status -&gt; Service Discovery<\/strong> will show you where each endpoint comes from. Here&#8217;s the Service Discovery status for our upgraded cluster, where we&#8217;re using HTTP SD (snipped to show just the first few nodes):<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/image_2023-11-02_172853103.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-15038 size-large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/image_2023-11-02_172853103-1024x413.png\" alt=\"\" width=\"900\" height=\"363\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103-1024x413.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103-300x121.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103-768x310.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103-1536x620.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103-1320x533.png 1320w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/image_2023-11-02_172853103.png 1803w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Now that we&#8217;ve added our Capella Database, how do we check that we&#8217;re actually getting anything useful?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">First, if we revisit the graph from earlier, we can see that the number of time series being stored (<\/span><em><span style=\"font-weight: 400;\">prometheus_tsdb_head_series<\/span><\/em><span style=\"font-weight: 400;\">) has grown considerably:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/07.Prometheus.Graphs.with_.Capella.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15005\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/07.Prometheus.Graphs.with_.Capella-1024x590.png\" alt=\"\" width=\"900\" height=\"519\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-1024x590.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-300x173.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-768x443.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-1536x885.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-2048x1180.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/07.Prometheus.Graphs.with_.Capella-1320x761.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Then we can confirm that we do indeed have some Couchbase Server metrics captured. We have the <\/span><em><span style=\"font-weight: 400;\">travel-sample<\/span><\/em><span style=\"font-weight: 400;\"> dataset loaded in our database, which contains just over 63,000 items. If we query <\/span><em><span style=\"font-weight: 400;\">kv_curr_items<\/span><\/em><span style=\"font-weight: 400;\"> we can see that each of our three Data Service nodes have ~21,000 items each:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-15006\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-1024x625.png\" alt=\"\" width=\"900\" height=\"549\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-1024x625.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-300x183.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-768x469.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-1536x937.png 1536w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-2048x1250.png 2048w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/08.Prometheus.Graphs.travel-sample.kv_curr_items-1320x805.png 1320w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400;\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In this article we&#8217;ve shown you how to run a simple Prometheus server in your local development environment, and how you can add your Couchbase Capella Database so that you can begin to monitor it. In the following posts in this series, we&#8217;ll show you what you can do with those metrics now that you have them.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As always, we appreciate any and all feedback, please feel free to reach out by leaving a comment here, or you can find us on our <\/span><a href=\"https:\/\/www.couchbase.com\/forums\/\"><span style=\"font-weight: 400;\">Forums<\/span><\/a><span style=\"font-weight: 400;\">, or our <\/span><a href=\"https:\/\/discord.gg\/hFF3tUyhD3\"><span style=\"font-weight: 400;\">Discord<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, the first in a series, we&#8217;re going to show you how to set up a Prometheus server and connect it to your Couchbase Capella Database in order to collect metrics. What is Prometheus? Prometheus is a [&hellip;]<\/p>\n","protected":false},"author":84547,"featured_media":14998,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2225,1816],"tags":[2384,9892,1335,2383],"ppma_author":[9841],"class_list":["post-14996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud","category-couchbase-server","tag-grafana","tag-metrics","tag-monitoring","tag-prometheus"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.8 (Yoast SEO v25.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Scraping Database Metrics from Couchbase Capella with Prometheus - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scraping Database Metrics from Couchbase Capella with Prometheus\" \/>\n<meta property=\"og:description\" content=\"In this blog post, the first in a series, we&#8217;re going to show you how to set up a Prometheus server and connect it to your Couchbase Capella Database in order to collect metrics. What is Prometheus? Prometheus is a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-30T19:43:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-18T20:31:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/00.Cover_.Image_-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Chris Malarky\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chris Malarky\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\"},\"author\":{\"name\":\"Chris Malarky\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6f0c497c9566079f9b522e37181f77b4\"},\"headline\":\"Scraping Database Metrics from Couchbase Capella with Prometheus\",\"datePublished\":\"2023-10-30T19:43:23+00:00\",\"dateModified\":\"2023-12-18T20:31:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\"},\"wordCount\":3259,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png\",\"keywords\":[\"Grafana\",\"metrics\",\"monitoring\",\"Prometheus\"],\"articleSection\":[\"Couchbase Capella\",\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\",\"name\":\"Scraping Database Metrics from Couchbase Capella with Prometheus - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png\",\"datePublished\":\"2023-10-30T19:43:23+00:00\",\"dateModified\":\"2023-12-18T20:31:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png\",\"width\":1024,\"height\":512,\"caption\":\"Scraping Database Metrics from Couchbase Capella with Prometheus\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scraping Database Metrics from Couchbase Capella with Prometheus\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6f0c497c9566079f9b522e37181f77b4\",\"name\":\"Chris Malarky\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/94dafb25331f3cf831d51a9833e8e665\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d3be458e2bfa84dfb7d92a892615748309bcb553322018b073ec003ee3e91276?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d3be458e2bfa84dfb7d92a892615748309bcb553322018b073ec003ee3e91276?s=96&d=mm&r=g\",\"caption\":\"Chris Malarky\"},\"description\":\"Chris Malarky is a Senior Product Manager in the Platform and Security Product Management team at Couchbase, with responsibilities covering Reliability, Availability, Serviceability (RAS), and Monitoring and Observabilty, across both Couchbase Server and Capella, Couchbase's SaaS Database offering. Chris is also the Product Manager for Cloud Native technologies at Couchbase, including the Couchbase Autonomous Operator for Kubernetes\/OpenShift. Prior to Product Management, Chris was a Senior Technical Support Engineer and Manager in Couchbase's global Technical Support team, and before joining Couchbase they had experience in Software Engineering, Application Support, System Administration, and Network Management across a wide range of industries and technologies. https:\/\/www.linkedin.com\/in\/malarky\/\",\"sameAs\":[\"https:\/\/linkedin.com\/in\/malarky\"],\"honorificPrefix\":\"Mx\",\"gender\":\"non-binary\",\"jobTitle\":\"Senior Product Manager\",\"worksFor\":\"Couchbase, Inc.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/chrismalarky\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Scraping Database Metrics from Couchbase Capella with Prometheus - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/","og_locale":"en_US","og_type":"article","og_title":"Scraping Database Metrics from Couchbase Capella with Prometheus","og_description":"In this blog post, the first in a series, we&#8217;re going to show you how to set up a Prometheus server and connect it to your Couchbase Capella Database in order to collect metrics. What is Prometheus? Prometheus is a [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/","og_site_name":"The Couchbase Blog","article_published_time":"2023-10-30T19:43:23+00:00","article_modified_time":"2023-12-18T20:31:06+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/10\/00.Cover_.Image_-1.png","type":"image\/png"}],"author":"Chris Malarky","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Chris Malarky","Est. reading time":"16 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/"},"author":{"name":"Chris Malarky","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6f0c497c9566079f9b522e37181f77b4"},"headline":"Scraping Database Metrics from Couchbase Capella with Prometheus","datePublished":"2023-10-30T19:43:23+00:00","dateModified":"2023-12-18T20:31:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/"},"wordCount":3259,"commentCount":2,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png","keywords":["Grafana","metrics","monitoring","Prometheus"],"articleSection":["Couchbase Capella","Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/","url":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/","name":"Scraping Database Metrics from Couchbase Capella with Prometheus - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png","datePublished":"2023-10-30T19:43:23+00:00","dateModified":"2023-12-18T20:31:06+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2023\/10\/00.Cover_.Image_-1.png","width":1024,"height":512,"caption":"Scraping Database Metrics from Couchbase Capella with Prometheus"},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/scraping-database-metrics-from-couchbase-capella-with-prometheus\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Scraping Database Metrics from Couchbase Capella with Prometheus"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/6f0c497c9566079f9b522e37181f77b4","name":"Chris Malarky","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/94dafb25331f3cf831d51a9833e8e665","url":"https:\/\/secure.gravatar.com\/avatar\/d3be458e2bfa84dfb7d92a892615748309bcb553322018b073ec003ee3e91276?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d3be458e2bfa84dfb7d92a892615748309bcb553322018b073ec003ee3e91276?s=96&d=mm&r=g","caption":"Chris Malarky"},"description":"Chris Malarky is a Senior Product Manager in the Platform and Security Product Management team at Couchbase, with responsibilities covering Reliability, Availability, Serviceability (RAS), and Monitoring and Observabilty, across both Couchbase Server and Capella, Couchbase's SaaS Database offering. Chris is also the Product Manager for Cloud Native technologies at Couchbase, including the Couchbase Autonomous Operator for Kubernetes\/OpenShift. Prior to Product Management, Chris was a Senior Technical Support Engineer and Manager in Couchbase's global Technical Support team, and before joining Couchbase they had experience in Software Engineering, Application Support, System Administration, and Network Management across a wide range of industries and technologies. https:\/\/www.linkedin.com\/in\/malarky\/","sameAs":["https:\/\/linkedin.com\/in\/malarky"],"honorificPrefix":"Mx","gender":"non-binary","jobTitle":"Senior Product Manager","worksFor":"Couchbase, Inc.","url":"https:\/\/www.couchbase.com\/blog\/author\/chrismalarky\/"}]}},"authors":[{"term_id":9841,"user_id":84547,"is_guest":0,"slug":"chrismalarky","display_name":"Chris Malarky","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/d3be458e2bfa84dfb7d92a892615748309bcb553322018b073ec003ee3e91276?s=96&d=mm&r=g","author_category":"","last_name":"Malarky","first_name":"Chris","job_title":"","user_url":"","description":"Chris Malarky is a Senior Product Manager in the Platform and Security Product Management team at Couchbase, with responsibilities covering Reliability, Availability, Serviceability (RAS), and Monitoring and Observabilty, across both Couchbase Server and Capella, Couchbase's SaaS Database offering.  Chris is also the Product Manager for Cloud Native technologies at Couchbase, including the Couchbase Autonomous Operator for Kubernetes\/OpenShift.  Prior to Product Management, Chris was a Senior Technical Support Engineer and Manager in Couchbase's global Technical Support team, and before joining Couchbase they had experience in Software Engineering, Application Support, System Administration, and Network Management across a wide range of industries and technologies. https:\/\/www.linkedin.com\/in\/malarky\/"}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/14996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/84547"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=14996"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/14996\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/14998"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=14996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=14996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=14996"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=14996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}