Skip to content

Commit

Permalink
Add mssqlserver alerts (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Neaj Morshad <neaj@appscode.com>
  • Loading branch information
Neaj-Morshad-101 authored Dec 17, 2024
1 parent 9699323 commit caf8a0a
Show file tree
Hide file tree
Showing 16 changed files with 2,391 additions and 0 deletions.
100 changes: 100 additions & 0 deletions apis/alerts/v1alpha1/mssqlserver_alerts_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the AppsCode Community License 1.0.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
mona "kmodules.xyz/monitoring-agent-api/api/v1"
api "x-helm.dev/apimachinery/apis/releases/v1alpha1"
)

const (
ResourceKindMSSQLServerAlerts = "MSSQLServerAlerts"
ResourceMSSQLServerAlerts = "mssqlserveralerts"
ResourceMSSQLServerAlertss = "mssqlserveralertss"
)

// MSSQLServerAlerts defines the schema for KubeDB Ops Manager Operator Installer.

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=mssqlserveralertss,singular=mssqlserveralerts,categories={kubedb,appscode}
type MSSQLServerAlerts struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MSSQLServerAlertsSpec `json:"spec,omitempty"`
}

// MSSQLServerAlertsSpec is the schema for kubedb-autoscaler chart values file
type MSSQLServerAlertsSpec struct {
api.Metadata `json:"metadata,omitempty"`
Form MSSQLServerAlertsSpecForm `json:"form"`
Grafana MemcachedGrafana `json:"grafana"`
}

type MSSQLServerAlertsSpecForm struct {
Alert MSSQLServerAlert `json:"alert"`
}

type MSSQLServerAlert struct {
Enabled mona.SeverityFlag `json:"enabled"`
Labels map[string]string `json:"labels"`
// +optional
Annotations map[string]string `json:"annotations"`
// +optional
AdditionalRuleLabels map[string]string `json:"additionalRuleLabels"`
Groups MSSQLServerAlertGroups `json:"groups"`
}

type MSSQLServerAlertGroups struct {
Database MSSQLServerDatabaseAlert `json:"database"`
Provisioner ProvisionerAlert `json:"provisioner"`
KubeStash KubeStashAlert `json:"kubeStash"`
}

type MSSQLServerDatabaseAlert struct {
Enabled mona.SeverityFlag `json:"enabled"`
Rules MSSQLServerDatabaseAlertRules `json:"rules"`
}

type MSSQLServerDatabaseAlertRules struct {
MSSQLServerInstanceDown FixedAlert `json:"mssqlserverInstanceDown"`
MSSSQLServerServiceDown FixedAlert `json:"mssqlserverServiceDown"`
MSSQLServerRestarted IntValAlert `json:"mssqlserverRestarted"`
MSSQLServerTooManyConnections IntValAlert `json:"mssqlserverTooManyConnections"`
DiskUsageHigh IntValAlert `json:"diskUsageHigh"`
DiskAlmostFull IntValAlert `json:"diskAlmostFull"`
}

type MSSQLServerGrafana struct {
Enabled bool `json:"enabled"`
Version string `json:"version"`
JobName string `json:"jobName"`
URL string `json:"url"`
ApiKey string `json:"apikey"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MSSQLServerAlertsList is a list of MSSQLServerAlertss
type MSSQLServerAlertsList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of MSSQLServerAlerts CRD objects
Items []MSSQLServerAlerts `json:"items,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/alerts/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&MemcachedAlertsList{},
&MongodbAlerts{},
&MongodbAlertsList{},
&MSSQLServerAlerts{},
&MSSQLServerAlertsList{},
&MysqlAlerts{},
&MysqlAlertsList{},
&PerconaxtradbAlerts{},
Expand Down
208 changes: 208 additions & 0 deletions apis/alerts/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions charts/mssqlserver-alerts/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/mssqlserver-alerts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: mssqlserver-alerts
description: A Helm chart for MSSQLServer Alert by AppsCode
type: application
version: v2023.05.09
appVersion: v0.2.0
home: https://github.com/appscode/alerts
icon: https://cdn.appscode.com/images/products/kubedb/kubedb-icon.png
sources:
- https://github.com/appscode/alerts
maintainers:
- name: appscode
email: support@appscode.com
Loading

0 comments on commit caf8a0a

Please sign in to comment.