You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/monitor_registering.md
+30-8Lines changed: 30 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,16 +9,16 @@ A monitor consists of:
9
9
-**Optional Additional Files**: Supporting resources used during the monitor's execution, such as SQL query files or other data files.
10
10
11
11
## Registration Process
12
-
To register a monitor, use the POST method with the `monitors/register/` route, providing all the required information in the request.
12
+
```
13
+
POST monitors/register/{monitor_name}
14
+
```
13
15
14
-
1.**Request URL**:
15
-
Format the URL as `monitors/register/{monitor_name}`, where `{monitor_name}` is the name of the monitor being created or updated.
16
-
Example: `monitors/register/my_monitor`
16
+
Parameters:
17
+
-`{monitor_name}` is the name of the monitor being created or updated.
17
18
18
-
2.**Request Payload**:
19
-
The payload should include the following fields:
20
-
-`monitor_code`: The content of the monitor’s main `.py` file content.
21
-
-`additional_files`: Optional field with an object where the keys are the names of additional files, and the values are their content.
19
+
The payload should include the following fields:
20
+
-`monitor_code`: The content of the monitor’s main `.py` file content.
21
+
-`additional_files`: Optional field with an object where the keys are the names of additional files, and the values are their content.
22
22
23
23
Example:
24
24
```json
@@ -30,6 +30,28 @@ Example:
30
30
}
31
31
```
32
32
33
+
## Responses
34
+
The response will contain the status of the registration process. The field `status` will be set to `monitor_registered` if the monitor was successfully registered and the monitor id will be in the `monitor_id` field.
35
+
36
+
Example:
37
+
```json
38
+
{
39
+
"status": "monitor_registered",
40
+
"monitor_id": 123
41
+
}
42
+
```
43
+
44
+
If the registration fails, the `status` field will be set to `error` and the field `message` will contain the error message. Depending on the error, additional fields may be present to help diagnose the issue.
45
+
46
+
Example:
47
+
```json
48
+
{
49
+
"status": "error",
50
+
"message": "Module didn't pass check",
51
+
"error": "Monitor 'my_monitor' has the following errors:\n 'monitor_options' is required"
52
+
}
53
+
```
54
+
33
55
## Monitor register tool
34
56
To simplify the registration process, a Python script is available in the `tools` folder.
Validating a monitor is a important step before registering it. This process ensures that the monitor code is correct and can be executed by Sentinela. This is useful when using a deployment pipeline to ensure that the monitor is correctly implemented before being deployed.
3
+
4
+
## Validation Process
5
+
```
6
+
POST monitors/validate/
7
+
```
8
+
9
+
The payload should include the following fields:
10
+
-`monitor_code`: The content of the monitor’s main `.py` file content.
11
+
12
+
Example:
13
+
```json
14
+
{
15
+
"monitor_code": "...",
16
+
}
17
+
```
18
+
19
+
## Responses
20
+
The response will contain the status of the validation process. The field `status` will be set to `monitor_validated` if the monitor was successfully validated.
21
+
22
+
Example:
23
+
```json
24
+
{
25
+
"status": "monitor_validated",
26
+
}
27
+
```
28
+
29
+
If the validation fails, the `status` field will be set to `error` and the field `message` will contain the error message. Depending on the error, additional fields may be present to help diagnose the issue.
30
+
31
+
Example:
32
+
```json
33
+
{
34
+
"status": "error",
35
+
"message": "Module didn't pass check",
36
+
"error": "Monitor has the following errors:\n 'monitor_options' is required"
0 commit comments