Prometheus快速理解

介绍在k8s cluster中,Prometheus的使用
1 Prometheus的默认启动参数
Args:
-storage.local.retention=36h
-storage.local.num-fingerprint-mutexes=4096
-storage.local.path=/var/prometheus/data
-storage.local.chunk-encoding-version=2
-config.file=/etc/prometheus/config/prometheus.yaml
-storage.local.target-heap-size=279620266
-web.route-prefix=

2
自定义添加参数
spec参数列表

例子:

{
"apiVersion": "monitoring.coreos.com/v1alpha1",
"kind": "Prometheus",
"metadata": {
"name": "k8s",
"labels": {
"prometheus": "k8s"
}
},
"spec": {
"replicas": 2,
"version": "v1.7.0",
"retention": "36h",
"serviceAccountName": "prometheus-k8s",
"serviceMonitorSelector": {
"matchExpression": [
{
"key": "k8s-apps",
"operator": "Exists"
}
]
},
"ruleSelector": {
"matchLabels": {
"role": "prometheus-rulefiles",
"prometheus": "k8s"
}
},
"resources": {
"requests": {
"memory": "400Mi"
}
},
"alerting": {
"alertmanagers": [
{
"namespace": "monitoring",
"name": "alertmanager-main",
"port": "web"
}
]
},
"nodeSelector": {
"beta.kubernetes.io/arch": "amd64"
}
}
}

3 补充prometheus的知识
介绍
如何存储数据