Skip to content

Commit 889d307

Browse files
docs(srv): add how to create alerts for srv ressources MTA-5503 (#4379)
* docs(srv): add how to create alerts for srv ressources MTA-5503 * docs(srv): update * docs(srv): update * docs(srv): update * docs(srv): update * docs(srv): update * Apply suggestions from code review Co-authored-by: Jessica <[email protected]> --------- Co-authored-by: Jessica <[email protected]>
1 parent 4fd58a4 commit 889d307

File tree

6 files changed

+480
-2
lines changed

6 files changed

+480
-2
lines changed

menu/navigation.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4007,6 +4007,10 @@
40074007
"label": "Monitor function logs and metrics",
40084008
"slug": "monitor-function"
40094009
},
4010+
{
4011+
"label": "Configure alerts for a function",
4012+
"slug": "configure-alerts-function"
4013+
},
40104014
{
40114015
"label": "Delete a function",
40124016
"slug": "delete-a-function"
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
meta:
3+
title: How to add alerts to a container
4+
description: Learn how to add monitoring alerts to Serverless Containers with Scaleway.
5+
content:
6+
h1: How to add alerts to a container
7+
paragraph: Learn how to add monitoring alerts to Serverless Containers with Scaleway.
8+
tags: containers alerts grafana threshold monitoring cockpit
9+
dates:
10+
validation: 2025-02-10
11+
posted: 2025-02-10
12+
categories:
13+
- serverless
14+
---
15+
16+
This page shows you how to configure alerts for Scaleway Serverless Containers using Scaleway Cockpit and Grafana.
17+
18+
<Macro id="requirements" />
19+
20+
- A Scaleway account logged into the [console](https://console.scaleway.com)
21+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22+
- Scaleway resources you can monitor
23+
- [Created Grafana credentials](/cockpit/how-to/retrieve-grafana-credentials/) with the **Editor** role
24+
- [Enabled](/cockpit/how-to/enable-alert-manager/) the alert manager
25+
- [Created](/cockpit/how-to/add-contact-points/) at least one contact point
26+
- Selected the **Scaleway Alerting** alert manager in Grafana
27+
28+
1. [Log in to Grafana](/cockpit/how-to/access-grafana-and-managed-dashboards/) using your credentials.
29+
2. Click the **Toggle menu** then click **Alerting**.
30+
3. Click **Alert rules** and **+ New alert rule**.
31+
4. Scroll down to the **Define query and alert condition** section and click **Switch to data source-managed alert rule**.
32+
<Message type="important">
33+
This allows you to configure alert rules managed by the data source of your choice, instead of using Grafana's managed alert rules.
34+
</Message>
35+
36+
5. Type in a name for your alert.
37+
6. Select the data source you want to configure alerts for. For the sake of this documentation, we are choosing the **Scaleway Metrics** data source.
38+
7. In the Metrics browser drop-down, select the metric you want to configure an alert for. Refer to the table below for details on each alert for Serverless Containers.
39+
40+
**AnyContainerError**
41+
42+
Pending period
43+
44+
: 10s
45+
46+
Summary
47+
48+
: Container `{{ $labels.resource_name }}` is in error.
49+
50+
Query and alert condition
51+
52+
: `serverless_container_status{status="error"} == 1`
53+
54+
Description
55+
56+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is in error. Check the console to find out the error message.
57+
58+
**ContainerError**
59+
60+
Pending period
61+
62+
: 10s
63+
64+
Summary
65+
66+
: Container `{{ $labels.resource_name }}` is in error.
67+
68+
Query and alert condition
69+
70+
: `serverless_container_status{status="error",resource_id="your-container-id-here"} == 1`
71+
72+
Description
73+
74+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is in error. Check the console to find out the error message.
75+
76+
**AnyContainerHighCPUUsage**
77+
78+
Pending period
79+
80+
: 10m
81+
82+
Summary
83+
84+
: High CPU usage for container `{{ $labels.resource_name }}`.
85+
86+
Query and alert condition
87+
88+
: `serverless_container_cpu_usage_ratio > 90`
89+
90+
Description
91+
92+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available CPU since 10m.
93+
94+
**ContainerHighCPUUsage**
95+
96+
Pending period
97+
98+
: 10m
99+
100+
Summary
101+
102+
: High CPU usage for container `{{ $labels.resource_name }}`.
103+
104+
Query and alert condition
105+
106+
: `serverless_container_cpu_usage_ratio{resource_id="your-container-id-here"} > 90`
107+
108+
Description
109+
110+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available CPU since 10m.
111+
112+
**AnyContainerHighMemoryUsage**
113+
114+
Pending period
115+
116+
: 10m
117+
118+
Summary
119+
120+
: High memory usage for container `{{ $labels.resource_name }}`.
121+
122+
Query and alert condition
123+
124+
: `(serverless_container_memory_usage_bytes / serverless_container_memory_limit_bytes) * 100 > 90`
125+
126+
Description
127+
128+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available RAM since 10m.
129+
130+
**ContainerHighMemoryUsage**
131+
132+
Pending period
133+
134+
: 10m
135+
136+
Summary
137+
138+
: High memory usage for container `{{ $labels.resource_name }}`.
139+
140+
Query and alert condition
141+
142+
: `(serverless_container_memory_usage_bytes{resource_id="your-container-id-here"} / serverless_container_memory_limit_bytes{resource_id="your-container-id-here"}) * 100 > 90`
143+
144+
Description
145+
146+
: Container `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available RAM since 10m.
147+
148+
8. Select labels that apply to the metric you have selected in the previous step, to target your desired resources and fine-tune your alert.
149+
9. Select one or more values for your labels.
150+
10. Click **Use query** to generate your alert based on the conditions you have defined.
151+
11. Select a folder to store your rule, or create a new one. Folders allow you to easily manage your different rules.
152+
12. Select an evaluation group to add your rule to. Rules within the same group are evaluated sequentially over the same time interval.
153+
13. In the **Set alert evaluation behavior** field, configure the amount of time during which the alert can be in breach of the condition(s) you have defined until it triggers.
154+
<Message type="note">
155+
For example, if you wish to be alerted after your alert has been in breach of the condition for 2 minutes without interruption, type `2` and select `minutes` in the drop-down.
156+
</Message>
157+
14. Optionally, add a summary and a description.
158+
15. Click **Save rule** at the top right corner of your screen to save your alert. Once your alert meets the requirements you have configured, you will receive an email to inform you that your alert has been triggered.

pages/serverless-containers/reference-content/containers-autoscaling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ This parameter sets the minimum number of instances your resource is allowed to
3434

3535
- If you set a value of `0`, all instances of your resource will be terminated after 15 minutes of inactivity.
3636

37-
- If you set a value of `1` or more, the corresponding number of instances of your resource will remain available at all time.
37+
- If you set a value of `1` or more, the corresponding number of instances of your resource will remain available at all times.
3838

3939
Customizing the minimum scale for Serverless can help ensure that an instance remains pre-allocated and ready to handle requests, reducing delays associated with [cold starts](/serverless-containers/concepts/#cold-start). However, this setting also impacts the costs of your Serverless Container.
4040

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
meta:
3+
title: How to add alerts to a function
4+
description: Learn how to add monitoring alerts to Serverless Functions with Scaleway.
5+
content:
6+
h1: How to add alerts to a function
7+
paragraph: Learn how to add monitoring alerts to Serverless Functions with Scaleway.
8+
tags: functions alerts grafana threshold monitoring cockpit
9+
dates:
10+
validation: 2025-02-10
11+
posted: 2025-02-10
12+
categories:
13+
- serverless
14+
---
15+
16+
This page shows you how to configure alerts for Scaleway Serverless Functions using Scaleway Cockpit and Grafana.
17+
18+
<Macro id="requirements" />
19+
20+
- A Scaleway account logged into the [console](https://console.scaleway.com)
21+
- [Owner](/iam/concepts/#owner) status or [IAM permissions](/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22+
- Scaleway resources you can monitor
23+
- [Created Grafana credentials](/cockpit/how-to/retrieve-grafana-credentials/) with the **Editor** role
24+
- [Enabled](/cockpit/how-to/enable-alert-manager/) the alert manager
25+
- [Created](/cockpit/how-to/add-contact-points/) at least one contact point
26+
- Selected the **Scaleway Alerting** alert manager in Grafana
27+
28+
1. [Log in to Grafana](/cockpit/how-to/access-grafana-and-managed-dashboards/) using your credentials.
29+
2. Click the **Toggle menu** then click **Alerting**.
30+
3. Click **Alert rules** and **+ New alert rule**.
31+
4. Scroll down to the **Define query and alert condition** section and click **Switch to data source-managed alert rule**.
32+
<Message type="important">
33+
This allows you to configure alert rules managed by the data source of your choice, instead of using Grafana's managed alert rules.
34+
</Message>
35+
36+
5. Type in a name for your alert.
37+
6. Select the data source you want to configure alerts for. For the sake of this documentation, we are choosing the **Scaleway Metrics** data source.
38+
7. In the Metrics browser drop-down, select the metric you want to configure an alert for. Refer to the table below for details on each alert for Serverless Functions.
39+
40+
**AnyFunctionError**
41+
42+
Pending period
43+
44+
: 10s
45+
46+
Summary
47+
48+
: Function `{{ $labels.resource_name }}` is in error.
49+
50+
Query and alert condition
51+
52+
: `serverless_function_status{status="error"} == 1`
53+
54+
Description
55+
56+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is in error. Check the console to find out the error message.
57+
58+
**FunctionError**
59+
60+
Pending period
61+
62+
: 10s
63+
64+
Summary
65+
66+
: Function `{{ $labels.resource_name }}` is in error.
67+
68+
Query and alert condition
69+
70+
: `serverless_function_status{status="error",resource_id="your-function-id-here"} == 1`
71+
72+
Description
73+
74+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is in error. Check the console to find out the error message.
75+
76+
**AnyFunctionHighCPUUsage**
77+
78+
Pending period
79+
80+
: 10m
81+
82+
Summary
83+
84+
: High CPU usage for function `{{ $labels.resource_name }}`.
85+
86+
Query and alert condition
87+
88+
: `serverless_function_cpu_usage_ratio > 90`
89+
90+
Description
91+
92+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available CPU since 10m.
93+
94+
**FunctionHighCPUUsage**
95+
96+
Pending period
97+
98+
: 10m
99+
100+
Summary
101+
102+
: High CPU usage for function `{{ $labels.resource_name }}`.
103+
104+
Query and alert condition
105+
106+
: `serverless_function_cpu_usage_ratio{resource_id="your-function-id-here"} > 90`
107+
108+
Description
109+
110+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available CPU since 10m.
111+
112+
**AnyFunctionHighMemoryUsage**
113+
114+
Pending period
115+
116+
: 10m
117+
118+
Summary
119+
120+
: High memory usage for function `{{ $labels.resource_name }}`.
121+
122+
Query and alert condition
123+
124+
: `(serverless_function_memory_usage_bytes / serverless_function_memory_limit_bytes) * 100 > 90`
125+
126+
Description
127+
128+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available RAM since 10m.
129+
130+
**FunctionHighMemoryUsage**
131+
132+
Pending period
133+
134+
: 10m
135+
136+
Summary
137+
138+
: High memory usage for function `{{ $labels.resource_name }}`.
139+
140+
Query and alert condition
141+
142+
: `(serverless_function_memory_usage_bytes{resource_id="your-container-id-here"} / serverless_function_memory_limit_bytes{resource_id="your-container-id-here"}) * 100 > 90`
143+
144+
Description
145+
146+
: Function `{{ $labels.resource_name }}` with ID `{{ $labels.resource_id }}` is using more than `{{ printf "%.0f" $value }}`% of its available RAM since 10m.
147+
148+
8. Select labels that apply to the metric you have selected in the previous step, to target your desired resources and fine-tune your alert.
149+
9. Select one or more values for your labels.
150+
10. Click **Use query** to generate your alert based on the conditions you have defined.
151+
11. Select a folder to store your rule, or create a new one. Folders allow you to easily manage your different rules.
152+
12. Select an evaluation group to add your rule to. Rules within the same group are evaluated sequentially over the same time interval.
153+
13. In the **Set alert evaluation behavior** field, configure the amount of time during which the alert can be in breach of the condition(s) you have defined until it triggers.
154+
<Message type="note">
155+
For example, if you wish to be alerted after your alert has been in breach of the condition for 2 minutes without interruption, type `2` and select `minutes` in the drop-down.
156+
</Message>
157+
14. Optionally, add a summary and a description.
158+
15. Click **Save rule** at the top right corner of your screen to save your alert. Once your alert meets the requirements you have configured, you will receive an email to inform you that your alert has been triggered.

pages/serverless-functions/reference-content/functions-autoscaling.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ This parameter sets the lowest value your resource is allowed to scale down to:
2626

2727
- If you set a value of `0`, all instances of your resource will be terminated after 15 minutes of inactivity.
2828

29-
- If you set a value of `1` or more, the corresponding number of instances of your resource will remain available at all time.
29+
- If you set a value of `1` or more, the corresponding number of instances of your resource will remain available at all times.
3030

3131
Customizing the minimum scale for Serverless can help ensure that an instance remains pre-allocated and ready to handle requests, reducing delays associated with [cold starts](/serverless-functions/concepts/#cold-start). However, this setting also impacts the costs of your Serverless Function.
3232

0 commit comments

Comments
 (0)