Bug 1946860

Summary: Memory utilization display error for dashboard Kubenetes/Computer Resource/Cluster
Product: OpenShift Container Platform Reporter: hongyan li <hongyli>
Component: MonitoringAssignee: Pawel Krupa <pkrupa>
Status: CLOSED CURRENTRELEASE QA Contact: hongyan li <hongyli>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.8CC: alegrand, anpicker, erooth, jhusta, juzhao, kakkoyun, lcosic, pkrupa, spasquie
Target Milestone: ---Keywords: Regression
Target Release: 4.8.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: 2021-08-17 14:15:29 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: 1934148    
Attachments:
Description Flags
DB screenshot
none
query screenshot
none
show memory utilisation correctly none

Description hongyan li 2021-04-07 04:02:54 UTC
Created attachment 1769748 [details]
DB screenshot

Description of problem:
Memory utilization display error for dashboard Kubenetes/Computer Resource/Cluster

Version-Release number of selected component (if applicable):
4.8.0-0.nightly-2021-04-06-162113

How reproducible:
always

Steps to Reproduce:
1.Go to Monitoring-Dashboards
2. Select Kubenetes/Computer Resource/Cluster from drop&down box
3.

Actual results:
Memory utilization display error for dashboard Kubenetes/Computer
1:121: parse error: unterminated quoted string"

Expected results:
Display data or '-'

Additional info:

Query is wrong
1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=""}) / sum(kube_node_status_allocatable{resource="memory",cluster="""})

Comment 1 hongyan li 2021-04-07 04:04:28 UTC
Created attachment 1769749 [details]
query screenshot

Comment 2 Junqi Zhao 2021-04-07 04:14:28 UTC
the query parameter should be
1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=""}) / sum(kube_node_status_allocatable{resource="memory",cluster=""})

checked form configmap,
"expr": "1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=\"$cluster\"}) / sum(kube_node_status_allocatable{resource=\"memory\",cluster=\"$cluster\"\"})"
should be
"expr": "1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=\"$cluster\"}) / sum(kube_node_status_allocatable{resource=\"memory\",cluster=\"$cluster\"})"
# oc -n openshift-monitoring get cm grafana-dashboard-k8s-resources-cluster -oyaml
...

                        "targets": [
                            {
                                "expr": "1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=\"$cluster\"}) / sum(kube_node_status_allocatable{resource=\"memory\",cluster=\"$cluster\"\"})",
                                "format": "time_series",
                                "instant": true,
                                "intervalFactor": 2,
                                "refId": "A"
                            }
                        ],
                        "thresholds": "70,80",
                        "timeFrom": null,
                        "timeShift": null,
                        "title": "Memory Utilisation",
                        "tooltip": {
                            "shared": false,
                            "sort": 0,
                            "value_type": "individual"
                        },
...

Comment 4 Andrew Pickering 2021-04-07 09:44:59 UTC
This was already fixed in kubernetes-mixin by https://github.com/kubernetes-monitoring/kubernetes-mixin/pull/573

The fix appears to have already been pulled into the latest OpenShift master, so I'm setting this to MODIFIED.

Comment 5 Andrew Pickering 2021-04-07 09:50:26 UTC
Sorry, actually it looks like the kubernetes-mixin fix has not yet been pulled into OpenShift, so returning this to ASSIGNED.

Comment 6 Junqi Zhao 2021-05-07 09:56:02 UTC
*** Bug 1957420 has been marked as a duplicate of this bug. ***

Comment 7 Junqi Zhao 2021-05-07 10:01:10 UTC
issue is fixed with 4.8.0-0.nightly-2021-05-06-162549, see the attached picture
query expression is now:
1 - sum(:node_memory_MemAvailable_bytes:sum{cluster=""}) / sum(node_memory_MemTotal_bytes{cluster=""})

Comment 8 Junqi Zhao 2021-05-07 10:02:03 UTC
Created attachment 1780656 [details]
show memory utilisation correctly

Comment 9 Scott Dodson 2021-08-17 14:15:29 UTC
This was fixed prior to 4.8 GA.