How to specify full URL in prometheus config file?

Viewed 3589

I want to monitor an application which has been deployed with apache-tomact 8 , the url for example is hostip:port/login.jsp but in prometheus config file we can only mention the hostip:port , where can i specify the extra login.jsp path so that it monitors that specific applicaiton.

I already tried to change the mertic_path , but was facing some invalid valid token error.

configfile:

global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets:
      # - alertmanager:9093

rule_files:
  - 'promrules.yml'


scrape_configs:
  - job_name: 'prometheus'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
    - targets: ['localhost:9090']

  - job_name: 'bank'
    #metrics_path: /login.jsp
    static_configs:
    - targets: ['<hostip>:<port>']
1 Answers

A minimal example config using metrics_path looks like this:

- job_name: my-service
  metrics_path: "/custom-metrics-endpoint"
  static_configs:
    - targets:
      - localhost:9090

Use quotes around the path if you encounter yaml parsing errors.

Related