On 22.02.21 09:29, Faik OZCAN wrote:
> Hi , How can I show the total disk capacity on the rule I created with
> Prometheus alert manager. Sample code
>
> -
>
> alert: Windows_Low_Disk_Alert
>
> expr: 100.0 - 100 * ((windows_logical_disk_free_bytes / 1024 / 1024 ) /
> (windows_logical_disk_size_bytes / 1024 / 1024)) > 99.10
>
> for: 5m
>
> labels:
>
> severity: 'Warning'
>
> annotations:
>
> Runbook_url:
>
> DiskTotalSize : ??
There is no real straightforward way to do that, but you can include
queries in the templating. As a starting point, something like the
following could work as an annotation:
```
description: 'Disk {{$labels.volume}} on {{$labels.instance}} is {{$value | humanize}}% full. Total size is {{ printf `windows_logical_disk_size_bytes{instance="%s",volume="%s"}` $labels.instance $labels.volume | query | first | humanize }} bytes.'
```
--
Björn Rabenstein
[PGP-ID] 0x851C3DA17D748D03
[email]
bjo...@rabenste.in