{"id":85,"date":"2023-08-05T07:38:10","date_gmt":"2023-08-05T07:38:10","guid":{"rendered":"http:\/\/it4home.dk\/?p=85"},"modified":"2023-08-06T09:17:52","modified_gmt":"2023-08-06T09:17:52","slug":"setting-up-grafana-with-prometheus-data-source-in-docker","status":"publish","type":"post","link":"https:\/\/it4home.dk\/index.php\/2023\/08\/05\/setting-up-grafana-with-prometheus-data-source-in-docker\/","title":{"rendered":"Setting Up Grafana with Prometheus Data Source in Docker"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/85?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\" ><\/a><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/85?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/it4home.dk\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<p class=\"wp-block-paragraph\">Introduction:<br>Grafana is a popular open-source data visualization and monitoring tool. In this guide, we&#8217;ll show you how to set up Grafana using Docker and configure it to use Prometheus as a data source.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Install Grafana with Docker<br>To install Grafana and run it in Docker, use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -d --name=grafana -p 3000:3000 -v grafana_data:\/data grafana\/grafana<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation of options used:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>-d<\/code>: Run the container in the background (detached mode).<\/li>\n\n\n\n<li><code>--name=grafana<\/code>: Assign the name &#8220;grafana&#8221; to the container for easy management.<\/li>\n\n\n\n<li><code>-p 3000:3000<\/code>: Map port 3000 from the container to the host system. This allows you to access Grafana&#8217;s web interface at <code>http:\/\/localhost:3000<\/code>.<\/li>\n\n\n\n<li><code>-v grafana_data:\/data<\/code>: Create a Docker volume named &#8220;grafana_data&#8221; and mount it to the <code>\/data<\/code> directory inside the container. This volume allows you to persist Grafana&#8217;s data and configurations.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Access Grafana Web Interface<br>Once the Grafana container is running, you can access the web interface by opening a web browser and navigating to <code>http:\/\/localhost:3000<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Change Default Admin Credentials<br>Log in to Grafana using the default admin credentials (username: &#8220;admin,&#8221; password: &#8220;admin&#8221;). You&#8217;ll be prompted to change the password upon initial login.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Add Prometheus Data Source<br>To add Prometheus as a data source in Grafana, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on the gear icon (Configuration) in the left sidebar, then select &#8220;Data Sources.&#8221;<\/li>\n\n\n\n<li>Click on the &#8220;Add data source&#8221; button.<\/li>\n\n\n\n<li>Choose &#8220;Prometheus&#8221; from the list of data sources.<\/li>\n\n\n\n<li>In the &#8220;HTTP&#8221; section, set the URL to the address of your Prometheus server, in this case, <code>http:\/\/192.168.0.223:9090<\/code>.<\/li>\n\n\n\n<li>Click &#8220;Save &amp; Test&#8221; to verify the connection to Prometheus. If successful, you&#8217;ll see a green notification.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Step 5: Start Creating Dashboards<br>With Prometheus as the data source, you can start creating dashboards and visualizations in Grafana to monitor and analyze your data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Conclusion:<br>You&#8217;ve successfully set up Grafana using Docker and configured it to use Prometheus as a data source. Grafana provides a user-friendly interface for visualizing data from various sources, and with Prometheus as a backend, you can easily create powerful monitoring dashboards.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Happy data visualization and monitoring!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction:Grafana is a popular open-source data visualization and monitoring tool. In this guide, we&#8217;ll show you how to set up Grafana using Docker and configure it to use Prometheus as a data source. Step&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":203,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[35],"class_list":["post-85","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-docker","tag-ok"],"_links":{"self":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/85","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":2,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions\/134"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media\/203"}],"wp:attachment":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}