# Checks

Checks are simple and very fast queries that return only one value. For example, average CPU utilisation over the last 5 minutes:

```sql
select avg(cntr_value_calculated) 
from dbo.vw_sqlwatch_report_fact_perf_os_performance_counters
where counter_name = 'Processor Time %'
and report_time > dateadd(minute,-5,getutcdate())
```

The result of the check are compared to the given thresholds:

![](https://3496302873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-LtRnQqJHtQdR9Vxn1nc%2F-LtRoTZQZKcC6NsrKpet%2Fimage.png?alt=media\&token=f6319828-cbab-430f-bfe1-fdb98f5b3fcc)

There are three possible status, based on the comparison:

**OK**, **WARNING** or **CRITICAL**.

Based on the above example, if the average CPU utilisation is below 60%, the check will return an OK status. If it is above 60% but below 80%, it will return WARNING and if over 80%, it fill return CRITICAL status. Check outputs and statuses are logged in a table:

![\[dbo\].\[sqlwatch\_logger\_check\]](https://3496302873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-LtRpQQXLU404pcyg5b6%2F-LtRq-JVSh9Hxa-stQrW%2Fimage.png?alt=media\&token=fed24b51-40ea-4fca-9819-e6c9de095e50)

If the check does not return an OK status, it can optionally trigger an action. Alternatively, if it comes back from a WARNING or a CRITICAL status, it can trigger a recovery message informing that that the problem has been resolved.&#x20;

### Association with Actions

Checks are associated with actions in the `[dbo].[sqlwatch_config_check_action]` table. This way one check can call multiple different actions.

![](https://3496302873-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LamHUpIpVXoBUUDZZpO%2F-Lt_wSMD0xZDT9Ner7s9%2F-Lt_waDfM1feM9pIK_Kl%2Fimage.png?alt=media\&token=bb99603a-29e2-4bcf-bd77-9c1e40291adc)
