Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

MQL to PROMQL conversion fails error for a NetApp Volume Monitor

Google states here that:  MQL is no longer the recommended query language for Cloud Monitoring
   https://cloud.google.com/stackdriver/docs/deprecations/mql

Therefore I am trying to convert my NetApp Volume monitor from MQL to PROMQL. I used these mappings to convert MQL to PROMQL:
  https://cloud.google.com/monitoring/promql/promql-mapping
  
When I try to create a new alert using google's promql query editor, I get this error:
An error occurred requesting data. bad_data: invalid parameter "query": substitute queries failed: 1:7: parse error: unexpected metric identifier "netapp_googleapis_com:Volume

Here is my MQL and converted PROMQL code, what am I doing wrong?

======== current working mql NetApp Volume monitor ============
fetch netapp.googleapis.com/Volume
| {
metric 'netapp.googleapis.com/volume/bytes_used'
;
metric 'netapp.googleapis.com/volume/allocated_bytes'
} | join | div
| group_by 5m, max(val())
| every 5m
| condition val() > 80 '%'

===== converted mql to promql that gives error =================
fetch netapp_googleapis_com:Volume
| {
metric 'netapp_googleapis_com:volume_bytes_used'
;
metric 'netapp_googleapis_com:volume_allocated_bytes'
} | join | div
| group_by 5m, max(val())
| every 5m
| condition val() > 80 '%'

Solved Solved
1 3 882
1 ACCEPTED SOLUTION

Hello @tacoma50  ,Welcome on Google Cloud Community.

AFAIR PromQL syntax, you should not use "fetch" when you are dealing with PromQL queries. Did you've tried something like 

(netapp_googleapis_com_volume_bytes_used / netapp_googleapis_com_volume_allocated_bytes) * 100 > 80 or 
max_over_time( ( netapp_googleapis_com:volume_bytes_used / netapp_googleapis_com:volume_allocated_bytes )[5m:] ) > 0.8
 

View solution in original post

3 REPLIES 3

Hello @tacoma50  ,Welcome on Google Cloud Community.

AFAIR PromQL syntax, you should not use "fetch" when you are dealing with PromQL queries. Did you've tried something like 

(netapp_googleapis_com_volume_bytes_used / netapp_googleapis_com_volume_allocated_bytes) * 100 > 80 or 
max_over_time( ( netapp_googleapis_com:volume_bytes_used / netapp_googleapis_com:volume_allocated_bytes )[5m:] ) > 0.8
 

Hi DamianS,
I tried this PromQL code and it worked. Thanks!

max_over_time( (( netapp_googleapis_com:volume_bytes_used / netapp_googleapis_com:volume_allocated_bytes ) *100)[5m:] ) > 80

Hello @tacoma50 ,

happy to help 🙂