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.md
+35-1Lines changed: 35 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,9 +56,10 @@ To create a monitor, import specific dependencies from `monitor_utils`. Availabl
56
56
-[`ValueRule`](#value-rule)
57
57
-[`PriorityLevels`](#priority-levels)
58
58
59
-
**Functions**
59
+
**Available functions and modules**
60
60
-[`query`](#query)
61
61
-[`read_file`](#read-file)
62
+
-[`variables`](#variables)
62
63
63
64
To get started with a simple monitor, use the following imports:
64
65
@@ -360,5 +361,38 @@ The function takes 2 parameters:
360
361
content = read_file("search_query.sql")
361
362
```
362
363
364
+
## Variables
365
+
The `variables` module allows storing and retrieving variables that can be used across executions of the monitor. This is useful for maintaining state or configuration information.
366
+
367
+
Available functions are:
368
+
369
+
**`get_variable`**
370
+
371
+
The function takes one parameter:
372
+
-`name`: The name of the variable to retrieve.
373
+
374
+
Return the value of a variable. If the variable does not exist, returns `None`.
375
+
376
+
**`set_variable`**
377
+
378
+
The function takes two parameters:
379
+
-`name`: The name of the variable to set.
380
+
-`value`: The value to assign to the variable.
381
+
382
+
Sets the value of a variable. If the variable does not exist yet, it's created.
383
+
384
+
Both functions must be called from functions defined in the monitor base code. If they're called from any other Python file, they will raise an error as they won't be able to identify the monitor that's calling it.
After creating the monitor, the next step is to register it on Sentinela. Check the [Registering a monitor](monitor_registering.md) documentation for more information.
0 commit comments