VB code to see if a BCA Queue is up or down?

Hi,

We have been having problems lately with queues going down and not bouncing back up again. What we would like to have is a little VB app which runs hourly or 1/2 hourly, whatever, which queries the security universe?? and finds up which queues are up or down??

Anyone any ideas on this?

Stuart


stuartgmilton :uk: (BOB member since 2003-01-30)

I think you will find pieces of sql to show you the documents in the queue(s) of BCA when you search BOB :wink: .
You can test if the current time is past the scheduled time of the jobs in the queue: then you know something is wrong :yesnod: !

HenkK


HenkK :netherlands: (BOB member since 2004-03-02)

To be fair, I wouldn’t want to rely on that way, because the dates can not be trusted. We have a couple jobs that have failed a month before there due to run and stuff like that.

Thanks for the idea though.

Stuart


stuartgmilton :uk: (BOB member since 2003-01-30)

Folks, you know in BO, when you schedule a job to a queue which is down, and error message is shown.

Would it be possible to trap this in vb?

Stuart


stuartgmilton :uk: (BOB member since 2003-01-30)

Do you mean when a scheduler shuts itself down, it isn’t coming back up? :?

If so, you could have a VB program to parse the log file for “Scheduler stopped by automatic shutdown.” and then error if it didn’t get a subsequent “Scheduler started successfully.”


RobinM :uk: (BOB member since 2003-02-25)

Wheres the log file, so I can have a look?


stuartgmilton :uk: (BOB member since 2003-01-30)

[b]c:\program files\Business Objects\Server\Broadcast Agent 5.0[/b] has the scheduler logs in (see the corresponding .ini files to translate BcsScdul_BCA_x.log into scheduler name)

Also see :
c:\program files\Business Objects\Server\System 2.5\Bin - server logs in if you’ve enabled them from the admin console
c:\program files\Business Objects\Server\BusinessObjects Manager 5.0 - BOManager logs, if you’ve enabled them (see bomgr_diag.ini)

:slight_smile:


RobinM :uk: (BOB member since 2003-02-25)

Cheers Robin,

Sounds like a hell of a job!!


stuartgmilton :uk: (BOB member since 2003-01-30)

I’ve never encountered the problem of schedulers not coming back up (that is what we’re talking about, right?), but how about something like this:


Option Explicit

Const sShutDownMsg As String = "Scheduler stopped by automatic shutdown"
Const sStartUpMsg As String = "Scheduler started successfully"
Dim oFSO As Scripting.FileSystemObject
Dim oTS As Scripting.TextStream

Public Sub Main()
Set oFSO = New Scripting.FileSystemObject
Set oTS = oFSO.OpenTextFile("c:\program files\Business Objects\Server\Broadcast Agent 5.0\BcsScdul_BCA_1.log", ForReading)
Dim sLine As String
Dim bAlive As Boolean
bAlive = False

Do Until oTS.AtEndOfStream
    sLine = oTS.ReadLine
    If InStr(sLine, sStartUpMsg) Then
        bAlive = True
    ElseIf InStr(sLine, sShutDownMsg) Then
        bAlive = False
    End If
Loop

If bAlive = True Then
    ' Woohoo, scheduler is alive and kicking
Else
    ' D'OH! it appears the scheduler shut down and never woke up again; it is an ex-scheduler.
End If

End Sub

RobinM :uk: (BOB member since 2003-02-25)

That works a treat thanks.

All we have to do now, is work out how to get it running constantly like a service or something?

But thats not my job thankfully!

Thanks for your help,

Stuart


stuartgmilton :uk: (BOB member since 2003-01-30)

Glad it works :slight_smile:
Two options spring to mind for running it, both are a bit of a kludge:
i) Compile to .exe and run it using Windows’ Scheduled Tasks - tacky, but works!
ii) Run it as VBA in a BCA scheduled report (although not so clever if your BCA isn’t working reliably!)

Cheers, Robin.


RobinM :uk: (BOB member since 2003-02-25)

Yep, the other idea I had was having it as a windows service???


stuartgmilton :uk: (BOB member since 2003-01-30)

I wouldn’t have a scooby about that I’m afraid, sounds like it ought to work but is beyond my realms of knowledge :lol:


RobinM :uk: (BOB member since 2003-02-25)

Now I realise this could be a very stupid question!! But, what other stoppage messages am I likely to encounter in these log files.

For instance, our queues bounce every two hours with “Scheduler stopped by automatic shutdown”, and then they come back online again, but every so often they don’t. This is whats prompte the post.

Are there likely to be messages like;

Scheduler stopped unexpectadly or
Scheduler stopped by PC Crash
etc etc???

Just wondering about how to add in some error handling and stuff???


stuartgmilton :uk: (BOB member since 2003-01-30)

To schedule an exe on windows you can either use win’s own scheduler (i think thats good enough) or install another scheduler like cron - as I remember it has windows version as well. Win’s scheduler runs as a service - so if it kicks off your exe it will be almost like a service :slight_smile: . You can even specify the process owner for your application.
To monitor if scheduler worked or not I would do this:
schedule a short report running in every 15 minutes on every stream. It can be something like: select sysdate from dual… so just get back one row real quickly to not load the bca unnecessarily. Then write a program (VBA, perl, whatever…) which runs an sql against the repo to search for the last entry of your report in the ds_pending_jobs table by stream. If report did not run successfuly for ~30 (15 + scheduler delay + acceptable latency ) minutes for a stream, generate an alert .


PeterC :hungary: (BOB member since 2005-02-14)

Can you post the log of a scheduler that has failed, it may be obvious what messages to look for.


RobinM :uk: (BOB member since 2003-02-25)

Sorry, I had to most of the file, but you’ll notice on 02/15/05 at approximately 17:04:45 that the queue when down as normal, but just didn’t come back up again. So none of the reports ran. As you’ll see it came back up on the 17th.

I don’t know what the problem is, but as long as I can get my app working then I’ll know as soon as I come in in the morning, and I’ll be a ble to deal with it then.

Stuart
BcsScdul_BCA_1.txt (94.0 KB)


stuartgmilton :uk: (BOB member since 2003-01-30)

Based on that log, my original suggestion (and code) will work; the scheduler shutdown and didn’t wake up a few minutes later, so bAlive would be false when the program next ran.

PeterC’s suggestion should also work, you could do variations on a theme by not querying DS_PENDING_JOB but the regular BCA job could instead write (VBA) a timestamped text file that your monitor program could interogate.


RobinM :uk: (BOB member since 2003-02-25)

So I guess what we want is to schedule our program to run every 30 minutes. That way we know if its down outwith a normal bounce.

Thanks for the help on this one, the codes an absolute treat!


stuartgmilton :uk: (BOB member since 2003-01-30)