Skip to content

Commit 069750e

Browse files
so that #887 has some checks done
1 parent 2f25a0f commit 069750e

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

source/internal/functions/Get-AllAgentInfo.ps1

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function Get-AllAgentInfo {
6262
}
6363
'AgentServiceAccount' {
6464
if (($Instance.VersionMajor -ge 14) -or $IsLinux -or $Instance.HostPlatform -eq 'Linux') {
65-
$Agent = @($Instance.Query("SELECT status_desc, startup_type_desc FROM sys.dm_server_services") | Where-Object servicename -Like '*Agent*').ForEach{
65+
$Agent = @($Instance.Query("SELECT status_desc, startup_type_desc, servicename FROM sys.dm_server_services") | Where-Object servicename -Like '*Agent*').ForEach{
6666
[PSCustomObject]@{
6767
State = $PSItem.status_desc
6868
StartMode = $PSItem.startup_type_desc
@@ -163,10 +163,10 @@ function Get-AllAgentInfo {
163163

164164
$JobsFailed = ($Instance.JobServer.Jobs | Where-Object { $_.IsEnabled -and ($_.LastRunDate -gt $startdate) }).ForEach{
165165
[PSCustomObject]@{
166-
InstanceName = $Instance.Name
167-
JobName = $PSItem.Name
168-
ExpectedOutcome = $ConfigValues.FailedJob
169-
LastRunOutcome = $PSItem.LastRunOutcome
166+
InstanceName = $Instance.Name
167+
JobName = $PSItem.Name
168+
ExpectedOutcome = $ConfigValues.FailedJob
169+
LastRunOutcome = $PSItem.LastRunOutcome
170170
}
171171
}
172172
}
@@ -180,10 +180,10 @@ function Get-AllAgentInfo {
180180

181181
$JobOwner = $Instance.JobServer.Jobs.ForEach{
182182
[PSCustomObject]@{
183-
InstanceName = $Instance.Name
184-
JobName = $PSItem.Name
185-
ExpectedJobOwnerName = $ConfigValues.TargetJobOwner #$PSItem
186-
ActualJobOwnerName = $PSItem.OwnerLoginName
183+
InstanceName = $Instance.Name
184+
JobName = $PSItem.Name
185+
ExpectedJobOwnerName = $ConfigValues.TargetJobOwner #$PSItem
186+
ActualJobOwnerName = $PSItem.OwnerLoginName
187187
}
188188
}
189189
}
@@ -197,10 +197,10 @@ function Get-AllAgentInfo {
197197

198198
$InvalidJobOwner = $Instance.JobServer.Jobs.ForEach{
199199
[PSCustomObject]@{
200-
InstanceName = $Instance.Name
201-
JobName = $PSItem.Name
202-
ExpectedJobOwnerName = $ConfigValues.InvalidJobOwner
203-
ActualJobOwnerName = $PSItem.OwnerLoginName
200+
InstanceName = $Instance.Name
201+
JobName = $PSItem.Name
202+
ExpectedJobOwnerName = $ConfigValues.InvalidJobOwner
203+
ActualJobOwnerName = $PSItem.OwnerLoginName
204204
}
205205
}
206206

@@ -303,13 +303,13 @@ function Get-AllAgentInfo {
303303

304304
$LongRunningJobs = $($runningjobs | Where-Object { $_.AvgSec -ne 0 }).ForEach{
305305
[PSCustomObject]@{
306-
InstanceName = $Instance.Name
307-
JobName = $PSItem.JobName
308-
RunningSeconds = $PSItem.RunningSeconds
309-
Average = $PSItem.AvgSec
310-
Diff = $PSItem.Diff
311-
ExpectedLongRunningJobPercentage = $ConfigValues.LongRunningJob
312-
ActualLongRunningJobPercentage = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)
306+
InstanceName = $Instance.Name
307+
JobName = $PSItem.JobName
308+
RunningSeconds = $PSItem.RunningSeconds
309+
Average = $PSItem.AvgSec
310+
Diff = $PSItem.Diff
311+
ExpectedLongRunningJobPercentage = $ConfigValues.LongRunningJob
312+
ActualLongRunningJobPercentage = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)
313313
}
314314
}
315315
}
@@ -367,12 +367,12 @@ function Get-AllAgentInfo {
367367

368368
$LastJobRuns = $($lastagentjobruns | Where-Object { $_.AvgSec -ne 0 }).ForEach{
369369
[PSCustomObject]@{
370-
InstanceName = $Instance.Name
371-
JobName = $PSItem.JobName
372-
Duration = $PSItem.Duration
373-
Average = $PSItem.AvgSec
374-
ExpectedRunningJobPercentage = $ConfigValues.LastJobRuns
375-
ActualRunningJobPercentage = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)
370+
InstanceName = $Instance.Name
371+
JobName = $PSItem.JobName
372+
Duration = $PSItem.Duration
373+
Average = $PSItem.AvgSec
374+
ExpectedRunningJobPercentage = $ConfigValues.LastJobRuns
375+
ActualRunningJobPercentage = [math]::Round($PSItem.Diff / $PSItem.AvgSec * 100)
376376
}
377377
}
378378
}

0 commit comments

Comments
 (0)