mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-25 15:35:42 +00:00
Fixed grafana queries
This commit is contained in:
parent
b9d54cbe5b
commit
6a666138e3
@ -22,13 +22,15 @@ export const getTemp = async () => {
|
|||||||
"maxDataPoints": 100
|
"maxDataPoints": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"from": "now-5m",
|
"from": "1681578682129",
|
||||||
"to": "now"
|
"to": "now"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const temp = parseInt(response.results.A.frames[0].data.values[1].slice(-1))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
temp: response.results.A.frames[0].data.values[1][15].toFixed(2)
|
temp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,13 +53,15 @@ export const getRootFsUsage = async () => {
|
|||||||
"maxDataPoints": 100
|
"maxDataPoints": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"from": "now-5m",
|
"from": "1681578682129",
|
||||||
"to": "now"
|
"to": "now"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const rootFsUsage = parseInt(response.results.A.frames[0].data.values[1].slice(-1))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
rootFsUsage: response.results.A.frames[0].data.values[1][15].toFixed(2)
|
rootFsUsage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,19 +84,19 @@ export const getUptime = async () => {
|
|||||||
"maxDataPoints": 100
|
"maxDataPoints": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"from": "now-5m",
|
"from": "1681578682129",
|
||||||
"to": "now"
|
"to": "now"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const seconds = response.results.A.frames[0].data.values[1][15]
|
const seconds = parseInt(response.results.A.frames[0].data.values[1].slice(-1))
|
||||||
const minutes = (seconds / 60).toFixed(2)
|
const minutes = (seconds / 60)
|
||||||
const hours = (seconds / 3_600).toFixed(2)
|
const hours = (seconds / 3_600)
|
||||||
const days = (seconds / 86400).toFixed(2)
|
const days = (seconds / 86400)
|
||||||
const weeks = (seconds / 604_800).toFixed(2)
|
const weeks = (seconds / 604_800)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
seconds: (seconds).toFixed(2),
|
seconds: (seconds),
|
||||||
minutes,
|
minutes,
|
||||||
hours,
|
hours,
|
||||||
days,
|
days,
|
||||||
@ -119,13 +123,15 @@ export const getRamUsage = async () => {
|
|||||||
"maxDataPoints": 100
|
"maxDataPoints": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"from": "now-5m",
|
"from": "1681578682129",
|
||||||
"to": "now"
|
"to": "now"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const ramUsage = parseInt(response.results.A.frames[0].data.values[1].slice(-1))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ramUsage: response.results.A.frames[0].data.values[1][15].toFixed(2)
|
ramUsage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,12 +154,14 @@ export const getSysLoad = async () => {
|
|||||||
"maxDataPoints": 100
|
"maxDataPoints": 100
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"from": "now-5m",
|
"from": "1681578682129",
|
||||||
"to": "now"
|
"to": "now"
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const sysLoad = parseInt(response.results.A.frames[0].data.values[1].slice(-1))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sysLoad: response.results.A.frames[0].data.values[1][15].toFixed(2)
|
sysLoad
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user