Home Orchestrator

Monitor monitoring runbooks

Peter_MiklianPeter_Miklian Customer Advanced IT Monkey ✭✭✭

Hi,

could anyone advise how to monitor and restart monitoring runbooks?

We have some monitoring runbooks which have to run all the time.

They use to stop sometimes (Orchestrator server loses connection to its database/SCSM server, server restarts, any other failures, etc).

We need to know about these failures and restart those monitoring runbooks automatically.

My searching of the web was unsuccessful, I only found some clues to check runbook statuses directly in the Orchestrator database. Thank you.

Answers

  • Brian_WiestBrian_Wiest Customer Super IT Monkey ✭✭✭✭✭

    I accomplish this by a Schedule task that runs every hour to make sure the jobs are running. Just place in your paths and it will make sure there is a running job.


    if ( !(Get-Module -Name OrchestratorServiceModule -ErrorAction SilentlyContinue) ) {Import-Module E:\Powershell\SCOrchestratorServicePowerShellV1_2\OrchestratorServiceModule.psm1}


    $scorh_url = "http://orchestrator.local:81/Orchestrator2012/orchestrator.svc/"

    $Runbook_folders = @('Runbookpath1','Runbookpath2')


    foreach ($Runbook_folder in $Runbook_folders)

       {

       $Runbooks = Get-OrchestratorRunbook -ServiceUrl $scorh_url -RunbookPath $Runbook_folder

       foreach ($Runbook in $Runbooks)

       {

       $Runbookid = Get-OrchestratorRunbook -ServiceUrl $scorh_url -RunbookId $Runbook.id

       $RunningJob = Get-OrchestratorJob -ServiceUrl $scorh_url -RunbookId $Runbookid.id | Where-Object {$_.Status -eq 'Running'}

       If($Runningjob -eq $null)

           {

           $Runbook = Get-OrchestratorRunbook -ServiceUrl $scorh_url -RunbookId $Runbookid.id

           Start-OrchestratorRunbook -Runbook $Runbook

           }

       Else {}

       }

       }

Sign In or Register to comment.