Project: Grafana (Observability and Analysis / Observability)
File: get-started-grafana-prometheus.md

aliases: ../guides/getting_started/ ../guides/gettingstarted/ getting-started-prometheus/ description: Learn how to build your first Prometheus dashboard in Grafana. labels: products: enterprise oss title: Get started with Grafana and Prometheus weight: 300 Prometheus is an open source monitoring system for which Grafana provides out-of-the-box support. This topic walks you through the steps to create a series of dashboards in Grafana to display system metrics for a server monitored by Prometheus. Grafana and Prometheus: Download Prometheus and node_exporter Install Prometheus node_exporter Install and configure Prometheus Configure Prometheus for Grafana Check Prometheus metrics in Grafana Explore view Start building dashboards Download the following components: Like Grafana, you can install Prometheus on many different operating systems. Refer to the to see a list of stable versions of Prometheus components. Install node_exporter on all hosts you want to monitor. This guide shows you how to install it locally. Prometheus nodeexporter is a widely used tool that exposes system metrics. For instructions on installing nodeexporter, refer to the section in the Prometheus documentation. When you run node_exporter locally, navigate to `http://localhost:9100/metrics` to check that it is exporting metrics. {{% admonition type="note" %}} The instructions in the referenced topic are intended for Linux users. You may have to alter the instructions slightly depending on your operating system. For example, if you are on Windows, use the instead. {{% /admonition %}} After , extract it and navigate to the directory. ``` tar xvfz prometheus-*.tar.gz cd prometheus-* ``` Locate the `prometheus.yml` file in the directory. Modify Prometheus's configuration file to monitor the hosts where you installed node_exporter. By default, Prometheus looks for the file `prometheus.yml` in the current working directory. This behavior can be changed via the `--config.file` command line flag. For example, some Prometheus installers use it to set the configuration file to

The following example shows you the code you should add. Notice that static configs targets are set to `['localhost:9100']` to target node-explorer when running it locally. ``` scrape_configs: job_name: 'node' static_configs: targets: ['localhost:9100'] ``` Start the Prometheus service: ``` ./prometheus --config.file=./prometheus.yml ``` Confirm that Prometheus is running by navigating to `http://localhost:9090`. You can see that the node_exporter metrics have been delivered to Prometheus. Next, the metrics will be sent to Grafana. When running Prometheus locally, there are two ways to configure Prometheus for Grafana. You can use a hosted Grafana instance at or run Grafana locally. This guide describes configuring Prometheus in a hosted Grafana instance on Grafana Cloud. Sign up for . Grafana gives you a Prometheus instance out of the box. Because you are running your own Prometheus instance locally, you must `remote_write` your metrics to the Grafana.com Prometheus instance. Grafana provides code to add to your `prometheus.yml` config file. This includes a remote write endpoint, your user name and password. Add the following code to your prometheus.yml file to begin sending metrics to your hosted Grafana instance. ``` remote_write: url: <https://your-remote-write-endpoint> basic_auth: username: <your user name> password: <Your Grafana.com API Key> ``` {{% admonition type="note" %}} To configure your Prometheus instance to work with Grafana locally instead of Grafana Cloud, install Grafana and follow the configuration steps listed . {{% /admonition %}} In your Grafana instance, go to the view and build queries to experiment with the metrics you want to monitor. Here you can also debug issues related to collecting metrics from Prometheus. Now that you have a curated list of queries, create to render system metrics monitored by Prometheus. When you install Prometheus and nodeexporter or windowsexporter, you will find recommended dashboards for use. The following image shows a dashboard with three panels showing some system metrics. To learn more: Grafana documentation: Prometheus documentation: