Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a number of up backends for a specific upstream from nginx plus api

doudoudie
Nimbostratus
Nimbostratus

We managed to get a count number of live backends for a specific upstream for prometheus blackbox checks.

Wonder if there's a api that we can use to archive this. for example.  there's a upstream has 3 backends and we want to get a result like up:3 or something similar from api. Please share it if there's one.

1 REPLY 1

Hello,

 

Have you looked at this http://nginx.org/en/docs/http/ngx_http_api_module.html#example  ? You can use  /http/upstreams/   /stream/upstreams/ /http/server_zones/ but this is a commecial module.

 

Also some extra info about server zones and status zones as they are need for you get the info through the API:

 

http://nginx.org/en/docs/http/ngx_http_status_module.html#status_zone