Compare commits

..

No commits in common. "main" and "datetime" have entirely different histories.

2 changed files with 1 additions and 64 deletions

View File

@ -103,56 +103,3 @@ function ProcessLogToHash {
) )
ProduceHashMap -Elements $(getElems -Path $Path) ProduceHashMap -Elements $(getElems -Path $Path)
} }
function buildIntervals {
param (
$hash
)
$array = @()
foreach ($key in $hash.Keys){
#Write-Host $key
$list = $hash.$key
#Write-Host $list
$lastState = $null
$lastTS = $null
foreach ($elem in $list){
#Write-Host $elem
if (($elem.state -eq 'Started') -and ($null -eq $lastState)) {
$lastState=$elem.state
$lastTS=$elem.ts
}
if (($elem.state -ne 'Started') -and ($lastState -eq 'Started')) {
$array += @(New-Object psobject -Property @{
begining=$lastTS
ending=$elem.ts
state=$elem.state
vm=$key
})
$lastState=$null
$lastTS=$null
}
#Write-Host "$array"
}
}
return $array
}
function GetAffected {
param (
$listOfIntervals,
[datetime]$point,
[switch] $verbose
)
$array = @()
foreach ($elem in $listOfIntervals){
if ($point -le $elem.ending -and $point -ge $elem.begining){
if ($verbose) {
Write-Host "$point : $($elem.vm) $($elem.state)"
}
if(!$array.Contains($elem.vm)){
$array += @($elem.vm)
}
}
}
return $array
}

View File

@ -13,13 +13,3 @@ snrdaoeisnrdaoie:2024-02-06 20:00:00 some other Harddrive operation
snrdaoeisnrdaoie: VMware-Maschine 'test2' snrdaoeisnrdaoie: VMware-Maschine 'test2'
snrdaoeisnrdaoie:aoei aoei VMware-Maschine 'test2' snrdaoeisnrdaoie:aoei aoei VMware-Maschine 'test2'
snrdaoeisnrdaoie:2024-02-06 21:00:00 VMware-Maschine 'test2' snrdaoeisnrdaoie:2024-02-06 21:00:00 VMware-Maschine 'test2'
snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test'
snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test'
snrdaoeisnrdaoie:2024-02-06 20:00:00 some harddrive operation
nsriadoeisnrdaoei
snrdaoeisnrdaoie:2024-02-06 20:00:00 some other Harddrive operation
snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test' Erfolgreiche
snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test' Erfolgreiche
snrdaoeisnrdaoie:2024-02-06 20:01:00 VMware-Maschine 'test'
snrdaoeisnrdaoie:2024-02-06 20:00:00 gestartet VMware-Maschine 'test2'