2021-12-30 22:50:27 +00:00
# Automations
You can configure automations in Fleet to send a webhook request if a certain condition is met.
2022-04-12 18:48:15 +00:00
[Vulnerability automations ](#vulnerability-automations ) send a webhook request if a new vulnerability (CVE) is
2022-02-14 02:12:51 +00:00
detected on at least one host.
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
[Policy automations ](#policy-automations ) send a webhook request if a policy is newly failing on at
least one host.
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
[Host status automations ](#host-status-automations ) send a webhook request if a configured
percentage of hosts have not checked in to Fleet for a configured number of days.
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
## Vulnerability automations
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
Vulnerability automations send a webhook request if a new vulnerability (CVE) is
found on at least one host.
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
> Note that a CVE is "new" if it was published to the national vulnerability (NVD) database within
2022-04-12 18:48:15 +00:00
> the last 30 days (by default).
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
Fleet sends these webhook requests once every hour. If two new vulnerabilities are detected
within the hour, two
2022-02-23 18:17:55 +00:00
webhook requests are sent. This interval can be updated with the [`vulnerabilities_periodicity` configuration option ](../Deploying/Configuration.md#periodicity ).
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
Example webhook payload:
```
POST https://server.com/example
```
```json
{
"timestamp": "0000-00-00T00:00:00Z",
"vulnerability": {
"cve": "CVE-2014-9471",
"details_link": "https://nvd.nist.gov/vuln/detail/CVE-2014-9471",
"hosts_affected": [
{
"id": 1,
"hostname": "macbook-1",
"url": "https://fleet.example.com/hosts/1"
},
{
"id": 2,
"hostname": "macbook-2",
"url": "https://fleet.example.com/hosts/2"
}
]
}
}
```
## Policy automations
Policy automations send a webhook request if a policy is newly failing on at
2022-04-12 18:48:15 +00:00
least one host.
2022-02-14 02:12:51 +00:00
> Note that a policy is "newly failing" if a host updated its response from "no response" to "failing"
2022-04-12 18:48:15 +00:00
> or from "passing" to "failing."
2022-02-14 02:12:51 +00:00
Fleet sends these webhook requests once per day. If two policies are newly failing
within the day, two webhook requests are sent. This interval can be updated with the `webhook_settings.interval`
configuration option using the [`config` yaml document ](./configuration-files/README.md#organization-settings ) and the `fleetctl apply` command.
2021-12-30 22:50:27 +00:00
Example webhook payload:
```
POST https://server.com/example
```
```json
{
"timestamp": "0000-00-00T00:00:00Z",
"policy": {
"id": 1,
"name": "Is Gatekeeper enabled?",
"query": "SELECT 1 FROM gatekeeper WHERE assessments_enabled = 1;",
"description": "Checks if gatekeeper is enabled on macOS devices.",
"author_id": 1,
"author_name": "John",
"author_email": "john@example.com",
"resolution": "Turn on Gatekeeper feature in System Preferences.",
"passing_host_count": 2000,
"failing_host_count": 300
},
"hosts": [
{
"id": 1,
"hostname": "macbook-1",
"url": "https://fleet.example.com/hosts/1"
},
{
"id": 2,
"hostname": "macbbook-2",
"url": "https://fleet.example.com/hosts/2"
}
]
}
```
2022-02-14 02:12:51 +00:00
To enable policy automations, navigate to **Policies > Manage automations** in the Fleet UI.
2021-12-30 22:50:27 +00:00
## Host status automations
2022-02-14 02:12:51 +00:00
Host status automations send a webhook request if a configured
percentage of hosts have not checked in to Fleet for a configured number of days.
2021-12-30 22:50:27 +00:00
2022-02-14 02:12:51 +00:00
Fleet sends these webhook requests once per day. This interval can be updated with the `webhook_settings.interval`
configuration option using the [`config` yaml document ](./configuration-files/README.md#organization-settings ) and the `fleetctl apply` command.
2021-12-30 22:50:27 +00:00
Example webhook payload:
```
POST https://server.com/example
```
```json
{
2022-04-12 18:48:15 +00:00
"text": "More than X% of your hosts have not checked into Fleet
for more than X days. You’ ve been sent this message
because the Host status webhook is enabeld in your Fleet
2021-12-30 22:50:27 +00:00
instance.",
"data": {
"unseen_hosts": 1,
"total_hosts": 2,
"days_unseen": 3,
}
}
2022-02-14 02:12:51 +00:00
```
To enable and configure host status automations, navigate to **Settings > Organization settings > Host
status webhook** in the Fleet UI.
2022-02-23 18:17:55 +00:00
2022-04-12 18:48:15 +00:00
< meta name = "pageOrderInSection" value = "1300" >