I've been trying to figure out how to add extra scrape configurations to the Prometheus Helm chart I'm using from the kube-prometheus-stack repo. Everything seems to be set up nicely, but I'm having a tough time getting my Proxmox server metrics to show up. I attempted to modify the values.yaml file to include the additional scrape configurations, but nothing has worked so far. I even tried searching for solutions online, but came up empty-handed. Can anyone help me out with some tips or steps?
3 Answers
Did you try adding it to `.prometheus.prometheusSpec.additionalScrapeConfigs`? That's where you should include your additional scrape configurations.
You also need to patch the Prometheus Custom Resource (CR) and create a secret for the additional configuration. Here's a patch example you can use:
```yaml
- name: Patch Prometheus CR to add additionalScrapeConfigs
kubernetes.core.k8s_json_patch:
kind: Prometheus
api_version: monitoring.coreos.com/v1
name: "{{ prometheus_release_name }}-kube-prometheus-stack-prometheus"
namespace: monitoring
patch:
- op: add
path: /spec/additionalScrapeConfigs
value:
name: prometheus-additional-scrape-configs
key: additional-scrape-configs.yaml
```
Make sure you've set everything up correctly, and you'll be able to visualize the metrics you need!
Since you're using the operator, it's actually simpler to utilize the ScrapeConfig Custom Resource (CR). Here's a sample of how to set it up:
```yaml
apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
labels:
prometheus: kube-prometheus-prometheus
role: scrape-config
name: prometheus-scrapeconfig-msk
spec:
staticConfigs:
- targets:
- b-1.main.hqkxun.c12.kafka.us-east-1.amazonaws.com:11001
labels:
service: msk-main
- targets:
- b-2.main.hqkxun.c12.kafka.us-east-1.amazonaws.com:11001
labels:
service: msk-main
- targets:
- b-3.main.hqkxun.c12.kafka.us-east-1.amazonaws.com:11001
labels:
service: msk-main
```
This should help you get those additional metrics up and running!
Interesting… is this the "designed" way to use it?
I tried this but it never ended up working for me with the Proxmox exporter. I'll give it another shot.