Skip to content

Commit 54270df

Browse files
Eve832tonypowa
andauthored
Get started with alerting fixes for publish (#85158)
* Rename alerting-get-started.md to index.md * edits * edits * prettier * Update docs/sources/tutorials/alerting-get-started/index.md Co-authored-by: tonypowa <45235678+tonypowa@users.noreply.github.com> --------- Co-authored-by: tonypowa <tonypowa@gmail.com> Co-authored-by: tonypowa <45235678+tonypowa@users.noreply.github.com>
1 parent 4e5bff0 commit 54270df

File tree

1 file changed

+49
-37
lines changed
  • docs/sources/tutorials/alerting-get-started

1 file changed

+49
-37
lines changed

docs/sources/tutorials/alerting-get-started/alerting-get-started.md renamed to docs/sources/tutorials/alerting-get-started/index.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
# Introduction
1+
---
2+
Feedback Link: https://github.com/grafana/tutorials/issues/new
3+
authors:
4+
- Antonio Calero
5+
categories:
6+
- alerting
7+
description: Get started with Grafana Alerting by creating your first alert in just a few minutes. Learn how to set up an alert, send alert notifications to a public webhook, and generate sample data to observe your alert in action.
8+
id: alerting-get-started
9+
labels:
10+
products:
11+
- enterprise
12+
- oss
13+
- cloud
14+
tags:
15+
- beginner
16+
title: Get started with Grafana Alerting
17+
weight: 50
18+
---
19+
20+
# Get Started with Grafana Alerting
221

322
In this guide, we'll walk you through the process of setting up your first alert in just a few minutes. You'll witness your alert in action with real-time data, as well as sending alert notifications.
423

@@ -7,7 +26,7 @@ In this tutorial you will:
726
- Set up an Alert
827
- Send an alert notification to a public webhook.
928

10-
# Before you begin
29+
## Before you begin
1130

1231
Ensure you have the following applications installed.
1332

@@ -22,27 +41,27 @@ Download the files to your local machine.
2241

2342
1. Clone the [tutorial environment repository](www.github.com/grafana/tutorial-environment).
2443

25-
```
44+
```promql
2645
git clone https://github.com/grafana/tutorial-environment.git
2746
```
2847

2948
1. Change to the directory where you cloned the repository:
3049

31-
```
50+
```promql
3251
cd tutorial-environment
3352
```
3453

3554
1. Make sure Docker is running:
3655

37-
```
56+
```promql
3857
docker --version
3958
```
4059

4160
This command will display the installed Docker version if the installation was successful.
4261

4362
1. Start the sample application:
4463

45-
```
64+
```promql
4665
docker compose up -d
4766
```
4867

@@ -54,15 +73,15 @@ Download the files to your local machine.
5473

5574
1. Ensure all services are up-and-running:
5675

57-
```
76+
```promql
5877
docker compose ps
5978
```
6079

6180
In the State column, it should say Up for all services.
6281

6382
The Grafana News app should be live on [localhost:8081](http://localhost:8081/).
6483

65-
## Generate data
84+
### Generate data
6685

6786
To enhance the hands-on aspect of this tutorial, you can actively participate in the Grafana News application to simulate web traffic and interactions. This enables you to observe data within Grafana and set up alerts accordingly.
6887

@@ -78,18 +97,15 @@ To add a link:
7897
The link will appear listed under the Grafana News heading.
7998
1. To vote for a link, click the triangle icon next to the name of the link.
8099

81-
## Log in to Grafana
100+
## Create a contact point for Grafana Managed Alerts
82101

83102
Besides being an open-source observability tool, Grafana has its own built-in alerting service. This means that you can receive notifications whenever there is an event of interest in your data, and even see these events graphed in your visualizations.
84103

85-
In your browser, navigate to [localhost:3000](http://localhost:3000).
86-
You should get logged in automatically
87-
88-
## Create a contact point for Grafana Managed Alerts
89-
90104
In this step, we'll set up a new contact point. This contact point will use the _webhooks_ channel. In order to make this work, we also need an endpoint for our webhook channel to receive the alert. We will use [requestbin.com](https://requestbin.com) to quickly set up that test endpoint. This way we can make sure that our alert is actually sending a notification somewhere.
91105

92-
1. Browse to [requestbin.com](https://requestbin.com).
106+
1. In your browser, navigate to [localhost:3000](http://localhost:3000), where Grafana is running.
107+
You should get logged in automatically.
108+
1. In another window, go to [requestbin.com](https://requestbin.com).
93109
1. Under the **Create Request Bin** button, click the link to create a **public bin** instead.
94110
1. From Request Bin, copy the endpoint URL.
95111

@@ -115,9 +131,8 @@ Next, we'll establish an alert within Grafana Alerting to notify us whenever our
115131

116132
In Grafana, **navigate to Alerting** > **Alert rules**. Click on **New alert rule**.
117133

118-
## Enter alert rule name
119-
120-
1. Make it short and descriptive as this will appear in your alert notification. For instance, **server-requests-duration**
134+
1. Enter alert rule name
135+
Make it short and descriptive as this will appear in your alert notification. For instance, **server-requests-duration**
121136

122137
## Define query and alert condition
123138

@@ -130,24 +145,25 @@ In this section, we define queries, expressions (used to manipulate the data), a
130145
{{< /admonition >}}
131146

132147
1. In the Query editor, switch to **Code** mode by clicking the button at the right.
133-
1. Enter the query
148+
1. Enter the following query:
134149

135-
```
150+
```promql
136151
sum(rate(tns_request_duration_seconds_count[1m])) by(method)
137152
```
138153

139154
This [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/) query calculates the sum of the per-second average rates of increase of the `tns_request_duration_seconds_count` metric over the last 1 minute, grouped by the HTTP method used in the requests. This can be useful for analyzing the request duration trends for different HTTP methods.
140155

141156
1. Keep expressions “B” and “C” as they are. These expressions (**Reduce** and **Threshold**, respectively) come by default when creating a new rule.
157+
142158
The Reduce expression “B”, selects the last value of our query “A”, while the Threshold expression “C” will check if the last value from expression “B” is above a specific value. In addition, the Threshold expression is the alert condition by default. Enter `0.2` as threshold value. You can read more about queries and conditions [here](https://grafana.com/docs/grafana/latest/alerting/fundamentals/alert-rules/queries-conditions/#expression-queries).
143159

144160
1. Click Preview to run the queries.
145161

146-
You should see the request duration for different HTTP methods.
162+
You should see the request duration for different HTTP methods.
147163

148-
{{<admonition type="note">}}
149-
If it returns “No data,” or an error, you are welcome to post questions in our [Grafana Community forum](https://community.grafana.com/).
150-
{{</admonition>}}
164+
{{<admonition type="note">}}
165+
If it returns “No data,” or an error, you are welcome to post questions in our [Grafana Community forum](https://community.grafana.com/).
166+
{{</admonition>}}
151167

152168
## Set evaluation behavior
153169

@@ -164,23 +180,19 @@ An evaluation group defines an evaluation interval - how often a rule is checked
164180

165181
Add labels to ease searching or route notifications to a policy.
166182

167-
### Labels
168-
169-
1. Add `app` as the label key, and `grafana-news` as the value
170-
171-
### Notifications
172-
173-
Select who should receive a notification when an alert rule fires.
183+
1. Add a label.
184+
Add `app` as the label key, and `grafana-news` as the value.
174185

175-
1. Under **Contact point**, select **RequestBin** from the drop-down menu.
186+
1. Add a notification recipient.
187+
Under **Contact point**, select **RequestBin** from the drop-down menu.
176188

177-
## Add Annotations
189+
1. Add an annotation (optional).
178190

179-
To provide more context on the alert, you can link a dashboard and panel to our Alert. For that, click **Link Dashboard and panel** button.
191+
To provide more context on the alert, you can link a dashboard and panel to our Alert. To do this, click **Link Dashboard and panel** button.
180192

181-
Linking an alert rule to a panel adds an annotation to the panel when the status of your alert rulechanges. If you don’t have a panel already, and since this is optional, you can skip this step for now and link it after you have finished configuring the alert rule.
193+
Linking an alert rule to a panel adds an annotation to the panel when the status of your alert rulechanges. If you don’t have a panel already, and since this is optional, you can skip this step for now and link it after you have finished configuring the alert rule.
182194

183-
Click **Save rule and exit** at the top right corner.
195+
1. Click **Save rule and exit** at the top right corner.
184196

185197
## Trigger an alert
186198

@@ -196,7 +208,7 @@ Once the query `sum(rate(tns_request_duration_seconds_count[1m])) by(method)` re
196208

197209
In this tutorial, you have learned how to set up an alert, send alert notifications to a public webhook, and generate some sample data to observe your alert in action. By following these steps, you've gained a foundational understanding of how to leverage Grafana's alerting capabilities to monitor and respond to events of interest in your data. Happy monitoring!
198210

199-
# Learn more
211+
## Learn more
200212

201213
Check out the links below to continue your learning journey with Grafana's LGTM stack.
202214

0 commit comments

Comments
 (0)