vmware_exporter icon indicating copy to clipboard operation
vmware_exporter copied to clipboard

servicemonitor for multiple hosts?

Open billykwooten opened this issue 2 years ago • 2 comments

Hey guys, does anyone know what the servicemonitor for use with prometheus operator would look like, i've tried the following but with no success:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  annotations:
    td/managed-by: flux
  labels:
    prometheus: k8s
  name: thdks-prometheus-vmware-exporter-svcmon1
  namespace: vmware-exporter
spec:
  endpoints:
  - honorLabels: true
    interval: 30s
    path: /metrics
    port: http
    scrapeTimeout: 30s
    params:
      target:
       - default
       - host2
    metricRelabelings:
      - sourceLabels: [__address__]
        targetLabel: __param_target
      - sourceLabels: [__param_target]
        targetLabel: instance
  jobLabel: thdks-vmware-exporter
  selector:
    matchLabels:
      app: vmware-exporter
      release: vmware-exporter
      

This isn't working at all, i'm assuming because it's not utilizing section when calling the exporter itself.

billykwooten avatar Nov 14 '22 19:11 billykwooten

i cannot add multiple section, just only receive default section

doviethoang avatar Nov 21 '22 18:11 doviethoang

i cannot add multiple section, just only receive default section

Hey guys, does anyone know what the servicemonitor for use with prometheus operator would look like, i've tried the following but with no success:

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  annotations:
    td/managed-by: flux
  labels:
    prometheus: k8s
  name: thdks-prometheus-vmware-exporter-svcmon1
  namespace: vmware-exporter
spec:
  endpoints:
  - honorLabels: true
    interval: 30s
    path: /metrics
    port: http
    scrapeTimeout: 30s
    params:
      target:
       - default
       - host2
    metricRelabelings:
      - sourceLabels: [__address__]
        targetLabel: __param_target
      - sourceLabels: [__param_target]
        targetLabel: instance
  jobLabel: thdks-vmware-exporter
  selector:
    matchLabels:
      app: vmware-exporter
      release: vmware-exporter
      

This isn't working at all, i'm assuming because it's not utilizing section when calling the exporter itself.

use /metrics?section=xxx and

- source_labels: [__address__]
  target_label: __param_section
  replacement: xxx

koyanagi-ZeHongLiu avatar Mar 18 '24 11:03 koyanagi-ZeHongLiu