Update pi.ts

This commit is contained in:
Ryan Freeman 2023-07-31 13:37:17 +01:00 committed by GitHub
parent 588ec25403
commit 8035f977ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,9 @@ import fetcher from '@/lib/fetcher'
const GRAFANA_URL: string = process.env.GRAFANA_URL ?? "" const GRAFANA_URL: string = process.env.GRAFANA_URL ?? ""
const GRAFANA_TOKEN = process.env.GRAFANA_TOKEN const GRAFANA_TOKEN = process.env.GRAFANA_TOKEN
const day = 24 * 60 * 60 * 1000;
const yesterday = Date.now() - day;
export const getTemp = async () => { export const getTemp = async () => {
const response = await fetcher(GRAFANA_URL, { const response = await fetcher(GRAFANA_URL, {
method: 'POST', method: 'POST',
@ -22,7 +25,7 @@ export const getTemp = async () => {
"maxDataPoints": 100 "maxDataPoints": 100
} }
], ],
"from": "1681578682129", "from": yesterday.toString(),
"to": "now" "to": "now"
}) })
}) })
@ -53,7 +56,7 @@ export const getRootFsUsage = async () => {
"maxDataPoints": 100 "maxDataPoints": 100
} }
], ],
"from": "1681578682129", "from": yesterday.toString(),
"to": "now" "to": "now"
}) })
}) })
@ -84,7 +87,7 @@ export const getUptime = async () => {
"maxDataPoints": 100 "maxDataPoints": 100
} }
], ],
"from": "1681578682129", "from": yesterday.toString(),
"to": "now" "to": "now"
}) })
}) })
@ -123,7 +126,7 @@ export const getRamUsage = async () => {
"maxDataPoints": 100 "maxDataPoints": 100
} }
], ],
"from": "1681578682129", "from": yesterday.toString(),
"to": "now" "to": "now"
}) })
}) })
@ -154,7 +157,7 @@ export const getSysLoad = async () => {
"maxDataPoints": 100 "maxDataPoints": 100
} }
], ],
"from": "1681578682129", "from": yesterday.toString(),
"to": "now" "to": "now"
}) })
}) })