Skip to content

Prometheus service discovery using with HTTP API and file_sd_config.

License

Notifications You must be signed in to change notification settings

nari-ex/prometheus-http-sd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prometheus-http-sd

Prometheus service discovery using with HTTP API and file_sd_config.

Install

Precompiled binaries

Download from https://github.com/rrreeeyyy/prometheus-http-sd

Docker

docker pull rrreeeyyy/prometheus-http-sd

Usage

./prometheus-http-sd --api.url="http://api.example.com/service_discovery.json" --output.file=/path/to/http_sd.json --refresh.interval=60

HTTP API format

HTTP API response should be follow prometheus file_sd_config format like below:

[
	{
		"targets": [
			"192.0.2.1:8080",
			"192.0.2.2:8080",
		],
		"labels": {
			"service": "web",
			"role": "role-1"
		}
	},
	{
		"targets": [
			"192.0.3.1:3306"
		],
		"labels": {
			"service": "db",
			"role": "role-2"
		}
	}
]

Example prometheus settings

The part of your prometheus.yml is probably as follows.

  scrape_configs:
    - job_name: 'http_sd'
      file_sd_configs:
        - files:
          - /path/to/http_sd.json

About

Prometheus service discovery using with HTTP API and file_sd_config.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 75.4%
  • Makefile 15.8%
  • Dockerfile 8.8%