Integrated Alerting / Alerts

Below for mysql lock wait time out, i think it has some error, please suggest me

====================================================================
---
templates:
    - name: mysql_innodb_lock_wait_timeout
      version: 1
      summary: MySQL lock wait timeout
      tiers: [anonymous, registered]
      expr: |-
        max_over_time(mysql_global_status_Innodb_row_lock_time_max[1m]) / ignoring (job)
        innodb_lock_wait_timeout
        * 100
        > [[ .threshold ]]
      params:
        - name: threshold
          summary: A percentage from configured maximum
          unit: '%'
          type: float
          range: [0, 100]
          value: 80
      for: 5m
      severity: warning
      labels:
        foo: bar
      annotations:
        description: |-
            More than [[ .threshold ]]% of MySQL lock_wait_timeout on {{ $labels.instance }}
            VALUE = {{ $value }}
            LABELS: {{ $labels }}
        summary: MySQL lock_wait_timeout (instance {{ $labels.instance }})

Are you getting an error of any kind in the Template creation UI? YAML is finicky about spacing so you might try this if you’re getting a paste error:

---
templates:
- name: mysql_innodb_lock_wait_timeout
  version: 1
  summary: MySQL lock wait timeout
  tiers: [anonymous, registered]
  expr: |-
    max_over_time(mysql_global_status_Innodb_row_lock_time_max[1m]) / ignoring (job)
    innodb_lock_wait_timeout * 100 > [[ .threshold ]]
  params:
    - name: threshold
      summary: A percentage from configured maximum
      unit: '%'
      type: float
      range: [0, 100]
      value: 80
  for: 5m
  severity: warning
  labels:
    foo: bar
  annotations:
    description: |-
      More than [[ .threshold ]]% of MySQL lock_wait_timeout on {{ $labels.instance }}
      VALUE = {{ $value }}
      LABELS: {{ $labels }}
    summary: MySQL lock_wait_timeout (instance {{ $labels.instance }})

Have you validated that your expression returns results (I tend to use the explore option in PMM to paste my expression and see what results I get back)

If all else fails you can look inside the container at /srv/logs/pmm-managed.log or /srv/logs/alertmanager.log to see if either provides more info about what’s going wrong.

edit I tried pasting in my test instance and found that you had an incorrect single quote for unit:`%’ and some indentation issues.

1 Like

Hi steve,
i am not getting any kind of error to template creation UI.
is it right template to send lock wait time out alerts. i tried what you shared template alignment, but i am not getting alert

1 Like

Could you try to use metric mysql_global_variables_innodb_lock_wait_timeout in the alert formula?

max_over_time(mysql_global_status_innodb_row_lock_time_max[1m]) / ignoring (job) mysql_global_variables_innodb_lock_wait_timeout * 100
2 Likes

Thanks adivinho, now its working