Bug 1622537

Summary: [CRI-O] start cri-o with --enable-metrics --metrics-port <port>
Product: OpenShift Container Platform Reporter: François Cami <fcami>
Component: ContainersAssignee: Mrunal Patel <mpatel>
Status: CLOSED ERRATA QA Contact: weiwei jiang <wjiang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 3.11.0CC: aos-bugs, contribs, dornelas, jokerman, mmccomas, sdodson
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 10:40:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1186913    

Description François Cami 2018-08-27 12:21:51 UTC
Description of problem:
cri-o needs --enable-metrics --metrics-port <port> for metric collection to be effective (e.g. for Prometheus).


Version-Release number of the following components:
rpm -q openshift-ansible
=> as of HEAD / 3cd1597a509c218713b7665dab6c57c0c4cc8c6d 


Additional info:

# crio --help
NAME:
   crio - crio server
(...)
GLOBAL OPTIONS:
(...)
   --enable-metrics              enable metrics endpoint for the server on localhost:9090
(...)
   --metrics-port value          port for the metrics endpoint (default: 9090)

Comment 3 François Cami 2018-11-02 19:49:29 UTC
Man page PR: https://github.com/kubernetes-sigs/cri-o/pull/1777
Configuration file PR: https://github.com/kubernetes-sigs/cri-o/pull/1878

Comment 7 weiwei jiang 2019-02-19 09:58:35 UTC
Checked and metrics is enabled by default now.

$ rpm -qa |grep -i cri-o 
cri-o-1.12.5-6.rhaos4.0.git80d1487.el7.x86_64

$ cat /etc/sysconfig/crio-*
# /etc/sysconfig/crio-metrics
CRIO_METRICS_OPTIONS="--enable-metrics=true --metrics-port=9537"
CRIO_NETWORK_OPTIONS="--cni-config-dir=/etc/kubernetes/cni/net.d --cni-plugin-dir=/var/lib/cni/bin"
# /etc/sysconfig/crio-storage
CRIO_STORAGE_OPTIONS=

$ sudo fuser -v 9537/tcp
                     USER        PID ACCESS COMMAND
9537/tcp:            root       4602 F.... crio

$ curl -s  localhost:9537/metrics  | head 
# HELP container_runtime_crio_operations Cumulative number of CRI-O operations by operation type.
# TYPE container_runtime_crio_operations counter
container_runtime_crio_operations{operation_type="container_reopen_log"} 7
container_runtime_crio_operations{operation_type="container_status"} 77637
container_runtime_crio_operations{operation_type="create_container"} 189
container_runtime_crio_operations{operation_type="exec_sync"} 11775
container_runtime_crio_operations{operation_type="image_status"} 465
container_runtime_crio_operations{operation_type="list_containers"} 51255
container_runtime_crio_operations{operation_type="list_images"} 3603
container_runtime_crio_operations{operation_type="list_pod_sandbox"} 48292

Comment 10 errata-xmlrpc 2019-06-04 10:40:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:0758