본문으로 건너뛰기
버전: docs v25.02

Manage Monitoring Dashbaord

Updated 2024.09.25

Topics



자세한 단계

{변수}의 자세한 설명은 Terminology 페이지를 참고하세요

  • Monitoring Dashboard 설명
    • AI Conductor에서 이뤄지는 학습이 얼마만큼의 Resource를 소모하는지 확인하기 위한 툴 입니다.

1. 사전 준비

모니터링 대시보드 설정 전 모니터링 인프라 및 서비스가 설치되어있어야 합니다.


2. Dashboard 추가

  • Monitoring Dashboard 추가는 아래의 순서로 설치합니다.
    • Grafana user 생성
    • Grafana 폴더 생성
    • Monitoring Dashboard JSON 수정 및 Import

2-1. Grafana user 생성

  • Grafana 로그인
    • 설치된 Grafana에 admin 권한으로 로그인합니다.
  • Grafana user 생성
    • 좌측 메뉴의 Administration를 클릭합니다.
    • Users and access를 클릭합니다.
    • Users를 클릭합니다.
    • New User를 클릭합니다.
    • User 정보를 모두 입력하고, Create user를 클릭합니다.

2-2. Grafana 폴더 생성

  • Grafana 폴더 생성
    • 좌측 메뉴의 Dashboards를 클릭합니다.
    • 우측 상단의 New를 클릭합니다.
    • 드롭박스에서 New folder를 클릭합니다.
    • 우측 창의 Folder name에 01. {PROJECT_NAME}_monitoring 을 입력합니다.

