Skip to content

Commit cf187af

Browse files
feat(cockpit): enable support for contact and alert (#2917)
Co-authored-by: Rémy Léone <rleone@scaleway.com>
1 parent 0179070 commit cf187af

11 files changed

+495
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Disable managed alerts.
4+
5+
USAGE:
6+
scw cockpit alert disable [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
11+
FLAGS:
12+
-h, --help help for disable
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-p, --profile string The config profile to use
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Enable managed alerts.
4+
5+
USAGE:
6+
scw cockpit alert enable [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
11+
FLAGS:
12+
-h, --help help for enable
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-p, --profile string The config profile to use
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Trigger a test alert to all receivers.
4+
5+
USAGE:
6+
scw cockpit alert test [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
11+
FLAGS:
12+
-h, --help help for test
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-p, --profile string The config profile to use
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Managed alerts management commands.
4+
5+
USAGE:
6+
scw cockpit alert <command>
7+
8+
AVAILABLE COMMANDS:
9+
disable Disable managed alerts
10+
enable Enable managed alerts
11+
test Trigger a test alert
12+
13+
FLAGS:
14+
-h, --help help for alert
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
21+
22+
Use "scw cockpit alert [command] --help" for more information about a command.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Create an alert contact point for the default receiver.
4+
5+
USAGE:
6+
scw cockpit contact create [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
[contact-point.email.to]
11+
12+
FLAGS:
13+
-h, --help help for create
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Delete an alert contact point for the default receiver.
4+
5+
USAGE:
6+
scw cockpit contact delete [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
[contact-point.email.to]
11+
12+
FLAGS:
13+
-h, --help help for delete
14+
15+
GLOBAL FLAGS:
16+
-c, --config string The path to the config file
17+
-D, --debug Enable debug mode
18+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
19+
-p, --profile string The config profile to use
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
List alert contact points associated with the given cockpit ID.
4+
5+
USAGE:
6+
scw cockpit contact list [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
11+
FLAGS:
12+
-h, --help help for list
13+
14+
GLOBAL FLAGS:
15+
-c, --config string The path to the config file
16+
-D, --debug Enable debug mode
17+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
18+
-p, --profile string The config profile to use
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Contacts management commands.
4+
5+
USAGE:
6+
scw cockpit contact <command>
7+
8+
AVAILABLE COMMANDS:
9+
create Create an alert contact point
10+
delete Delete an alert contact point
11+
list List alert contact points
12+
13+
FLAGS:
14+
-h, --help help for contact
15+
16+
GLOBAL FLAGS:
17+
-c, --config string The path to the config file
18+
-D, --debug Enable debug mode
19+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
20+
-p, --profile string The config profile to use
21+
22+
Use "scw cockpit contact [command] --help" for more information about a command.

cmd/scw/testdata/test-all-usage-cockpit-usage.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ USAGE:
66
scw cockpit <command>
77

88
AVAILABLE COMMANDS:
9+
alert Managed alerts management commands
910
cockpit Cockpit management commands
11+
contact Contacts management commands
1012
grafana-user Grafana user management commands
1113
token Token management commands
1214

docs/commands/cockpit.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
# Documentation for `scw cockpit`
33
Cockpit API.
44

5+
- [Managed alerts management commands](#managed-alerts-management-commands)
6+
- [Disable managed alerts](#disable-managed-alerts)
7+
- [Enable managed alerts](#enable-managed-alerts)
8+
- [Trigger a test alert](#trigger-a-test-alert)
59
- [Cockpit management commands](#cockpit-management-commands)
610
- [Activate a cockpit](#activate-a-cockpit)
711
- [Deactivate a cockpit](#deactivate-a-cockpit)
812
- [Get cockpit](#get-cockpit)
913
- [Reset Grafana](#reset-grafana)
1014
- [Wait for a cockpit to reach a stable state (installation)](#wait-for-a-cockpit-to-reach-a-stable-state-(installation))
15+
- [Contacts management commands](#contacts-management-commands)
16+
- [Create an alert contact point](#create-an-alert-contact-point)
17+
- [Delete an alert contact point](#delete-an-alert-contact-point)
18+
- [List alert contact points](#list-alert-contact-points)
1119
- [Grafana user management commands](#grafana-user-management-commands)
1220
- [Create a grafana user](#create-a-grafana-user)
1321
- [Delete a grafana user](#delete-a-grafana-user)
@@ -20,6 +28,68 @@ Cockpit API.
2028
- [List tokens](#list-tokens)
2129

2230

31+
## Managed alerts management commands
32+
33+
Managed alerts management commands.
34+
35+
36+
### Disable managed alerts
37+
38+
Disable managed alerts.
39+
40+
**Usage:**
41+
42+
```
43+
scw cockpit alert disable [arg=value ...]
44+
```
45+
46+
47+
**Args:**
48+
49+
| Name | | Description |
50+
|------|---|-------------|
51+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
52+
53+
54+
55+
### Enable managed alerts
56+
57+
Enable managed alerts.
58+
59+
**Usage:**
60+
61+
```
62+
scw cockpit alert enable [arg=value ...]
63+
```
64+
65+
66+
**Args:**
67+
68+
| Name | | Description |
69+
|------|---|-------------|
70+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
71+
72+
73+
74+
### Trigger a test alert
75+
76+
Trigger a test alert to all receivers.
77+
78+
**Usage:**
79+
80+
```
81+
scw cockpit alert test [arg=value ...]
82+
```
83+
84+
85+
**Args:**
86+
87+
| Name | | Description |
88+
|------|---|-------------|
89+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
90+
91+
92+
2393
## Cockpit management commands
2494

2595
Cockpit management commands.
@@ -130,6 +200,70 @@ scw cockpit cockpit wait 11111111-1111-1111-1111-111111111111
130200

131201

132202

203+
## Contacts management commands
204+
205+
Contacts management commands.
206+
207+
208+
### Create an alert contact point
209+
210+
Create an alert contact point for the default receiver.
211+
212+
**Usage:**
213+
214+
```
215+
scw cockpit contact create [arg=value ...]
216+
```
217+
218+
219+
**Args:**
220+
221+
| Name | | Description |
222+
|------|---|-------------|
223+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
224+
| contact-point.email.to | | |
225+
226+
227+
228+
### Delete an alert contact point
229+
230+
Delete an alert contact point for the default receiver.
231+
232+
**Usage:**
233+
234+
```
235+
scw cockpit contact delete [arg=value ...]
236+
```
237+
238+
239+
**Args:**
240+
241+
| Name | | Description |
242+
|------|---|-------------|
243+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
244+
| contact-point.email.to | | |
245+
246+
247+
248+
### List alert contact points
249+
250+
List alert contact points associated with the given cockpit ID.
251+
252+
**Usage:**
253+
254+
```
255+
scw cockpit contact list [arg=value ...]
256+
```
257+
258+
259+
**Args:**
260+
261+
| Name | | Description |
262+
|------|---|-------------|
263+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
264+
265+
266+
133267
## Grafana user management commands
134268

135269
Grafana user management commands.

0 commit comments

Comments
 (0)