Try   HackMD

Grafana 技巧 Value Mapping

將接收到的值(value)去映射(mapping)到想要的文字或 emoji😊

1.匯入 data source 後,在 Edit panel 右方找到 overrides,點選 +Add field override

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.選擇 field with name,找到你想做 value mapping 的欄位

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.選擇 +Add override property,找到 Value mappings > value mappings

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

4.選擇 Add value mappings,在 Condition 欄位填入想進行 mapping 的值(有四種輸入格式: value, range, regex, special),並在 Display text 填入要對應顯示的文字或符號

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Condition 這邊我輸入格式以 range 做示範
value: 0~30 -> bad, 31~60 -> normal, 61~100 -> good

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

5.Update後即完成! 檢查 value 是否有依預期的判斷式進行變化

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

補充: Set Color 可以進行顏色的更改

1.在 +Add override property 新增 Cell display mode,並將預設的 Auto 改成 color text 指定更改文字顏色(選擇 color background 可以更改欄位底色)

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.在 value mappings 裡右邊的 Color 選擇顏色

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

3.文字顏色變更完成!

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

tags: Grafana tips value mapping