./promtool check config config-map.yaml
Checking config-map.yaml
FAILED: parsing YAML file config-map.yaml: unknown fields in config: alertmanager.yml, serverFiles, apiVersion, kind, metadata, data, alertmanagerFiles
apiVersion: v1
kind: ConfigMap
metadata:
name: prometheus-server-conf
labels:
name: prometheus-server-conf
namespace: monitoring
data:
alertmanagerFiles:
alertmanager.yml: |-
global:
# slack_api_url: ''
resolve_timeout: 20s
receivers:
- name: default-receiver
# slack_configs:
# - channel: '@you'
# send_resolved: true
- name: 'webhook'
webhook_configs:
- send_resolved: true
url: ''
route:
group_wait: 10s
group_interval: 5m
receiver: webhook
repeat_interval: 3h
## Prometheus server ConfigMap entries
##
serverFiles:
rules: ""
alerts: |-
# host rules
ALERT high_node_load
IF node_load1 > 20
FOR 10s
LABELS { severity = "critical" }
ANNOTATIONS {
# summary defines the status if the condition is met
summary = "Node usage exceeded threshold",
# description reports the situtation of event
description = "Instance {{ $labels.instance }}, Job {{ $labels.job }}, Node load {{ $value }}",
}
Thanks in advance for your help!!
Promtool does not know the kubernetes manifest specific fields defining the configmap.
You should paste content of the `alertmanager.yml:` field into a separate file and than run promtool check on this file.
Still your error does not mean your configuration is incorrect you just run the syntax check wrong way but i think the empty url in webhook config of alertmanager could cause problems.
You shoud mount this configmap into the alermanager container and specify alermanager cmd flag to tell it it shoud use this config file.
Hope this helps
Martin
./kubectl create -f ./config-map.yaml -n monitoring
error: error validating "./config-map.yaml": error validating data: [ValidationError(ConfigMap): unknown field "alertmanager.yml" in io.k8s.api.core.v1.ConfigMap, ValidationError(ConfigMap): unknown field "serverFiles" in io.k8s.api.core.v1.ConfigMap]; if you choose to ignore these errors, turn validation off with --validate=false
Could you please guide me on how I would mount this config map into the alert manager container and specify alert manager cmd flag? How do I check if I have an alert manager container?
Many thanks in advance for your help!
Mary-Jo
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: prometheus-deployment
namespace: monitoring
spec:
replicas: 1
template:
metadata:
labels:
app: prometheus-server
spec:
containers:
- name: prometheus
image: prom/prometheus:v2.1.0
args:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus/"
ports:
- containerPort: 9090
volumeMounts:
- name: prometheus-config-volume
mountPath: /etc/prometheus/
- name: prometheus-storage-volume
mountPath: /prometheus/
volumes:
- name: prometheus-config-volume
configMap:
defaultMode: 420
name: prometheus-server-conf
name: alertmanager-conf
- name: prometheus-storage-volume
emptyDir: {}
Is this correct? Do I have to create the deployment again after this and do I add the prometheus-rules-config.yaml file under the volumes section too?
I can't seem to find the command flags to tell it how to use the config files either. Could you please help again if you don't mind?
Many thanks in advance!