Publish Idunn alarms through Bifrost CultMesh
This commit is contained in:
parent
993c98788c
commit
e06c2a6539
6 changed files with 96 additions and 2 deletions
2
scripts/notify-idunn-operator-alarm.cmd
Normal file
2
scripts/notify-idunn-operator-alarm.cmd
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\Projects\Odin\scripts\notify-idunn-operator-alarm.ps1
|
||||
23
scripts/notify-idunn-operator-alarm.ps1
Normal file
23
scripts/notify-idunn-operator-alarm.ps1
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$bifrostRoot = "E:\Projects\Bifrost"
|
||||
$publisherScript = Join-Path $bifrostRoot "tools\operator-notification.mjs"
|
||||
|
||||
if (-not (Test-Path -LiteralPath $publisherScript)) {
|
||||
throw "Bifrost operator-notification publisher is missing at $publisherScript."
|
||||
}
|
||||
|
||||
Push-Location -LiteralPath $bifrostRoot
|
||||
try {
|
||||
$arguments = @($publisherScript, "publish-idunn-alarm")
|
||||
if ($env:IDUNN_OPERATOR_ALARM_DRY_RUN -in @("1", "true", "yes", "on")) {
|
||||
$arguments += "--dry-run"
|
||||
}
|
||||
& node @arguments
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Bifrost operator-notification publisher exited with code $LASTEXITCODE."
|
||||
}
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ $ErrorActionPreference = "Stop"
|
|||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$idunnExe = Join-Path $repoRoot "target\debug\idunn.exe"
|
||||
$operatorAlarmCommand = Join-Path $repoRoot "scripts\notify-idunn-operator-alarm.cmd"
|
||||
$logDir = Join-Path $StateDir "logs"
|
||||
$pidDir = Join-Path $StateDir "pids"
|
||||
|
||||
|
|
@ -124,6 +125,9 @@ function Start-Watchdog {
|
|||
if (-not [string]::IsNullOrWhiteSpace($Watchdog.Restart)) {
|
||||
$arguments += @("--restart-command", $Watchdog.Restart, "--execute")
|
||||
}
|
||||
if (Test-Path -LiteralPath $operatorAlarmCommand) {
|
||||
$arguments += @("--operator-alarm-command", $operatorAlarmCommand)
|
||||
}
|
||||
$startInfo.Arguments = Join-WindowsArguments -Arguments $arguments
|
||||
|
||||
$process = [System.Diagnostics.Process]::new()
|
||||
|
|
|
|||
Loading…
Reference in a new issue