-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from vshn/pg/add_max_connections_alert
Add max connection alert
- Loading branch information
Showing
4 changed files
with
47 additions
and
19 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
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
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,25 @@ | ||
package vshnpostgres | ||
|
||
import ( | ||
promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" | ||
"github.com/vshn/appcat/v4/pkg/comp-functions/functions/common/nonsla" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
) | ||
|
||
var maxConnectionsAlert = promv1.Rule{ | ||
Alert: "PostgreSQLConnectionsCritical", | ||
Annotations: map[string]string{ | ||
"description": "The connections to {{ $labels.pod }} have been over 90% of the configured connections for 2 hours.\n Please reduce the load of this instance.", | ||
"runbook_url": "https://kb.vshn.ch/app-catalog/how-tos/appcat/vshn/postgres/PostgreSQLConnectionsCritical.html", | ||
"summary": "Connection usage critical", | ||
}, | ||
Expr: intstr.IntOrString{ | ||
Type: intstr.String, | ||
StrVal: "sum(pg_stat_activity_count) by (pod)\n > 90/100 * sum(pg_settings_max_connections) by (pod)", | ||
}, | ||
For: nonsla.TwoHourInterval, | ||
Labels: map[string]string{ | ||
"severity": nonsla.SeverityCritical, | ||
"syn_team": nonsla.SynTeam, | ||
}, | ||
} |
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