Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for display format prometheus #12

Open
Frodox opened this issue Oct 30, 2018 · 6 comments
Open

Please add support for display format prometheus #12

Frodox opened this issue Oct 30, 2018 · 6 comments
Labels
enhancement New feature or request patch ready patch ready and merged, if the further feedback is resolved, we can close it.

Comments

@Frodox
Copy link

Frodox commented Oct 30, 2018

No description provided.

@zhouchangxun
Copy link
Owner

@Frodox Hi, Thanks for your suggestion.
I'll get it checked when i'm free.

@zhouchangxun zhouchangxun added the enhancement New feature or request label Mar 3, 2019
@taomaree
Copy link
Contributor

alibaba/tengine#1426

@Frodox
Copy link
Author

Frodox commented Jun 15, 2020

@zhouchangxun can we cherry-pick commits from alibaba/tengine#1426 ? :D

@zhouchangxun
Copy link
Owner

zhouchangxun commented Jun 16, 2020

@taomaree @Frodox
I added this feature (cdc74da) manually based on what you mentioned (alibaba/tengine#1426 )
By the way, the output format is different from the raw one ( I added a property upstream_type for every record) because the output contain both http upstream and stream upstream.
$ curl 'http://localhost:8081/status?format=prometheus&status=down'

# HELP nginx_upstream_count_total Nginx total number of servers
# TYPE nginx_upstream_count_total gauge
nginx_upstream_count_total 6
# HELP nginx_upstream_count_up Nginx total number of servers that are UP
# TYPE nginx_upstream_count_up gauge
nginx_upstream_count_up 0
# HELP nginx_upstream_count_down Nginx total number of servers that are DOWN
# TYPE nginx_upstream_count_down gauge
nginx_upstream_count_down 6
# HELP nginx_upstream_count_generation Nginx generation
# TYPE nginx_upstream_count_generation gauge
nginx_upstream_count_generation 1
# HELP nginx_upstream_server_rise Nginx rise counter
# TYPE nginx_upstream_server_rise counter
nginx_upstream_server_rise{index="0",upstream_type="http",upstream="http-cluster",name="127.0.0.1:8082",status="down",type="http",port="0"} 0
nginx_upstream_server_rise{index="1",upstream_type="http",upstream="http-cluster",name="127.0.0.2:8082",status="down",type="http",port="0"} 0
nginx_upstream_server_rise{index="1",upstream_type="stream",upstream="tcp-cluster",name="192.168.0.2:22",status="down",type="tcp",port="0"} 0
nginx_upstream_server_rise{index="2",upstream_type="stream",upstream="udp-cluster",name="127.0.0.1:5432",status="down",type="udp",port="0"} 0
nginx_upstream_server_rise{index="4",upstream_type="stream",upstream="http-cluster2",name="127.0.0.1:8082",status="down",type="http",port="0"} 0
nginx_upstream_server_rise{index="5",upstream_type="stream",upstream="http-cluster2",name="127.0.0.2:8082",status="down",type="http",port="0"} 0
# HELP nginx_upstream_server_fall Nginx fall counter
# TYPE nginx_upstream_server_fall counter
nginx_upstream_server_fall{index="0",upstream_type="http",upstream="http-cluster",name="127.0.0.1:8082",status="down",type="http",port="0"} 41
nginx_upstream_server_fall{index="1",upstream_type="http",upstream="http-cluster",name="127.0.0.2:8082",status="down",type="http",port="0"} 42
nginx_upstream_server_fall{index="1",upstream_type="stream",upstream="tcp-cluster",name="192.168.0.2:22",status="down",type="tcp",port="0"} 14
nginx_upstream_server_fall{index="2",upstream_type="stream",upstream="udp-cluster",name="127.0.0.1:5432",status="down",type="udp",port="0"} 40
nginx_upstream_server_fall{index="4",upstream_type="stream",upstream="http-cluster2",name="127.0.0.1:8082",status="down",type="http",port="0"} 40
nginx_upstream_server_fall{index="5",upstream_type="stream",upstream="http-cluster2",name="127.0.0.2:8082",status="down",type="http",port="0"} 43
# HELP nginx_upstream_server_active Nginx active 1 for UP / 0 for DOWN
# TYPE nginx_upstream_server_active gauge
nginx_upstream_server_active{index="0",upstream_type="http",upstream="http-cluster",name="127.0.0.1:8082",type="http",port="0"} 0
nginx_upstream_server_active{index="1",upstream_type="http",upstream="http-cluster",name="127.0.0.2:8082",type="http",port="0"} 0
nginx_upstream_server_active{index="1",upstream_type="stream",upstream="tcp-cluster",name="192.168.0.2:22",type="tcp",port="0"} 0
nginx_upstream_server_active{index="2",upstream_type="stream",upstream="udp-cluster",name="127.0.0.1:5432",type="udp",port="0"} 0
nginx_upstream_server_active{index="4",upstream_type="stream",upstream="http-cluster2",name="127.0.0.1:8082",type="http",port="0"} 0
nginx_upstream_server_active{index="5",upstream_type="stream",upstream="http-cluster2",name="127.0.0.2:8082",type="http",port="0"} 0

Please check if it can meet your requirement (To be honest, I am not familiar with prometheus format :D )

@zhouchangxun zhouchangxun added the patch ready patch ready and merged, if the further feedback is resolved, we can close it. label Jun 16, 2020
@Frodox
Copy link
Author

Frodox commented Jun 18, 2020

@zhouchangxun looks good 👍
but..what is the port label for? why is it 0 every where ?

@hroost
Copy link

hroost commented Feb 8, 2021

@Frodox it's 0 when port (at check directive) is not specially defined and module using port value from upstream server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch ready patch ready and merged, if the further feedback is resolved, we can close it.
Projects
None yet
Development

No branches or pull requests

4 participants