-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kaustav Majumder <[email protected]>
- Loading branch information
Kaustav Majumder
committed
Feb 20, 2024
1 parent
841c36a
commit 938c3d7
Showing
2 changed files
with
99 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package templates | ||
|
||
import ( | ||
promv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var params = map[string][]string{ | ||
"match[]": { | ||
"{__name__='kube_node_status_condition'}", | ||
"{__name__='kube_persistentvolume_info'}", | ||
"{__name__='kube_storageclass_info'}", | ||
"{__name__='kube_persistentvolumeclaim_info'}", | ||
"{__name__='kube_deployment_spec_replicas'}", | ||
"{__name__='kube_pod_status_phase'}", | ||
"{__name__='kubelet_volume_stats_capacity_bytes'}", | ||
"{__name__='kubelet_volume_stats_used_bytes'}", | ||
"{__name__='node_disk_read_time_seconds_total'}", | ||
"{__name__='node_disk_write_time_seconds_total'}", | ||
"{__name__='node_disk_reads_completed_total'}", | ||
"{__name__='node_disk_writes_completed_total'}", | ||
}, | ||
} | ||
|
||
var K8sMetricsServiceMonitorTemplate = promv1.ServiceMonitor{ | ||
Spec: promv1.ServiceMonitorSpec{ | ||
Endpoints: []promv1.Endpoint{ | ||
{ | ||
Port: "web", | ||
Path: "/federate", | ||
Scheme: "https", | ||
ScrapeTimeout: "1m", | ||
Interval: "2m", | ||
HonorLabels: true, | ||
MetricRelabelConfigs: []*promv1.RelabelConfig{ | ||
{ | ||
Action: "labeldrop", | ||
Regex: "prometheus_replica", | ||
}, | ||
}, | ||
RelabelConfigs: []*promv1.RelabelConfig{ | ||
{ | ||
Action: "replace", | ||
Regex: "prometheus-k8s-.*", | ||
Replacement: "", | ||
SourceLabels: []promv1.LabelName{ | ||
"pod", | ||
}, | ||
TargetLabel: "pod", | ||
}, | ||
}, | ||
TLSConfig: &promv1.TLSConfig{ | ||
SafeTLSConfig: promv1.SafeTLSConfig{ | ||
InsecureSkipVerify: true, | ||
}, | ||
}, | ||
Params: params, | ||
BearerTokenFile: "/var/run/secrets/kubernetes.io/serviceaccount/token", | ||
}, | ||
}, | ||
NamespaceSelector: promv1.NamespaceSelector{ | ||
MatchNames: []string{"openshift-monitoring"}, | ||
}, | ||
Selector: metav1.LabelSelector{ | ||
MatchLabels: map[string]string{ | ||
"app.kubernetes.io/component": "prometheus", | ||
}, | ||
}, | ||
}, | ||
} |