dbachecks icon indicating copy to clipboard operation
dbachecks copied to clipboard

Get-DbaAgentJob - Failed Jobs

Open jstexasdba opened this issue 7 years ago • 4 comments

Should we include where there is actually no output for Merge Replication or skip those jobs?

jstexasdba avatar Jan 26 '18 18:01 jstexasdba

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?

potatoqualitee avatar Feb 07 '18 11:02 potatoqualitee

@js0505 Do you know?

SQLDBAWithABeard avatar Mar 31 '18 11:03 SQLDBAWithABeard

Paging @sql-williamd - Do you know the answer to this?

SQLDBAWithABeard avatar May 19 '18 09:05 SQLDBAWithABeard

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 ??

SQLDBAWithABeard avatar May 20 '18 12:05 SQLDBAWithABeard