On 14 Jul 01:28, Yashar Nesabian wrote:
> Hi
> I have an alert which fires when a CPU temperature is in the critical state:
> ipmi_temperature_state{id="21",name="02-CPU 1"} == 2
> And I have another metric which shows the temperature of this CPU:
> 
> ipmi_temperature_celsius{id="21",name="02-CPU 1"}
> 
> I wonder if it is possible to print the output of the second metric when 
> the alert fires?


Yes:


Simple answer:

Use:
 ipmi_temperature_celsius and (ipmi_temperature_state == 2)

as alerting query

and use "{{$value}}"

Complex answer (please don't use):

  {{ $q := printf "ipmi_temperature_celsius{id='%s',name='%s'}" $labels.id 
$labels.name}}ยท
  {{ with query $q }}
  {{ . | first | value | humanize }}
  {{ end }}

  https://prometheus.io/docs/prometheus/latest/configuration/template_examples/

> 
> 
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/prometheus-users/1a2d49e8-4692-4e56-92ec-b1389afff8d3o%40googlegroups.com.


-- 
Julien Pivotto
@roidelapluie

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/20200714093932.GA80849%40oxygen.

Reply via email to