[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: router stats



Am 17.10.19 um 10:41 schrieb Tim Dudgeon:
> OK, that looks more promising (but the question on whether the docs in the
> original link are correct still stands).
> 
> However, I'm having problems accessing the stats. Using the username and
> password found in the service definition e.g.:
> 
>> curl admin:<password>@172.30.67.67:1936/metrics
> 
> I get a:
> 
>> HTTP/1.1 401 Unauthorized
> 
> This is with OKD 3.11

With this commands can you get the prometheus metrics.

```
# get prom user
PROM_USER=$(oc get svc --selector="router=router" --template="{{with index .items 0 }}{{with index .metadata.annotations \"prometheus.openshift.io/username\"}}{{.}}{{end}}{{end}}")
# get prom pw
PROM_PW=$(oc get svc --selector="router=router" --template="{{with index .items 0 }}{{with index .metadata.annotations \"prometheus.openshift.io/password\"}}{{.}}{{end}}{{end}}")
# get Stats port. this could be differnt.
# check it with `oc get svc --selector="router=router" -o json` 
ROUTER_STATS_PORT=$(oc get svc --selector="router=router" -o=jsonpath='{.items[0].spec.ports[?(@.name=="1936-tcp")].port}')
# get service ip
SVC_IP=$(oc get svc --selector="router=router" -o=jsonpath='{.items[0].spec.clusterIP}')

# cal curl from a node inside of ocp sdn
curl -kvu ${PROM_USER}:${PROM_PW} https://${SVC_IP}:${ROUTER_STATS_PORT}/metrics
```

You should be able to get haproxy stats via routers when the variables StatsPort, StatsUser 
and StatsPassword are set, as you can see in the template.

https://github.com/openshift/origin/blob/release-3.11/images/router/haproxy/conf/haproxy-config.template#L129-L145

```
# show environment variables
oc set env dc/router --list
```

Hth

> Tim

Aleks

> On 16/10/2019 16:24, Brian Jarvis wrote:
>> Information on accessing the router metrics can be found [0].
>>
>> [0] https://docs.okd.io/3.11/install_config/router/default_haproxy_router.html#exposing-the-router-metrics
>>
>>
>> On Tue, Oct 15, 2019 at 6:09 AM Tim Dudgeon <tdudgeon ml gmail com
>> <mailto:tdudgeon ml gmail com>> wrote:
>>
>>     So how do I access these?
>>
>>     And are the docs here [1] wrong?
>>
>>     [1] https://docs.okd.io/3.11/admin_guide/router.html
>>
>>     On 14/10/2019 19:26, Clayton Coleman wrote:
>>>     Metrics are exposed via the controller process in the pod (pid1), not the
>>>     HAProxy process.
>>>
>>>     On Mon, Oct 14, 2019 at 1:27 PM Tim Dudgeon <tdudgeon ml gmail com
>>>     <mailto:tdudgeon ml gmail com>> wrote:
>>>
>>>         I'm trying to see the router stats as described here:
>>>         https://docs.okd.io/3.11/admin_guide/router.html
>>>
>>>         I can see this from within the container using the command:
>>>
>>>         echo 'show stat' | socat - UNIX-CONNECT:/var/lib/haproxy/run/haproxy.sock
>>>
>>>         But they do not seem to be being exposed through the web listener as
>>>         described in that doc. In fact I can't see anything in the
>>>         haproxy.config file that suggests that haproxy is exposing stats on port
>>>         1936 or any other port.
>>>
>>>         The installation was a fairly standard openshift-ansible install so I'm
>>>         sure the defaults have not been changed.
>>>
>>>         Are there any instructions for how to get this working?
>>>
>>>         Thanks
>>>         Tim
>>>
>>>         _______________________________________________
>>>         users mailing list
>>>         users lists openshift redhat com
>>>         <mailto:users lists openshift redhat com>
>>>         http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>>
>>     _______________________________________________
>>     users mailing list
>>     users lists openshift redhat com <mailto:users lists openshift redhat com>
>>     http://lists.openshift.redhat.com/openshiftmm/listinfo/users
>>
>>
>>
>>
>>
> 
> _______________________________________________
> users mailing list
> users lists openshift redhat com
> http://lists.openshift.redhat.com/openshiftmm/listinfo/users
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]