feat: display node label instead of instance IP, update CPU query to group by node
CI/CD / build-and-push (push) Successful in 1m32s
Details
CI/CD / build-and-push (push) Successful in 1m32s
Details
This commit is contained in:
parent
a76af584cb
commit
40d77921a9
|
|
@ -31,7 +31,7 @@ config:
|
|||
REPORT_STEP: "5m"
|
||||
REPORT_RANGE_DAYS: "7"
|
||||
TZ: "Asia/Seoul"
|
||||
QUERY_CPU: '100 - (avg by (instance)(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)'
|
||||
QUERY_CPU: '100 - (avg by (node)(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)'
|
||||
QUERY_MEMORY: '(1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100'
|
||||
QUERY_DISK: 'sum by (mountpoint,fstype)((1 - node_filesystem_avail_bytes{fstype!~"tmpfs|overlay|nfs",mountpoint!~"/boot.*"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay|nfs",mountpoint!~"/boot.*"}) * 100)'
|
||||
QUERY_NAS: '((node_filesystem_size_bytes{fstype=~"nfs", node=~".*(bastion).*"} - node_filesystem_free_bytes{fstype=~"nfs", node=~".*(bastion).*"}) / node_filesystem_size_bytes{fstype=~"nfs", node=~".*(bastion).*"}) * 100'
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export async function GET(
|
|||
const process = (results: typeof rxResults) => results.map((r) => {
|
||||
const dataPoints = parsePrometheusValues(r.values);
|
||||
return {
|
||||
instance: r.metric.instance || '',
|
||||
instance: r.metric.node || r.metric.instance || '',
|
||||
dataPoints,
|
||||
stats: calculateStats(dataPoints),
|
||||
peaks: detectPeaks(dataPoints),
|
||||
|
|
@ -60,7 +60,7 @@ export async function GET(
|
|||
const instances = results.map((r) => {
|
||||
const dataPoints = parsePrometheusValues(r.values);
|
||||
return {
|
||||
instance: r.metric.instance || '',
|
||||
instance: r.metric.node || r.metric.instance || '',
|
||||
metric: r.metric,
|
||||
dataPoints,
|
||||
stats: calculateStats(dataPoints),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ function processResults(results: { metric: Record<string, string>; values: [numb
|
|||
return results.map((r) => {
|
||||
const dataPoints = parseValues(r.values);
|
||||
return {
|
||||
instance: r.metric.instance || '',
|
||||
instance: r.metric.node || r.metric.instance || '',
|
||||
metric: r.metric,
|
||||
dataPoints,
|
||||
stats: calculateStats(dataPoints),
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export async function queryInstant(query: string): Promise<PrometheusRangeResult
|
|||
|
||||
export const QUERIES = {
|
||||
cpuUsage: process.env.QUERY_CPU
|
||||
|| '100 - (avg by (instance)(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)',
|
||||
|| '100 - (avg by (node)(rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)',
|
||||
memoryUsage: process.env.QUERY_MEMORY
|
||||
|| '(1 - node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) * 100',
|
||||
diskUsage: process.env.QUERY_DISK
|
||||
|
|
|
|||
Loading…
Reference in New Issue