---
name: prom_scraper

consumes:
- name: loggregator
  type: loggregator
  optional: true

templates:
  bpm.yml.erb: config/bpm.yml
  loggregator_agent.crt.erb: config/certs/loggregator_agent.crt
  loggregator_agent.key.erb: config/certs/loggregator_agent.key
  loggregator_ca.crt.erb: config/certs/loggregator_ca.crt
  scrape.crt.erb: config/certs/scrape.crt
  scrape.key.erb: config/certs/scrape.key
  scrape_ca.crt.erb: config/certs/scrape_ca.crt
  metrics_ca.crt.erb: config/certs/metrics_ca.crt
  metrics.crt.erb: config/certs/metrics.crt
  metrics.key.erb: config/certs/metrics.key
  prom_scraper_config.yml.erb: config/prom_scraper_config.yml

packages:
- prom_scraper

properties:
  scrape_interval:
    description: "The interval to scrape the metrics URL (golang duration)"
    default: 15s
  config_globs:
    description: "Files matching the globs are expected to contain information to scrape a Prometheus metrics endpoint on localhost."
    default: [/var/vcap/jobs/*/config/prom_scraper_config.yml, /var/vcap/jobs/*/config/metric_port.yml]
  skip_ssl_validation:
    description: "If true, Skips SSL Validation when scraping"
    default: false

  scrape.tls.cert:
    description: "The cert used to communicate with scrape targets"
  scrape.tls.key:
    description: "The key used to communicate with scrape targets"
  scrape.tls.ca_cert:
    description: "The CA used to communicate with scrape targets"

  loggregator_agent.grpc_port:
    description: "The gRPC port used to connect to loggregator agent. Can come from loggregator link"
  loggregator_agent.tls.cert:
    description: "The cert used to communicate with loggregator agent. Can come from loggregator link"
  loggregator_agent.tls.key:
    description: "The key used to communicate with loggregator agent. Can come from loggregator link"
  loggregator_agent.tls.ca_cert:
    description: "The CA used to communicate with loggregator agent. Can come from loggregator link"

  metrics.port:
    description: "Port the agent uses to serve metrics and debug information"
    default: 14821
  metrics.ca_cert:
    description: "TLS CA cert to verify requests to metrics endpoint."
  metrics.cert:
    description: "TLS certificate for metrics server signed by the metrics CA"
  metrics.key:
    description: "TLS private key for metrics server signed by the metrics CA"
  metrics.server_name:
    description: "The server name used in the scrape configuration for the metrics endpoint"
