Skip to content

Commit

Permalink
feat: add status line chart (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
mizy committed Feb 16, 2023
1 parent d4c0b43 commit ad351eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/components/Charts/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ function LineChart(props: IProps, ref) {
tickInterval: 10,
}
}
if (valueType === VALUE_TYPE.status) {
return {
min: 0,
max: 1,
tickInterval: 1,
}
}
if ((max - min) < 5) {
max = max + 5;
min = min < 0 ? min - 5 : 0;
Expand Down
5 changes: 3 additions & 2 deletions src/utils/promQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const enum VALUE_TYPE {
byteSecondNet = 'BYTE_SECOND_NET',
number = 'NUMBER',
numberSecond = 'numberSecond',
status = 'status'
}

export let SUPPORT_METRICS =
Expand Down Expand Up @@ -184,12 +185,12 @@ export let LINUX = (cluster?, device?: string): any => {
memory_cached_buffer_used_percentage: `((node_memory_Buffers_bytes${clusterSuffix2} + node_memory_Cached_bytes${clusterSuffix2}) / node_memory_MemTotal_bytes${clusterSuffix2} )* 100`,
memory_size: `node_memory_MemTotal_bytes${clusterSuffix2}`,
memory_swap_total: `node_memory_SwapTotal_bytes${clusterSuffix2}`,

// node load relative:
load_15s: `node_load1${clusterSuffix2}`,
load_5m: `node_load5${clusterSuffix2}`,
load_15m: `node_load15${clusterSuffix2}`,

// disk relative:
disk_used: `node_filesystem_size_bytes{${diskPararms}${devicePararms}${clusterSuffix1}} - node_filesystem_free_bytes{${diskPararms}${devicePararms}${clusterSuffix1}}`,
disk_free: `node_filesystem_avail_bytes{${diskPararms}${devicePararms}${clusterSuffix1}}`,
Expand Down

0 comments on commit ad351eb

Please sign in to comment.