feat : ajout page monitoring

This commit is contained in:
2026-03-06 15:26:51 +01:00
parent 993524aa72
commit 8b5d4e9655
21 changed files with 11098 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
export default defineEventHandler(async () => {
const targets = [
{ label: "Ferme", url: "http://ferme.malio-dev.fr/api/version" },
{ label: "SIRH", url: "http://sirh.malio-dev.fr/api/version" },
{ label: "Inventory", url: "http://inventory.malio-dev.fr/api/health" },
]
const results = await Promise.all(
targets.map(async (target) => {
try {
const response = await fetch(target.url, {
method: "GET",
headers: { Accept: "application/json" }
})
return {
label: target.label,
url: target.url,
ok: response.status === 200,
status: response.status,
checkedAt: new Date().toISOString()
}
} catch (error) {
return {
label: target.label,
url: target.url,
ok: false,
status: 0,
checkedAt: new Date().toISOString(),
error: error instanceof Error ? error.message : String(error)
}
}
})
)
return { results }
})