2-3. Monitoring Dashboard JSON 생성 및 Import

  • Monitoring Dashboard JSON 생성
    • 아래 명령어를 수행해서 import 할 dashboard의 json을 생성합니다.

      [Expand create-monitoring-dashboard.json]
      cat <<EOT > create-monitoring-dashboard.json
      {
      "annotations": {
      "list": [
      {
      "builtIn": 1,
      "datasource": {
      "type": "grafana",
      "uid": "-- Grafana --"
      },
      "enable": true,
      "hide": true,
      "iconColor": "rgba(0, 211, 255, 1)",
      "name": "Annotations & Alerts",
      "type": "dashboard"
      }
      ]
      },
      "editable": true,
      "fiscalYearStartMonth": 0,
      "graphTooltip": 0,
      "id": 1025,
      "links": [],
      "liveNow": false,
      "panels": [
      {
      "gridPos": {
      "h": 1,
      "w": 24,
      "x": 0,
      "y": 0
      },
      "id": 3,
      "panels": [],
      "repeat": "stream_name",
      "repeatDirection": "h",
      "title": "\${stream_name}",
      "type": "row"
      },
      {
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "fieldConfig": {
      "defaults": {
      "color": {
      "mode": "palette-classic"
      },
      "custom": {
      "axisBorderShow": false,
      "axisCenteredZero": false,
      "axisColorMode": "text",
      "axisLabel": "",
      "axisPlacement": "auto",
      "barAlignment": 0,
      "drawStyle": "line",
      "fillOpacity": 0,
      "gradientMode": "none",
      "hideFrom": {
      "legend": false,
      "tooltip": false,
      "viz": false
      },
      "insertNulls": false,
      "lineInterpolation": "linear",
      "lineWidth": 1,
      "pointSize": 5,
      "scaleDistribution": {
      "type": "linear"
      },
      "showPoints": "auto",
      "spanNulls": false,
      "stacking": {
      "group": "A",
      "mode": "none"
      },
      "thresholdsStyle": {
      "mode": "off"
      }
      },
      "mappings": [],
      "max": 1,
      "thresholds": {
      "mode": "absolute",
      "steps": [
      {
      "color": "green",
      "value": null
      },
      {
      "color": "red",
      "value": 80
      }
      ]
      },
      "unit": "percentunit",
      "unitScale": true
      },
      "overrides": []
      },
      "gridPos": {
      "h": 8,
      "w": 24,
      "x": 0,
      "y": 1
      },
      "id": 1,
      "options": {
      "legend": {
      "calcs": [],
      "displayMode": "list",
      "placement": "bottom",
      "showLegend": true
      },
      "tooltip": {
      "mode": "single",
      "sort": "none"
      }
      },
      "targets": [
      {
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "editorMode": "code",
      "exemplar": false,
      "expr": "avg by (pod) (irate(container_cpu_usage_seconds_total {container=\"main\", namespace=~\"aic-ns-${PROJECT_NAME}.*\"}[90s]))\r\n* on (pod) group_left(annotation_pipelines_kubeflow_org_task_display_name) \r\nkube_pod_annotations {annotation_stream_history_id=\"\$stream_history_id\"}",
      "instant": false,
      "legendFormat": "{{annotation_pipelines_kubeflow_org_task_display_name}}",
      "range": true,
      "refId": "A"
      }
      ],
      "title": "CPU usage",
      "type": "timeseries"
      },
      {
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "fieldConfig": {
      "defaults": {
      "color": {
      "mode": "palette-classic"
      },
      "custom": {
      "axisBorderShow": false,
      "axisCenteredZero": false,
      "axisColorMode": "text",
      "axisLabel": "",
      "axisPlacement": "auto",
      "barAlignment": 0,
      "drawStyle": "line",
      "fillOpacity": 0,
      "gradientMode": "none",
      "hideFrom": {
      "legend": false,
      "tooltip": false,
      "viz": false
      },
      "insertNulls": false,
      "lineInterpolation": "linear",
      "lineWidth": 1,
      "pointSize": 5,
      "scaleDistribution": {
      "type": "linear"
      },
      "showPoints": "auto",
      "spanNulls": false,
      "stacking": {
      "group": "A",
      "mode": "none"
      },
      "thresholdsStyle": {
      "mode": "off"
      }
      },
      "fieldMinMax": false,
      "mappings": [],
      "thresholds": {
      "mode": "absolute",
      "steps": [
      {
      "color": "green",
      "value": null
      },
      {
      "color": "red",
      "value": 80
      }
      ]
      },
      "unit": "decbytes",
      "unitScale": true
      },
      "overrides": []
      },
      "gridPos": {
      "h": 8,
      "w": 24,
      "x": 0,
      "y": 9
      },
      "id": 2,
      "options": {
      "legend": {
      "calcs": [],
      "displayMode": "list",
      "placement": "bottom",
      "showLegend": true
      },
      "tooltip": {
      "mode": "single",
      "sort": "none"
      }
      },
      "targets": [
      {
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "editorMode": "code",
      "expr": "container_memory_working_set_bytes{container=\"main\", namespace=~\"aic-ns-${PROJECT_NAME}.*\"}\r\n* on (pod) group_left (annotation_pipelines_kubeflow_org_task_display_name) \r\nkube_pod_annotations {annotation_stream_history_id=\"\$stream_history_id\"}",
      "instant": false,
      "legendFormat": "{{annotation_pipelines_kubeflow_org_task_display_name}}",
      "range": true,
      "refId": "A"
      },
      {
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "editorMode": "code",
      "expr": "kube_pod_container_resource_limits{container=\"main\", namespace=~\"aic-ns-${PROJECT_NAME}.*\"}\r\n* on (pod) group_left (annotation_pipelines_kubeflow_org_task_display_name) \r\nkube_pod_annotations {annotation_stream_history_id=\"\$stream_history_id\"}",
      "hide": false,
      "instant": false,
      "legendFormat": "Maximum pod memory",
      "range": true,
      "refId": "B"
      }
      ],
      "title": "Memory usage",
      "type": "timeseries"
      }
      ],
      "refresh": "",
      "schemaVersion": 39,
      "tags": [],
      "templating": {
      "list": [
      {
      "current": {
      "isNone": true,
      "selected": false,
      "text": "None",
      "value": ""
      },
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "definition": "label_values(kube_pod_annotations, annotation_stream_history_id)",
      "hide": 0,
      "includeAll": false,
      "multi": false,
      "name": "stream_history_id",
      "options": [],
      "query": {
      "qryType": 1,
      "query": "label_values(kube_pod_annotations,annotation_stream_history_id)",
      "refId": "PrometheusVariableQueryEditor-VariableQuery"
      },
      "refresh": 2,
      "regex": "",
      "skipUrlSync": false,
      "sort": 0,
      "type": "query"
      },
      {
      "current": {
      "isNone": true,
      "selected": false,
      "text": "None",
      "value": ""
      },
      "datasource": {
      "type": "prometheus",
      "uid": "\${Datasource}"
      },
      "definition": "label_values(kube_pod_annotations {annotation_stream_history_id=\"\$stream_history_id\"}, annotation_pipelines_kubeflow_org_task_display_name)",
      "hide": 0,
      "includeAll": false,
      "multi": false,
      "name": "stream_name",
      "options": [],
      "query": {
      "qryType": 1,
      "query": "label_values(kube_pod_annotations {annotation_stream_history_id=\"\$stream_history_id\"}, annotation_pipelines_kubeflow_org_task_display_name)",
      "refId": "PrometheusVariableQueryEditor-VariableQuery"
      },
      "refresh": 1,
      "regex": "",
      "skipUrlSync": false,
      "sort": 0,
      "type": "query"
      },
      {
      "current": {
      "selected": false,
      "text": "",
      "value": ""
      },
      "hide": 0,
      "includeAll": false,
      "multi": false,
      "name": "Datasource",
      "options": [],
      "query": "prometheus",
      "queryValue": "",
      "refresh": 1,
      "regex": "",
      "skipUrlSync": false,
      "type": "datasource"
      }
      ]
      },
      "time": {
      "from": "now-5m",
      "to": "now"
      },
      "timeRangeUpdatedDuringEditOrView": false,
      "timepicker": {},
      "timezone": "browser",
      "title": "Training Pod monitor",
      "uid": "",
      "version": 1,
      "weekStart": ""
      }
      EOT
    • 직접 생성된 json의 내용을 copy하거나, 아래 명령를 이용합니다.

      xclip -selection clipboard < create-monitoring-dashboard.json
  • 대시보드 JSON Import
    • Grafana 좌측 메뉴의 Dashboards를 클릭합니다.
    • 우측 상단의 New를 클릭합니다.
    • 표시되는 메뉴 중 Import를 클릭합니다.
    • Import via dashboard JSON model 하단 영역에 clipboard의 JSON 내용을 붙여넣기 합니다.
    • Load클릭
    • 2-2. Grafana 폴더 생성에서 생성한 Folder를 선택합니다.
    • Import 클릭
    • 우측 상단의 Save dashboard 클릭
    • Save 클릭

3. Monitoring Dashboard 삭제

  • Grafana에 admin으로 로그인합니다.
  • 좌측 메뉴의 Dashboards를 클릭합니다.
  • 목록에서 삭제할 Dashboard를 선택합니다.
  • Dashboard 선택 후 나타나는 Delete 버튼을 클릭합니다.