I'm working with the kube-prometheus-stack Helm chart from GitHub, and while everything is set up and running smoothly, I can't seem to add additional scrape configurations for monitoring metrics from my Proxmox server. I've tried modifying the values.yaml file to include additional scrape configs, but nothing has worked so far. I wasn't able to find helpful information on Google or Gemini either. Does anyone have suggestions or tips on how to do this correctly?
3 Answers
Since you're using the operator, the easiest way to add scrape configs is by using the ScrapeConfig Custom Resource (CR). Here's an example 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:
- your-proxmox-target:port
labels:
service: proxmox
```
This method keeps everything organized and should integrate smoothly with your setup.
I tried this but it never ended up working for me with the Proxmox exporter. I'll give it another shot!
Have you tried adding it to `.prometheus.prometheusSpec.additionalScrapeConfigs`? That’s a common spot for extra configs when you're using the Helm chart.
You need to patch the Prometheus Custom Resource (CR) and then create a secret for the additional configuration. Here's a quick play to patch it and create the necessary secret:
```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 replace the placeholders with your actual values, and it should work!
Interesting… is this the ‘designed’ way to use it?