Bug 1579054 - Unable to access HAProxy Router statistics
Summary: Unable to access HAProxy Router statistics
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Networking
Version: 3.9.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.9.z
Assignee: Ben Bennett
QA Contact: zhaozhanqi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-16 21:44 UTC by Robert Bost
Modified: 2022-08-04 22:20 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-18 21:01:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3447991 0 None None None 2018-05-16 21:44:52 UTC

Description Robert Bost 2018-05-16 21:44:19 UTC
Description of problem: Having issues pulling statistics for HAProxy router when ROUTER_METRICS_TYPE=haproxy:

# oc rsh router-1-xx123 
sh-4.2$ curl -u admin:password localhost:1936
Forbidden: User "system:anonymous" cannot get routers.route.openshift.io at the cluster scope

The symptoms are simlar and workaround of unsetting ROUTER_METRICS_TYPE (oc env dc/router ROUTER_METRICS_TYPE- -n default) is similar to issue in bz1467257. However, the manifesting error is different.

Version-Release number of selected component (if applicable): 3.9


How reproducible: always

Additional notes:
If I have ROUTER_METRICS_TYPE=haproxy, STATS_USERNAME, and STATS_PASSWORD all set, the I receive a 404:

sh-4.2$ curl -u admin:password localhost:1936
404 page not found

Comment 1 Ben Bennett 2018-05-17 20:26:30 UTC
I think for the first case you don't have STATS_USERNAME and STATS_PASSWORD set... can you please clarify?  (Or just include all of 'oc env dc router --list')

For the second case you need:
  curl "http://$STATS_USERNAME:$STATS_PASSWORD@localhost:$STATS_PORT/metrics"

Comment 2 Robert Bost 2018-05-18 13:54:03 UTC
Correct, the first case I do not have STATS_USERNAME and STATS_PASSWORD enabled. Here's each combination of STATS_USERNAME/STATS_PASSWORD and ROUTER_METRICS_TYPE. The only combination that works is when ROUTER_METRICS_TYPE is unset. I probably should have specified that in my first comment, sorry:


# oc rsh router-7-gbdfz
sh-4.2$ curl -u admin:password localhost:1936
Forbidden: User "system:anonymous" cannot get routers.route.openshift.io at the cluster scope
sh-4.2$ curl localhost:1936
Forbidden: User "system:anonymous" cannot get routers.route.openshift.io at the cluster scope
sh-4.2$ env | grep STATS
STATS_PORT=1936
sh-4.2$ env | grep ROUTER_METRICS_TYPE
ROUTER_METRICS_TYPE=haproxy
sh-4.2$ exit


# oc env dc/router STATS_USERNAME=admin STATS_PASSWORD=password -n default
deploymentconfig "router" updated


# oc rsh router-8-sfj5c
sh-4.2$ curl -u admin:password localhost:1936
404 page not found
sh-4.2$ env | grep STATS
STATS_USERNAME=admin
STATS_PASSWORD=password
STATS_PORT=1936
sh-4.2$ env | grep ROUTER_METRICS_TYPE
ROUTER_METRICS_TYPE=haproxy


# oc env dc/router ROUTER_METRICS_TYPE- -n default
deploymentconfig "router" updated


sh-4.2$ curl -u admin:password localhost:1936
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
..... trimmed
sh-4.2$ env | grep STATS
STATS_USERNAME=admin
STATS_PASSWORD=password
STATS_PORT=1936
sh-4.2$ env | grep ROUTER_METRICS_TYPE
<nothing>

Comment 3 Ben Bennett 2018-05-18 14:38:33 UTC
Can you get me the full router deployment config please?  (oc get dc router -o yaml)

And what stats format are they looking for?  The new ROUTER_METRICS_TYPE=haproxy ones?

Comment 4 Robert Bost 2018-05-18 21:01:57 UTC
> And what stats format are they looking for?  The new ROUTER_METRICS_TYPE=haproxy ones?

I see that I missed the /metrics part of your first reply. My command output does not include /metrics which *does* give me the prometheus style output after setting the STATS_USERNAME and STATS_PASSWORD. Just some confusion over the path change from one router metric type to the other.

I think we can close this case NOTABUG given this.


Note You need to log in before you can comment on or make changes to this bug.