Add PowerShell-free Windows installer
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Installation auf dem BizTalk-Server
|
||||
|
||||
1. `BizTalkCheckmkPulse-Setup.zip` vollstaendig in ein lokales Verzeichnis entpacken.
|
||||
2. `Setup.exe` als lokaler Administrator starten und die UAC-Abfrage bestaetigen.
|
||||
3. Das Collector-Konto im Format `DOMAIN\Benutzer` eingeben, zum Beispiel
|
||||
`BEW\t231bizmon`.
|
||||
4. Kennwort und Umgebung eingeben und **Installieren / aktualisieren** waehlen.
|
||||
5. Im Aufgabenplaner den Task `BizTalk Checkmk Pulse Provider` und danach den
|
||||
Checkmk-Agent-Dump kontrollieren.
|
||||
|
||||
PowerShell wird fuer Installation, Update, Deinstallation und Laufzeit nicht
|
||||
benoetigt. Das Kennwort wird direkt an die Windows-Aufgabenplanung uebergeben
|
||||
und weder in einer Datei noch in einer Prozesskommandozeile abgelegt.
|
||||
|
||||
Der Installer vergibt keine AD-, BizTalk- oder SQL-Berechtigungen. Das Konto
|
||||
muss separat Mitglied der fuer die BizTalk-Gruppe konfigurierten Read-Only-
|
||||
Gruppe sein und lokal das Recht `Log on as a batch job` besitzen.
|
||||
|
||||
Bei einer Deinstallation bleiben Snapshot und Logs absichtlich unter
|
||||
`%ProgramData%\BizTalkCheckmkPulse` erhalten. Sie koennen nach der
|
||||
Betriebsfreigabe manuell entfernt werden.
|
||||
@@ -1,171 +0,0 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$CollectorAccount,
|
||||
|
||||
[switch]$Gmsa,
|
||||
|
||||
[ValidateSet("", "ACC", "DEV", "TST", "PRD")]
|
||||
[string]$EnvironmentName = "",
|
||||
|
||||
[string]$InstallDirectory = "$env:ProgramFiles\BizTalkCheckmkPulse",
|
||||
|
||||
[string]$CheckmkLocalDirectory = "$env:ProgramData\checkmk\agent\local"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version 2.0
|
||||
|
||||
$taskName = "BizTalk Checkmk Pulse Provider"
|
||||
$runtimeRoot = Join-Path $env:ProgramData "BizTalkCheckmkPulse"
|
||||
$dataDirectory = Join-Path $runtimeRoot "data"
|
||||
$logDirectory = Join-Path $runtimeRoot "logs"
|
||||
$sourceApplication = Join-Path $PSScriptRoot "application"
|
||||
$sourceWrapper = Join-Path $PSScriptRoot "biztalk_checkmk_pulse.cmd"
|
||||
$targetExe = Join-Path $InstallDirectory "BizTalkCheckmkPulse.exe"
|
||||
$targetConfig = "$targetExe.config"
|
||||
$targetWrapper = Join-Path $CheckmkLocalDirectory "biztalk_checkmk_pulse.cmd"
|
||||
|
||||
function Assert-Administrator {
|
||||
$identity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$principal = New-Object Security.Principal.WindowsPrincipal($identity)
|
||||
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
throw "Die Installation muss in einer administrativen Windows PowerShell ausgefuehrt werden."
|
||||
}
|
||||
}
|
||||
|
||||
function Invoke-Icacls {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$Path,
|
||||
[Parameter(Mandatory = $true)][string[]]$Arguments
|
||||
)
|
||||
|
||||
& icacls.exe $Path @Arguments | Out-Host
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "icacls ist fuer '$Path' mit Exitcode $LASTEXITCODE fehlgeschlagen."
|
||||
}
|
||||
}
|
||||
|
||||
Assert-Administrator
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sourceApplication -PathType Container)) {
|
||||
throw "Quellverzeichnis fehlt: $sourceApplication"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $sourceWrapper -PathType Leaf)) {
|
||||
throw "Checkmk-Wrapper fehlt: $sourceWrapper"
|
||||
}
|
||||
|
||||
if ($Gmsa -and -not $CollectorAccount.EndsWith('$')) {
|
||||
throw "Ein gMSA-Kontoname muss mit '$' enden, z.B. DOMAIN\svc_biztalk_cmk$."
|
||||
}
|
||||
|
||||
Write-Host "Installiere Programmdateien nach $InstallDirectory ..."
|
||||
New-Item -ItemType Directory -Path $InstallDirectory -Force | Out-Null
|
||||
Copy-Item -Path (Join-Path $sourceApplication "*") -Destination $InstallDirectory -Force
|
||||
|
||||
[xml]$configuration = Get-Content -LiteralPath $targetConfig
|
||||
$environmentSetting = $configuration.configuration.appSettings.add |
|
||||
Where-Object { $_.key -eq "EnvironmentName" } |
|
||||
Select-Object -First 1
|
||||
if ($null -eq $environmentSetting) {
|
||||
throw "EnvironmentName fehlt in $targetConfig."
|
||||
}
|
||||
$environmentSetting.value = $EnvironmentName
|
||||
$configuration.Save($targetConfig)
|
||||
|
||||
Write-Host "Erzeuge Runtime-Verzeichnisse und Least-Privilege-ACLs ..."
|
||||
New-Item -ItemType Directory -Path $runtimeRoot, $dataDirectory, $logDirectory -Force | Out-Null
|
||||
|
||||
# Runtime-Root: Provider lesen, SYSTEM lesen, lokale Administratoren verwalten.
|
||||
Invoke-Icacls -Path $runtimeRoot -Arguments @(
|
||||
"/inheritance:r",
|
||||
"/grant:r",
|
||||
"*S-1-5-18:(OI)(CI)(RX)",
|
||||
"*S-1-5-32-544:(OI)(CI)(F)",
|
||||
"${CollectorAccount}:(OI)(CI)(RX)"
|
||||
)
|
||||
|
||||
# Daten: ausschliesslich Provider schreibt, LocalSystem liest den Snapshot.
|
||||
Invoke-Icacls -Path $dataDirectory -Arguments @(
|
||||
"/inheritance:r",
|
||||
"/grant:r",
|
||||
"*S-1-5-18:(OI)(CI)(RX)",
|
||||
"*S-1-5-32-544:(OI)(CI)(F)",
|
||||
"${CollectorAccount}:(OI)(CI)(M)"
|
||||
)
|
||||
|
||||
# Logs: Provider und LocalSystem-Consumer duerfen getrennte Diagnosezeilen anhaengen.
|
||||
Invoke-Icacls -Path $logDirectory -Arguments @(
|
||||
"/inheritance:r",
|
||||
"/grant:r",
|
||||
"*S-1-5-18:(OI)(CI)(M)",
|
||||
"*S-1-5-32-544:(OI)(CI)(F)",
|
||||
"${CollectorAccount}:(OI)(CI)(M)"
|
||||
)
|
||||
|
||||
Write-Host "Installiere Checkmk Local Check nach $CheckmkLocalDirectory ..."
|
||||
New-Item -ItemType Directory -Path $CheckmkLocalDirectory -Force | Out-Null
|
||||
Copy-Item -LiteralPath $sourceWrapper -Destination $targetWrapper -Force
|
||||
|
||||
Write-Host "Registriere Scheduled Task '$taskName' ..."
|
||||
$action = New-ScheduledTaskAction `
|
||||
-Execute $targetExe `
|
||||
-Argument "--collect" `
|
||||
-WorkingDirectory $InstallDirectory
|
||||
$trigger = New-ScheduledTaskTrigger `
|
||||
-Once `
|
||||
-At (Get-Date).AddMinutes(1) `
|
||||
-RepetitionInterval (New-TimeSpan -Minutes 1)
|
||||
$settings = New-ScheduledTaskSettingsSet `
|
||||
-MultipleInstances IgnoreNew `
|
||||
-ExecutionTimeLimit (New-TimeSpan -Minutes 5) `
|
||||
-StartWhenAvailable `
|
||||
-RestartCount 2 `
|
||||
-RestartInterval (New-TimeSpan -Minutes 1)
|
||||
|
||||
if ($Gmsa) {
|
||||
$principal = New-ScheduledTaskPrincipal `
|
||||
-UserId $CollectorAccount `
|
||||
-LogonType Password `
|
||||
-RunLevel Limited
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings -Principal $principal
|
||||
Register-ScheduledTask -TaskName $taskName -InputObject $task -Force | Out-Null
|
||||
}
|
||||
else {
|
||||
$credential = Get-Credential `
|
||||
-UserName $CollectorAccount `
|
||||
-Message "Kennwort fuer das dedizierte BizTalk-Monitoringkonto eingeben"
|
||||
if ($credential.UserName -ne $CollectorAccount) {
|
||||
throw "Das eingegebene Konto stimmt nicht mit CollectorAccount ueberein."
|
||||
}
|
||||
|
||||
$principal = New-ScheduledTaskPrincipal `
|
||||
-UserId $CollectorAccount `
|
||||
-LogonType Password `
|
||||
-RunLevel Limited
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings -Principal $principal
|
||||
Register-ScheduledTask `
|
||||
-TaskName $taskName `
|
||||
-InputObject $task `
|
||||
-User $CollectorAccount `
|
||||
-Password $credential.GetNetworkCredential().Password `
|
||||
-Force | Out-Null
|
||||
}
|
||||
|
||||
Write-Host "Fuehre formatseitigen Self-Test aus ..."
|
||||
$selfTest = & $targetExe --self-test
|
||||
if ($LASTEXITCODE -ne 0 -or @($selfTest).Count -ne 8) {
|
||||
throw "Self-Test fehlgeschlagen. Erwartet wurden acht Checkmk-Zeilen."
|
||||
}
|
||||
|
||||
Write-Host "Starte den Provider einmalig ..."
|
||||
Start-ScheduledTask -TaskName $taskName
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Installation abgeschlossen."
|
||||
Write-Host "Naechste Pruefungen:"
|
||||
Write-Host " Get-ScheduledTaskInfo -TaskName '$taskName'"
|
||||
Write-Host " Get-Content '$logDirectory\biztalk-checkmk-pulse-*.log' -Tail 50"
|
||||
Write-Host " & '$targetExe' --consume"
|
||||
Write-Host " & 'C:\Program Files (x86)\checkmk\service\cmk-agent-ctl.exe' dump"
|
||||
@@ -1,30 +0,0 @@
|
||||
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "High")]
|
||||
param(
|
||||
[string]$InstallDirectory = "$env:ProgramFiles\BizTalkCheckmkPulse",
|
||||
[string]$CheckmkLocalDirectory = "$env:ProgramData\checkmk\agent\local",
|
||||
[switch]$KeepRuntimeData
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$taskName = "BizTalk Checkmk Pulse Provider"
|
||||
$runtimeRoot = Join-Path $env:ProgramData "BizTalkCheckmkPulse"
|
||||
$wrapper = Join-Path $CheckmkLocalDirectory "biztalk_checkmk_pulse.cmd"
|
||||
|
||||
if ($PSCmdlet.ShouldProcess($taskName, "Scheduled Task entfernen")) {
|
||||
Unregister-ScheduledTask -TaskName $taskName -Confirm:$false -ErrorAction SilentlyContinue
|
||||
}
|
||||
if (Test-Path -LiteralPath $wrapper) {
|
||||
if ($PSCmdlet.ShouldProcess($wrapper, "Checkmk Local Check entfernen")) {
|
||||
Remove-Item -LiteralPath $wrapper -Force
|
||||
}
|
||||
}
|
||||
if (Test-Path -LiteralPath $InstallDirectory) {
|
||||
if ($PSCmdlet.ShouldProcess($InstallDirectory, "Programmdateien entfernen")) {
|
||||
Remove-Item -LiteralPath $InstallDirectory -Recurse -Force
|
||||
}
|
||||
}
|
||||
if (-not $KeepRuntimeData -and (Test-Path -LiteralPath $runtimeRoot)) {
|
||||
if ($PSCmdlet.ShouldProcess($runtimeRoot, "Snapshot und Logs entfernen")) {
|
||||
Remove-Item -LiteralPath $runtimeRoot -Recurse -Force
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ set "BASE=%ProgramFiles%\BizTalkCheckmkPulse"
|
||||
set "EXE=%BASE%\BizTalkCheckmkPulse.exe"
|
||||
|
||||
if not exist "%EXE%" (
|
||||
echo 3 "BizTalk Platform" - BizTalkCheckmkPulse.exe fehlt unter %BASE%. Massnahme: Install-BizTalkCheckmkPulse.ps1 erneut als Administrator ausfuehren und danach cmk-agent-ctl.exe dump erneut ausfuehren.
|
||||
echo 3 "BizTalk Platform" - BizTalkCheckmkPulse.exe fehlt unter %BASE%. Massnahme: Setup.exe erneut als Administrator ausfuehren und danach cmk-agent-ctl.exe dump erneut ausfuehren.
|
||||
echo 3 "BizTalk SQL Access" - BizTalkCheckmkPulse.exe fehlt unter %BASE%. Massnahme: Deployment-Paket und Dateirechte pruefen.
|
||||
echo 3 "BizTalk Suspended Instances" - BizTalkCheckmkPulse.exe fehlt unter %BASE%. Massnahme: Deployment-Paket und Dateirechte pruefen.
|
||||
echo 3 "BizTalk Host Instances" - BizTalkCheckmkPulse.exe fehlt unter %BASE%. Massnahme: Deployment-Paket und Dateirechte pruefen.
|
||||
|
||||
Reference in New Issue
Block a user