-
Notifications
You must be signed in to change notification settings - Fork 821
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
434 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
workflow: | ||
id: query-victoriametrics | ||
name: victoriametrics-alert-example | ||
description: victoriametrics | ||
triggers: | ||
- type: manual | ||
steps: | ||
- name: victoriametrics-step | ||
provider: | ||
config: "{{ providers.vm }}" | ||
type: victoriametrics | ||
with: | ||
query: avg(rate(process_cpu_seconds_total)) | ||
queryType: query | ||
|
||
actions: | ||
- name: create-alert | ||
alias: | ||
# assign the value of the query result to the alias `cpu` | ||
# so we can use it anywhere in the action | ||
cpu: "{{ steps.victoriametrics-step.results.data.result.0.value.1 }}" | ||
# only create an alert if the CPU usage is greater than 0.005 | ||
if: "{{ aliases.cpu }} > 0.005 " | ||
provider: | ||
type: keep | ||
# create an alert with the following details | ||
with: | ||
name: "High CPU Usage" | ||
description: "CPU usage is high on the VM (created from VM metric)" | ||
severity: '{{ aliases.cpu }} > 0.9 ? "critical" : {{ aliases.cpu }} > 0.7 ? "warning" : "info"' | ||
labels: | ||
environment: production | ||
app: myapp | ||
service: api | ||
team: devops | ||
owner: alice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.