Docs: removing and reordering more guides (#110130)
Co-authored-by: Jack Baldry <jack.baldry@grafana.com>
This commit is contained in:
co-authored by
Jack Baldry
parent
b36bd7dd6a
commit
83e190a160
@@ -0,0 +1,20 @@
|
||||
---
|
||||
aliases:
|
||||
- ../guides/what-is-grafana/ # /docs/grafana/latest/guides/what-is-grafana/
|
||||
- ../getting-started/ # /docs/grafana/latest/getting-started/
|
||||
description: Learn how build your first dashboard after you have installed Grafana.
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Get started with Grafana Open Source
|
||||
weight: 1000
|
||||
---
|
||||
|
||||
# Get started with Grafana Open Source
|
||||
|
||||
Grafana helps you collect, correlate, and visualize data with beautiful dashboards — the open source data visualization and monitoring solution that drives informed decisions, enhances system performance, and streamlines troubleshooting.
|
||||
|
||||
This section provides guidance to our open source community about how to build your first dashboard after you have installed Grafana. It also provides step-by-step instructions on how to add a Prometheus, InfluxDB, or an MS SQL Server data source. If you are connecting a different data source, please refer to our complete list of supported [Data sources](/docs/grafana/<GRAFANA_VERSION>/datasources/#built-in-core-data-sources). If you would like to learn how to get started with Grafana Cloud, our fully managed observability stack, visit the [Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/quickstart/) for more information.
|
||||
|
||||
{{< section >}}
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../guides/getting_started/ # /docs/grafana/latest/guides/getting_started/
|
||||
- ../../guides/gettingstarted/ # /docs/grafana/latest/guides/gettingstarted/
|
||||
- ../../getting-started/build-first-dashboard/ # /docs/grafana/latest/getting-started/build-first-dashboard/
|
||||
description: Learn how to get started with Grafana by adding a preconfigured dashboard.
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Build your first dashboard
|
||||
weight: 200
|
||||
---
|
||||
|
||||
# Build your first dashboard
|
||||
|
||||
This topic helps you get started with Grafana and build your first dashboard using the built-in `Grafana` data source. To learn more about Grafana, refer to [Introduction to Grafana](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/introduction/).
|
||||
|
||||
{{< admonition type="note" >}}
|
||||
Grafana also offers a [free account with Grafana Cloud](/signup/cloud/connect-account?pg=gsdocs) to help getting started even easier and faster. You can install Grafana to self-host or get a free Grafana Cloud account.
|
||||
{{< /admonition >}}
|
||||
|
||||
#### Install Grafana
|
||||
|
||||
Grafana can be installed on many different operating systems. For a list of the minimum hardware and software requirements, as well as instructions on installing Grafana, refer to [Install Grafana](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/installation/).
|
||||
|
||||
#### Sign in to Grafana
|
||||
|
||||
To sign in to Grafana for the first time:
|
||||
|
||||
1. Open your web browser and go to http://localhost:3000/.
|
||||
|
||||
The default HTTP port that Grafana listens to is `3000` unless you have configured a different port.
|
||||
|
||||
1. On the sign-in page, enter `admin` for both the username and password.
|
||||
1. Click **Sign in**.
|
||||
|
||||
If successful, you'll see a prompt to change the password.
|
||||
|
||||
1. Click **OK** on the prompt and change your password.
|
||||
|
||||
{{< admonition type="note" >}}
|
||||
We strongly recommend that you change the default administrator password.
|
||||
{{< /admonition >}}
|
||||
|
||||
#### Create a dashboard
|
||||
|
||||
If you've already set up a data source that you know how to query, refer to [Create a dashboard](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/dashboards/build-dashboards/create-dashboard/) instead.
|
||||
|
||||
To create your first dashboard using the built-in `-- Grafana --` data source:
|
||||
|
||||
1. Click **Dashboards** in the main menu.
|
||||
1. On the **Dashboards** page, click **New** and select **New Dashboard** from the drop-down menu.
|
||||
1. On the dashboard, click **+ Add visualization**.
|
||||
|
||||

|
||||
|
||||
1. In the dialog box that opens, click `-- Grafana --`:
|
||||
|
||||
{{< figure class="float-right" src="/media/docs/grafana/dashboards/screenshot-data-source-selector-10.0.png" max-width="800px" alt="Select data source dialog box" >}}
|
||||
|
||||
This configures your [query](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/panels-visualizations/query-transform-data/#add-a-query) and generates the Random Walk dashboard.
|
||||
|
||||
1. Click **Refresh** to query the data source.
|
||||
1. When you've finished editing your panel, click **Save dashboard**.
|
||||
|
||||
Alternatively, click **Back to dashboard** if you want to see your changes applied to the dashboard first. Then click **Save dashboard** when you're ready.
|
||||
|
||||
1. Add a descriptive title for the dashboard, or have Grafana create one using [generative AI features](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/dashboards/manage-dashboards#set-up-generative-ai-features-for-dashboards), and then click **Save**.
|
||||
1. Click **Back to dashboard** and then **Exit edit**.
|
||||
|
||||
Congratulations, you have created your first dashboard and it's displaying results.
|
||||
|
||||
#### Next steps
|
||||
|
||||
Continue to experiment with what you have built, try the [explore workflow](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/explore/) or another visualization feature. Refer to [Data sources](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/datasources/) for a list of supported data sources and instructions on how to [add a data source](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/datasources/#add-a-data-source). The following topics will be of interest to you:
|
||||
|
||||
- [Panels and visualizations](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/panels-visualizations/)
|
||||
- [Dashboards](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/dashboards/)
|
||||
- [Keyboard shortcuts](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/dashboards/use-dashboards/#keyboard-shortcuts)
|
||||
- [Plugins](/grafana/plugins?orderBy=weight&direction=asc)
|
||||
|
||||
##### Admins
|
||||
|
||||
The following topics are of interest to Grafana server admin users:
|
||||
|
||||
- [Grafana configuration](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-grafana/)
|
||||
- [Authentication](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/setup-grafana/configure-security/configure-authentication/)
|
||||
- [User permissions and roles](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/)
|
||||
- [Provisioning](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/administration/provisioning/)
|
||||
- [Grafana CLI](https://grafana.com/docs/grafana/<GRAFANA_VERSION>/cli/)
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../../getting-started/getting-started-influxdb/ # /docs/grafana/latest/getting-started/getting-started-influxdb
|
||||
- ../../../getting-started/get-started-grafana-influxdb/ # /docs/grafana/latest/getting-started/get-started-grafana-influxdb
|
||||
description: Learn how to build your first InfluxDB dashboard in Grafana.
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Get started with Grafana and InfluxDB
|
||||
weight: 400
|
||||
---
|
||||
|
||||
# Get started with Grafana and InfluxDB
|
||||
|
||||
{{< docs/shared lookup="influxdb/intro.md" source="grafana" version="<GRAFANA VERSION>" >}}
|
||||
|
||||
#### Get InfluxDB
|
||||
|
||||
You can [download InfluxDB](https://portal.influxdata.com/downloads/) and install it locally or you can sign up for [InfluxDB Cloud](https://www.influxdata.com/products/influxdb-cloud/). Windows installers are not available for some versions of InfluxDB.
|
||||
|
||||
#### Install other InfluxDB software
|
||||
|
||||
[Install Telegraf](https://docs.influxdata.com/telegraf/v1.18/introduction/installation/). This tool is an agent that helps you get metrics into InfluxDB. For more information, refer to [Telegraf documentation](https://docs.influxdata.com/telegraf/v1.18/).
|
||||
|
||||
If you chose to use InfluxDB Cloud, then you should [download and install the InfluxDB Cloud CLI](https://portal.influxdata.com/downloads/). This tool allows you to send command line instructions to your cloud account. For more information, refer to [Influx CLI documentation](https://docs.influxdata.com/influxdb/cloud/write-data/developer-tools/influx-cli/).
|
||||
|
||||
#### Get data into InfluxDB
|
||||
|
||||
If you downloaded and installed InfluxDB on your local machine, then use the [Quick Start](https://docs.influxdata.com/influxdb/v2.0/write-data/#quick-start-for-influxdb-oss) feature to visualize InfluxDB metrics.
|
||||
|
||||
If you are using the cloud account, then the wizards will guide you through the initial process. For more information, refer to [Configure Telegraf](https://docs.influxdata.com/influxdb/cloud/write-data/no-code/use-telegraf/#configure-telegraf).
|
||||
|
||||
##### Note for Windows users:
|
||||
|
||||
Windows users might need to make additional adjustments. Look for special instructions in the InfluxData documentation and [Using Telegraf on Windows](https://www.influxdata.com/blog/using-telegraf-on-windows/) blog post. The regular system monitoring template in InfluxDB Cloud is not compatible with Windows. Windows users who use InfluxDB Cloud to monitor their system will need to use the [Windows System Monitoring Template](https://github.com/influxdata/community-templates/tree/master/windows_system).
|
||||
|
||||
#### Add your InfluxDB data source to Grafana
|
||||
|
||||
You can have more than one InfluxDB data source defined in Grafana.
|
||||
|
||||
1. Follow the general instructions to [add a data source](../../datasources/#add-a-data-source).
|
||||
1. Decide if you will use InfluxQL or Flux as your query language.
|
||||
- [Configure the data source](../../datasources/influxdb/#configure-the-data-source) for your chosen query language.
|
||||
Each query language has its own unique data source settings.
|
||||
- For querying features specific to each language, see the data source's [query editor documentation](../../datasources/influxdb/query-editor/).
|
||||
|
||||
##### InfluxDB guides
|
||||
|
||||
InfluxDB publishes guidance for connecting different versions of their product to Grafana.
|
||||
|
||||
- **InfluxDB OSS or Enterprise 1.8+.** To turn on Flux, refer to [Configure InfluxDB](https://docs.influxdata.com/influxdb/v1.8/administration/config/#flux-enabled-false.). Select your InfluxDB version in the upper right corner.
|
||||
- **InfluxDB OSS or Enterprise 2.x.** Refer to [Use Grafana with InfluxDB](https://docs.influxdata.com/influxdb/v2.0/tools/grafana/). Select your InfluxDB version in the upper right corner.
|
||||
- **InfluxDB Cloud.** Refer to [Use Grafana with InfluxDB Cloud](https://docs.influxdata.com/influxdb/cloud/tools/grafana/).
|
||||
|
||||
##### Important tips
|
||||
|
||||
- Make sure your Grafana token has read access. If it doesn't, then you'll get an authentication error and be unable to connect Grafana to InfluxDB.
|
||||
- Avoid apostrophes and other non-standard characters in bucket and token names.
|
||||
- If the text name of the organization or bucket doesn't work, then try the ID number.
|
||||
- If you change your bucket name in InfluxDB, then you must also change it in Grafana and your Telegraf .conf file as well.
|
||||
|
||||
#### Add a query
|
||||
|
||||
This step varies depending on the query language that you selected when you set up your data source in Grafana.
|
||||
|
||||
##### InfluxQL query language
|
||||
|
||||
In the query editor, click **select measurement**.
|
||||
|
||||

|
||||
|
||||
Grafana displays a list of possible series. Click one to select it, and Grafana graphs any available data. If there is no data to display, then try another selection or check your data source.
|
||||
|
||||
##### Flux query language
|
||||
|
||||
Create a simple Flux query.
|
||||
|
||||
1. [Add a panel](../../dashboards/build-dashboards/create-dashboard/).
|
||||
1. In the query editor, select your InfluxDB-Flux data source. For more information, refer to [Queries](../../panels-visualizations/query-transform-data/).
|
||||
1. Select the **Table** visualization.
|
||||
1. In the query editor text field, enter `buckets()` and then click outside of the query editor.
|
||||
|
||||
This generic query returns a list of buckets.
|
||||
|
||||

|
||||
|
||||
You can also create Flux queries in the InfluxDB Explore view.
|
||||
|
||||
1. In your browser, log in to the InfluxDB native UI (OSS is typically something like http://localhost:8086 or for InfluxDB Cloud use: https://cloud2.influxdata.com).
|
||||
1. Click **Explore** to open the Data Explorer.
|
||||
1. The InfluxDB Data Explorer provides two mechanisms for creating Flux queries: a graphical query editor and a script editor. Using the graphical query editor, [create a query](https://docs.influxdata.com/influxdb/cloud/query-data/execute-queries/data-explorer/). It will look something like this:
|
||||
|
||||

|
||||
|
||||
1. Click **Script Editor** to view the text of the query, and then copy all the lines of your Flux code, which will look something like this:
|
||||
|
||||

|
||||
|
||||
1. In Grafana, [add a panel](../../dashboards/build-dashboards/create-dashboard/) and then paste your Flux code into the query editor.
|
||||
1. Click **Apply**. Your new panel should be visible with data from your Flux query.
|
||||
|
||||
#### Check InfluxDB metrics in Grafana Explore
|
||||
|
||||
In your Grafana instance, go to the [Explore](../../explore/) view and build queries to experiment with the metrics you want to monitor. Here you can also debug issues related to collecting metrics.
|
||||
|
||||
#### Start building dashboards
|
||||
|
||||
There you go! Use Explore and Data Explorer to experiment with your data, and add the queries that you like to your dashboard as panels. Have fun!
|
||||
|
||||
Here are some resources to learn more:
|
||||
|
||||
- Grafana documentation: [InfluxDB data source](../../datasources/influxdb/)
|
||||
- InfluxDB documentation: [Comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/)
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../../getting-started/getting-started-sql/ # /docs/grafana/latest/getting-started/getting-started-sql
|
||||
- ../../../getting-started/get-started-grafana-ms-sql-server/ # /docs/grafana/latest/getting-started/get-started-grafana-ms-sql-server
|
||||
description: Learn how to build your first MS SQL Server dashboard in Grafana.
|
||||
labels:
|
||||
products:
|
||||
- enterprise
|
||||
- oss
|
||||
title: Get started with Grafana and MS SQL Server
|
||||
weight: 500
|
||||
---
|
||||
|
||||
# Get started with Grafana and MS SQL Server
|
||||
|
||||
Microsoft SQL Server is a popular relational database management system that is widely used in development and production environments. This topic walks you through the steps to create a series of dashboards in Grafana to display metrics from a MS SQL Server database.
|
||||
|
||||
#### Download MS SQL Server
|
||||
|
||||
MS SQL Server can be installed on Windows or Linux operating systems and also on Docker containers. Refer to the [MS SQL Server downloads page](https://www.microsoft.com/en-us/sql-server/sql-server-downloads), for a complete list of all available options.
|
||||
|
||||
#### Install MS SQL Server
|
||||
|
||||
You can install MS SQL Server on the host running Grafana or on a remote server. To install the software from the [downloads page](https://www.microsoft.com/en-us/sql-server/sql-server-downloads), follow their setup prompts.
|
||||
|
||||
If you are on a Windows host but want to use Grafana and MS SQL data source on a Linux environment, refer to the [WSL to set up your Grafana development environment](/blog/2021/03/03/how-to-set-up-a-grafana-development-environment-on-a-windows-pc-using-wsl) blog post. This will allow you to leverage the resources available in [grafana/grafana](https://github.com/grafana/grafana) GitHub repository. Here you will find a collection of supported data sources, including MS SQL Server, along with test data and pre-configured dashboards for use.
|
||||
|
||||
#### Add the MS SQL data source
|
||||
|
||||
There are several ways to authenticate in MSSQL. Start by:
|
||||
|
||||
1. Click **Connections** in the left-side menu and filter by `mssql`.
|
||||
1. Select the **Microsoft SQL Server** option.
|
||||
1. Click **Create a Microsoft SQL Server data source** in the top right corner to open the configuration page.
|
||||
1. Select the desired authentication method and fill in the right information as detailed below.
|
||||
1. Click **Save & test**.
|
||||
|
||||
##### General configuration
|
||||
|
||||
| Name | Description |
|
||||
| ---------- | --------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
||||
| `Host` | The IP address/hostname and optional port of your MS SQL instance. If port is omitted, the default 1433 will be used. |
|
||||
| `Database` | Name of your MS SQL database. |
|
||||
|
||||
##### SQL Server Authentication
|
||||
|
||||
| Name | Description |
|
||||
| ---------- | ------------------------------- |
|
||||
| `User` | Database user's login/username. |
|
||||
| `Password` | Database user's password. |
|
||||
|
||||
##### Windows Active Directory (Kerberos)
|
||||
|
||||
Below are the four possible ways to authenticate via Windows Active Directory/Kerberos.
|
||||
|
||||
{{< admonition type="note" >}}
|
||||
Windows Active Directory (Kerberos) authentication is not supported in Grafana Cloud at the moment.
|
||||
{{< /admonition >}}
|
||||
|
||||
| Method | Description |
|
||||
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| **Username + password** | Enter the domain user and password |
|
||||
| **Keytab file** | Specify the path to a valid keytab file to use that for authentication. |
|
||||
| **Credential cache** | Log in on the host via `kinit` and pass the path to the credential cache. The cache path can be found by running `klist` on the host in question. |
|
||||
| **Credential cache file** | This option allows multiple valid configurations to be present and matching is performed on host, database, and user. See the example JSON below this table. |
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"user": "grot@GF.LAB",
|
||||
"database": "dbone",
|
||||
"address": "mysql1.mydomain.com:3306",
|
||||
"credentialCache": "/tmp/krb5cc_1000"
|
||||
},
|
||||
{
|
||||
"user": "grot@GF.LAB",
|
||||
"database": "dbtwo",
|
||||
"address": "mysql2.gf.lab",
|
||||
"credentialCache": "/tmp/krb5cc_1000"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
For installations from the [grafana/grafana](https://github.com/grafana/grafana/tree/main) repository, `gdev-mssql` data source is available. Once you add this data source, you can use the `Datasource tests - MSSQL` dashboard with three panels showing metrics generated from a test database.
|
||||
|
||||

|
||||
|
||||
Optionally, play around this dashboard and customize it to:
|
||||
|
||||
- Create different panels.
|
||||
- Change titles for panels.
|
||||
- Change frequency of data polling.
|
||||
- Change the period for which the data is displayed.
|
||||
- Rearrange and resize panels.
|
||||
|
||||
#### Start building dashboards
|
||||
|
||||
Now that you have gained some idea of using the pre-packaged MS SQL data source and some test data, the next step is to setup your own instance of MS SQL Server database and data your development or sandbox area.
|
||||
|
||||
To fetch data from your own instance of MS SQL Server, add the data source using instructions in Step 4 of this topic. In Grafana [Explore](../../explore/) build queries to experiment with the metrics you want to monitor.
|
||||
|
||||
Once you have a curated list of queries, create [dashboards](../../dashboards/) to render metrics from the SQL Server database. For troubleshooting, user permissions, known issues, and query examples, refer to [Using Microsoft SQL Server in Grafana](../../datasources/mssql/).
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
---
|
||||
aliases:
|
||||
- ../../../getting-started/getting-started-prometheus/ #/docs/grafana/latest/getting-started/getting-started-prometheus
|
||||
- ../../../getting-started/get-started-grafana-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
|
||||
---
|
||||
|
||||
# Get started with Grafana and Prometheus
|
||||
|
||||
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.
|
||||
|
||||
{{< admonition type="tip" >}}
|
||||
Check out our Prometheus **Learning Journeys**.
|
||||
|
||||
- [Connect to a Prometheus data source in Grafana Cloud](https://www.grafana.com/docs/learning-journeys/prometheus/) to visualize your metrics directly from where they are stored.
|
||||
- [Send metrics to Grafana Cloud using Prometheus remote write](https://www.grafana.com/docs/learning-journeys/prom-remote-write/) to explore Grafana Cloud without making significant changes to your existing configuration.
|
||||
{{< /admonition >}}
|
||||
|
||||
_Grafana and Prometheus_:
|
||||
|
||||
1. Download Prometheus and Node exporter
|
||||
1. Install Prometheus Node exporter
|
||||
1. Install and configure Prometheus
|
||||
1. Configure Prometheus for Grafana
|
||||
1. Check Prometheus metrics in Grafana Explore view
|
||||
1. Start building dashboards
|
||||
|
||||
## Download Prometheus and Node exporter
|
||||
|
||||
Download the following components:
|
||||
|
||||
- [Prometheus](https://prometheus.io/download/#prometheus)
|
||||
- [Node exporter](https://prometheus.io/download/#node_exporter)
|
||||
|
||||
Like Grafana, you can install Prometheus on many different operating systems. Refer to the [Prometheus download page](https://prometheus.io/download/) to see a list of stable versions of Prometheus components.
|
||||
|
||||
## Install Prometheus Node exporter
|
||||
|
||||
Install Node exporter on all hosts you want to monitor. This guide shows you how to install it locally.
|
||||
|
||||
Prometheus Node exporter is a widely used tool that exposes system metrics. For instructions on installing Node exporter, refer to the [Installing and running the Node exporter](https://prometheus.io/docs/guides/node-exporter/#installing-and-running-the-node-exporter) 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 [windows_exporter](https://github.com/prometheus-community/windows_exporter) instead.
|
||||
{{< /admonition >}}
|
||||
|
||||
## Install and configure Prometheus
|
||||
|
||||
1. After [downloading Prometheus](https://prometheus.io/download/#prometheus), extract it and navigate to the directory.
|
||||
|
||||
```
|
||||
tar xvfz prometheus-*.tar.gz
|
||||
cd prometheus-*
|
||||
```
|
||||
|
||||
1. Locate the `prometheus.yml` file in the directory.
|
||||
|
||||
1. Modify the Prometheus 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 `/etc/prometheus/prometheus.yml`.
|
||||
|
||||
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.
|
||||
|
||||
```
|
||||
# A scrape configuration containing exactly one endpoint to scrape from Node exporter running on a host:
|
||||
scrape_configs:
|
||||
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
|
||||
- job_name: 'node'
|
||||
|
||||
# metrics_path defaults to '/metrics'
|
||||
# scheme defaults to 'http'.
|
||||
|
||||
static_configs:
|
||||
- targets: ['localhost:9100']
|
||||
```
|
||||
|
||||
1. Start the Prometheus service:
|
||||
|
||||
```
|
||||
./prometheus --config.file=./prometheus.yml
|
||||
```
|
||||
|
||||
1. 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.
|
||||
|
||||
## Configure Prometheus for Grafana
|
||||
|
||||
When running Prometheus locally, there are two ways to configure Prometheus for Grafana. You can use a hosted Grafana instance at [Grafana Cloud](/) or run Grafana locally.
|
||||
|
||||
This guide describes configuring Prometheus in a hosted Grafana instance on Grafana Cloud.
|
||||
|
||||
1. Sign up for [https://grafana.com/](/auth/sign-up/create-user). Grafana gives you a Prometheus instance out of the box.
|
||||
|
||||

|
||||
|
||||
1. 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 [here](/grafana/download) and follow the configuration steps listed [here](/docs/grafana/latest/datasources/prometheus/#configure-the-data-source).
|
||||
{{< /admonition >}}
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
These are some of the troubleshooting steps you can try if Prometheus isn’t running or functioning as expected. The steps provided have been selected based on the Learning Journeys we offer for Prometheus. If you’d like to explore further, check out the [Prometheus Learning Journey](https://grafana.com/docs/learning-journeys/prometheus/) if you want to visualize data in Grafana Cloud without sending or storing data in Grafana Cloud, such as for local retention needs. Alternatively, if you already have a Prometheus setup and want to explore Grafana Cloud without making significant changes, visit the [Prometheus remote write learning journey](https://grafana.com/docs/learning-journeys/prom-remote-write/).
|
||||
|
||||
### 1. Checking if Prometheus is running
|
||||
|
||||
If the Prometheus web UI is inaccessible (e.g., "Connection refused" error in the browser) or Prometheus queries fail (e.g., errors in Grafana like "Data source unavailable" or "No data points"), a good place to start is confirming that the Prometheus process and service are running.
|
||||
|
||||
You can do this by checking the system process or verifying the service status:
|
||||
|
||||
**Linux**
|
||||
|
||||
```bash
|
||||
sudo systemctl status prometheus
|
||||
```
|
||||
|
||||
- Shows whether the process is running and if the service is active.
|
||||
|
||||
**MacOS**
|
||||
|
||||
```bash
|
||||
pgrep prometheus
|
||||
```
|
||||
|
||||
- Returns the process ID (PID) if Prometheus is running.
|
||||
|
||||
**Windows** (`PowerShell`)
|
||||
|
||||
```powershell
|
||||
Get-Process -Name prometheus -ErrorAction SilentlyContinue
|
||||
```
|
||||
|
||||
- Checks if the Prometheus process is running by name.
|
||||
|
||||
### 2. If Prometheus is not running
|
||||
|
||||
Start by checking for common causes:
|
||||
|
||||
**Check for port conflicts**.
|
||||
|
||||
Prometheus runs on port 9090 by default. If another process is using this port, Prometheus may fail to start. You can check for port conflicts with:
|
||||
|
||||
**Linux & MacOS**
|
||||
|
||||
```bash
|
||||
lsof -i :9090
|
||||
```
|
||||
|
||||
**Windows** (`PowerShell`)
|
||||
|
||||
```powershell
|
||||
netstat -ano | findstr :9090
|
||||
```
|
||||
|
||||
- Shows if another process is using port **9090**.
|
||||
|
||||
**Verify the Prometheus binary placement**: ensure Prometheus binaries (`prometheus` and `promtool`) are correctly installed.
|
||||
|
||||
**Linux & MacOS**
|
||||
|
||||
```bash
|
||||
ls /usr/local/bin/prometheus /usr/local/bin/promtool
|
||||
```
|
||||
|
||||
- If missing, move them to `/usr/local/bin` or a directory in your system’s **PATH**.
|
||||
|
||||
**Check if Prometheus is in the path**.
|
||||
|
||||
```bash
|
||||
which prometheus
|
||||
which promtool
|
||||
```
|
||||
|
||||
- If there’s **no output**, the binaries are not in the system **PATH**.
|
||||
|
||||
**Ensure configuration & data files are in place**.
|
||||
|
||||
**Linux & MacOs**
|
||||
|
||||
```bash
|
||||
ls /etc/prometheus /var/lib/prometheus
|
||||
ls /etc/prometheus/prometheus.yml
|
||||
```
|
||||
|
||||
- Makes sure that Prometheus has its necessary configuration and data storage directories.
|
||||
|
||||
**Check permissions**: If Prometheus is running as a dedicated user, ensure the correct ownership:
|
||||
|
||||
```bash
|
||||
sudo chown -R prometheus:prometheus /etc/prometheus /var/lib/prometheus
|
||||
```
|
||||
|
||||
(Optional) **Secure Prometheus by creating a dedicated user**
|
||||
|
||||
```bash
|
||||
sudo useradd --no-create-home --shell /bin/false prometheus
|
||||
```
|
||||
|
||||
- Recommended for security: runs Prometheus as a non-login user.
|
||||
|
||||
### 3. Checking if Prometheus is running as a service
|
||||
|
||||
If Prometheus is running as a process, check whether it is properly set up and managed as a service to ensure it restarts automatically after reboots or failures.
|
||||
|
||||
**Check Prometheus service status**
|
||||
|
||||
**Linux**
|
||||
|
||||
```bash
|
||||
systemctl status prometheus.service
|
||||
```
|
||||
|
||||
**Windows**
|
||||
|
||||
```powershell
|
||||
sc query prometheus
|
||||
```
|
||||
|
||||
**MacOs**
|
||||
|
||||
```bash
|
||||
pgrep prometheus
|
||||
```
|
||||
|
||||
- If the service is **inactive (dead) or stopped**, proceed to the next steps.
|
||||
|
||||
### 4. If Prometheus is not running as a service
|
||||
|
||||
If Prometheus is not running as a managed service, ensure it is correctly configured and can restart automatically.
|
||||
|
||||
**Verify service configuration** **(Linux & MacOs)**
|
||||
|
||||
Check the service unit file to ensure correct paths:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/systemd/system/prometheus.service
|
||||
```
|
||||
|
||||
- Look for the `ExecStart` line:
|
||||
|
||||
```bash
|
||||
ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/
|
||||
```
|
||||
|
||||
- Ensure:
|
||||
- The **binary path** (`/usr/local/bin/prometheus`) is correct.
|
||||
- The **configuration file** (`/etc/prometheus/prometheus.yml`) is in place.
|
||||
- The **storage path** (`/var/lib/prometheus/`) exists.
|
||||
|
||||
**Restart and enable Prometheus service (Linux & MacOs)**
|
||||
|
||||
```bash
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable prometheus
|
||||
sudo systemctl start prometheus
|
||||
sudo systemctl status prometheus
|
||||
```
|
||||
|
||||
**Check Prometheus health status**
|
||||
|
||||
After restarting, verify if Prometheus is responsive:
|
||||
|
||||
```bash
|
||||
curl -s http://localhost:9090/-/ready
|
||||
```
|
||||
|
||||
- If successful, this confirms Prometheus is **ready to serve requests**.
|
||||
|
||||
**Restart Prometheus service (Windows)**
|
||||
|
||||
If running as a Windows service, restart it:
|
||||
|
||||
```powershell
|
||||
net stop prometheus
|
||||
net start prometheus
|
||||
```
|
||||
|
||||
### 5. Checking if Prometheus is capturing metrics
|
||||
|
||||
If you installed [Node exporter](#install-prometheus-node-exporter) to expose your system metrics, you can check if Prometheus is capturing metrics by sending a request to the `/metrics` endpoint.
|
||||
|
||||
```bash
|
||||
curl http://localhost:9090/metrics
|
||||
```
|
||||
|
||||
- It should return a number of metrics and metadata about the metrics being exposed.
|
||||
|
||||
## Check Prometheus metrics in Grafana Metics Drilldown
|
||||
|
||||
In your Grafana instance, go to the [Drilldown](https://www.grafana.com/docs/grafana/latest/explore/simplified-exploration/metrics/) view and experience query-less browsing of Prometheus-compatible metrics.
|
||||
|
||||
## Start building dashboards
|
||||
|
||||
Now that you have a curated list of queries, create [dashboards](../../dashboards/) to render system metrics monitored by Prometheus. When you install Prometheus and Node exporter or windows_exporter, 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 data source](../../datasources/prometheus/)
|
||||
- Prometheus documentation: [What is Prometheus?](https://prometheus.io/docs/introduction/overview/)
|
||||
Reference in New Issue
Block a user