dbachecks
dbachecks copied to clipboard
Get-DbaAgentJob - Failed Jobs
Should we include where there is actually no output for Merge Replication or skip those jobs?
Do they error regularly when there's actually no reason? If so, yes skip. Or does the test end up failing because of something weird?
@js0505 Do you know?
Paging @sql-williamd - Do you know the answer to this?
So, I had a chat with William and as I understand it the agent jobs are set to an infinite retry rather than a failure and they are constantly running so there is no last run outcome to check. I think this means that we will have a Test failure as the lastrun outcome will not equal Succeeded or Unknown (which is skipped) and that may or may not be correct.
As this is validation and not monitoring and there should be other options available for monitoring I think we should be skipping these jobs?
Looking here https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.completionresult.aspx
The options are
Cancelled The job or job step was canceled. Failed The job or job step completed with failure. InProgress The job or job step is still in progress. Retry The job or job step is waiting to be retried. Succeeded The job or job step completed successfully. Unknown The status of the job or job step is unknown
So it may be that the logic here https://github.com/sqlcollaborative/dbachecks/blob/development/checks/Agent.Tests.ps1#L77 should be altered to include those possible values and skip the test if the job is InProgress or retry as well as when it is in an unknown state
Does that sound like a reasonable plan @js0505 ??