diff --git a/docs/script_variables.md b/docs/script_variables.md index 76c7a422..d3e742bc 100644 --- a/docs/script_variables.md +++ b/docs/script_variables.md @@ -1,6 +1,9 @@ # Script Variables -Tactical RMM allows passing dashboard data into script as arguments or environment variables. This uses the syntax `{{model.field}}`. +Tactical RMM allows passing dashboard data into script as arguments or environment variables. This uses the syntax `{{model.field}}`. + +!!!info + Nested relations are followed so something like `{{agent.site.name}}` will work. For a full list of available fields, refer to the variables in the `models.py` files: @@ -12,6 +15,14 @@ For a full list of available fields, refer to the variables in the `models.py` f [Alert](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/alerts/models.py#L29) +[Check](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/checks/models.py#L30) + +[CheckResult](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/checks/models.py#L281) + +[AutomatedTask](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/autotasks/models.py#L51) + +[TaskResult](https://github.com/amidaware/tacticalrmm/blob/89aceda65a1c54fea7b18250ca63614f091eac6e/api/tacticalrmm/autotasks/models.py#L464) + Below are some examples of available fields: !!!info @@ -50,6 +61,7 @@ Below are some examples of available fields: - **{{agent.maintenance_mode}}** - Returns true if agent is in maintenance mode. - **{{agent.block_policy_inheritance}}** - Returns true if agent has block policy inheritance. - **{{agent.alert_template}}** - Returns true if agent has block policy inheritance. +- **{{agent.site}}** - The site that the agent belongs too. Can be used for nesting. See Aite above for properties ## Client @@ -58,6 +70,7 @@ Below are some examples of available fields: ## Site - **{{site.name}}** - Returns name of Site. +- **{{site.client}}** - The client that the site belongs too. Can be used for nesting. See Client above for properties ## Alert @@ -67,3 +80,29 @@ Below are some examples of available fields: - **{{alert.alert_time}}** - Time of the alert. - **{{alert.message}}** - Alert message. - **{{alert.severity}}** - Severity of the alert *info, warning, or error*. +- **{{alert.alert_type}}** - The type of alert. Will be *availability, check, task, or custom*. +- **{{alert.snoozed}}** - Returns true if the alert is snoozed. +- **{{alert.snoozed_until}}** - Returns the datetime that the alert is unsnoozed. +- **{{alert.email_sent}}** - Returns true if this alert has triggered a failure email. +- **{{alert.resolved_email_sent}}** - Returns true if this alert has triggered a resolved email. +- **{{alert.sms_sent}}** - Returns true if this alert has triggered a failure text. +- **{{alert.resolved_sms_sent}}** - Returns true if this alert has triggered a resolved text. +- **{{alert.hidden}}** - Returns true if this alert is hidden. It won't show in the alerts icon in the dashboard +- **{{alert.action_run}}** - Returns datetime that an alert failure action was run. +- **{{alert.action_stdout}}** - Returns standard output of the alert failure action results. +- **{{alert.action_stderr}}** - Returns error output of the alert failure action results. +- **{{alert.action_retcode}}** - Returns return code of the alert failure action. +- **{{alert.resolved_action_run}}** - Returns datetime that an alert resolved action was run. +- **{{alert.resolved_action_stdout}}** - Returns standard output of the alert resolved action results. +- **{{alert.resolved_action_stderr}}** - Returns error output of the alert resolved action results. +- **{{alert.resolved_action_retcode}}** - Returns return code of the alert resolved action. + +- **{{alert.agent}}** - The agent that triggered the alert. Can be used for nesting. See Agent above for properties. +- **{{alert.assigned_check}}** - The check that triggered the alert. Can be used for nesting. See Check above for properties. +- **{{alert.assigned_check.readable_desc}}** - This will return the name that is used in the UI for the check. +- **{{alert.assigned_task}}** - The automated task that triggered the alert. Can be used for nesting. See Automated Task above for properties. +- - **{{alert.assigned_task.name}}** - This will return the name that is used in the UI for the automated task. +- **{{alert.site}}** - The site associated with the agent that triggered the alert. Can be used for nesting. See Site above for properties. +- **{{alert.client}}** - The client associated with the agent that triggered the alert. Can be used for nesting. See Client above for properties. + +- **{{alert.get_result}}** - Will return the results of the associated check or automated task. Can be used for nesting. See CheckResult or TaskResult above for properties. This will be blank for agent availability alerts.