Skip to content

Commit

Permalink
Merge pull request #8 from adinhodovic/allow-disabling-alerts
Browse files Browse the repository at this point in the history
feat(alerts): Allow disabling alerts
  • Loading branch information
adinhodovic authored Jan 19, 2025
2 parents c28f829 + f4fcbce commit 33b1e35
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vendor
tmp
jsonnetfile.lock.json
./dashboards_out/lint
dashboards_out/.lint
70 changes: 35 additions & 35 deletions alerts/alerts.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@
groups+: [
{
name: 'argo-cd',
rules: [
rules: std.prune([
{
alert: 'ArgoCdAppOutOfSync',
alert: 'ArgoCdAppSyncFailed',
expr: |||
sum(
argocd_app_info{
%(argoCdSelector)s,
sync_status!="Synced"
}
) by (job, dest_server, project, name, sync_status)
> 0
round(
increase(
argocd_app_sync_total{
%(argoCdSelector)s,
phase!="Succeeded"
}[%(argoCdAppSyncInterval)s]
)
)
) by (job, dest_server, project, name, phase) > 0
||| % $._config,
labels: {
severity: 'warning',
},
'for': $._config.argoCdAppOutOfSyncFor,
'for': '1m',
annotations: {
summary: 'An ArgoCD Application is Out Of Sync.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} is out of sync with the sync status {{ $labels.sync_status }} for the past %s.' % $._config.argoCdAppOutOfSyncFor,
summary: 'An ArgoCD Application has Failed to Sync.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} has failed to sync with the status {{ $labels.phase }} the past %s.' % $._config.argoCdAppSyncInterval,
dashboard_url: $._config.applicationOverviewDashboardUrl + '?var-dest_server={{ $labels.dest_server }}&var-project={{ $labels.project }}&var-application={{ $labels.name }}',
},
},
{
if $._config.argoCdAppUnhealthyEnabled then {
alert: 'ArgoCdAppUnhealthy',
expr: |||
sum(
Expand All @@ -46,49 +49,46 @@
dashboard_url: $._config.applicationOverviewDashboardUrl + '?var-dest_server={{ $labels.dest_server }}&var-project={{ $labels.project }}&var-application={{ $labels.name }}',
},
},
{
alert: 'ArgoCdAppAutoSyncDisabled',
if $._config.argoCdAppOutOfSyncEnabled then {
alert: 'ArgoCdAppOutOfSync',
expr: |||
sum(
argocd_app_info{
%(argoCdSelector)s,
autosync_enabled!="true",
name!~"%(argoAutoSyncDisabledIgnoredApps)s"
sync_status!="Synced"
}
) by (job, dest_server, project, name, autosync_enabled)
) by (job, dest_server, project, name, sync_status)
> 0
||| % $._config,
labels: {
severity: 'warning',
},
'for': $._config.argoCdAppAutoSyncDisabledFor,
'for': $._config.argoCdAppOutOfSyncFor,
annotations: {
summary: 'An ArgoCD Application has AutoSync Disabled.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} has autosync disabled for the past %s.' % $._config.argoCdAppAutoSyncDisabledFor,
summary: 'An ArgoCD Application is Out Of Sync.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} is out of sync with the sync status {{ $labels.sync_status }} for the past %s.' % $._config.argoCdAppOutOfSyncFor,
dashboard_url: $._config.applicationOverviewDashboardUrl + '?var-dest_server={{ $labels.dest_server }}&var-project={{ $labels.project }}&var-application={{ $labels.name }}',
},
},
{
alert: 'ArgoCdAppSyncFailed',
if $._config.argoCdAppAutoSyncDisabledEnabled then {
alert: 'ArgoCdAppAutoSyncDisabled',
expr: |||
sum(
round(
increase(
argocd_app_sync_total{
%(argoCdSelector)s,
phase!="Succeeded"
}[%(argoCdAppSyncInterval)s]
)
)
) by (job, dest_server, project, name, phase) > 0
argocd_app_info{
%(argoCdSelector)s,
autosync_enabled!="true",
name!~"%(argoAutoSyncDisabledIgnoredApps)s"
}
) by (job, dest_server, project, name, autosync_enabled)
> 0
||| % $._config,
labels: {
severity: 'warning',
},
'for': '1m',
'for': $._config.argoCdAppAutoSyncDisabledFor,
annotations: {
summary: 'An ArgoCD Application has Failed to Sync.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} has failed to sync with the status {{ $labels.phase }} the past %s.' % $._config.argoCdAppSyncInterval,
summary: 'An ArgoCD Application has AutoSync Disabled.',
description: 'The application {{ $labels.dest_server }}/{{ $labels.project }}/{{ $labels.name }} has autosync disabled for the past %s.' % $._config.argoCdAppAutoSyncDisabledFor,
dashboard_url: $._config.applicationOverviewDashboardUrl + '?var-dest_server={{ $labels.dest_server }}&var-project={{ $labels.project }}&var-application={{ $labels.name }}',
},
},
Expand Down Expand Up @@ -116,7 +116,7 @@
dashboard_url: $._config.notificationsOverviewDashboardUrl + '?var-job={{ $labels.job }}&var-exported_service={{ $labels.exported_service }}',
},
},
],
]),
},
],
},
Expand Down
3 changes: 3 additions & 0 deletions config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ local annotation = g.dashboard.annotation;

tags: ['ci/cd', 'argo-cd'],

argoCdAppOutOfSyncEnabled: true,
argoCdAppOutOfSyncFor: '15m',
argoCdAppUnhealthyEnabled: true,
argoCdAppUnhealthyFor: '15m',
argoCdAppAutoSyncDisabledEnabled: true,
argoCdAppAutoSyncDisabledFor: '2h',
argoCdAppSyncInterval: '10m',
argoCdNotificationDeliveryInterval: '10m',
Expand Down
5 changes: 0 additions & 5 deletions dashboards_out/.lint

This file was deleted.

24 changes: 12 additions & 12 deletions dashboards_out/argo-cd-application-overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -115,7 +115,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -166,7 +166,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -217,7 +217,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -247,7 +247,7 @@
"content": "No applications defined",
"mode": "markdown"
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"title": "Application Badges",
"type": "text"
},
Expand Down Expand Up @@ -329,7 +329,7 @@
}
]
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -435,7 +435,7 @@
}
]
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -541,7 +541,7 @@
}
]
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -647,7 +647,7 @@
}
]
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -735,7 +735,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -785,7 +785,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -835,7 +835,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down
4 changes: 2 additions & 2 deletions dashboards_out/argo-cd-notifications-overview.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down Expand Up @@ -115,7 +115,7 @@
"sort": "desc"
}
},
"pluginVersion": "v11.0.0",
"pluginVersion": "v11.4.0",
"targets": [
{
"datasource": {
Expand Down
Loading

0 comments on commit 33b1e35

Please sign in to comment.