Video Screencast Help
Scheduled Maintenance: Symantec Connect is scheduled to be down Saturday, April 19 from 10am to 2pm Pacific Standard Time (GMT: 5pm to 9pm) for server migration and upgrades.
Please accept our apologies in advance for any inconvenience this might cause.

Deployment Server 6.9 Engine Checker

Created: 30 Oct 2013 • Updated: 30 Oct 2013 | 1 comment
ianatkin's picture
+3 5 Votes
Login to vote

Today's download is a monitoring script I use on my revision 6.9 Deployment Servers. This logs engine activity and I use this in conjunction with Monitor Solution to alert me should the axengine.exe process hang.

This alert is important for us as engine hangs, although rare, are most confusing for Deployment console users. Everything appears to be good at the console, it's just that the clients will not execute any jobs. This script lets know in advance when the engine is down, allowing us to kill of the axengine.exe process automatically and restart the service.

The Script

As usual, this magic is done with a vbscript. Attached to this article you'll find a .zip file holding a single script file, AxEngine_Service_Check.vbs. In what follows, I'll assume you've put it on your deployment server in the folder C:\Maintenance\AxEngine Service\

To run the script, just type at the command line the following,

cscript AxEngine_Service_Check.vbs

The output will be a number followed by a colon as shown below,

AX1.png

This output reveals the number of jobs which the engine has scheduled within the last 15 minutes. So in the above example, we have 47 jobs scheduled in the last 15 minutes so we can be fairly confident at this point that the engine is running well.

Ensuring Engine Activity

Now, the problem with running this script in isolation is that there will be plenty of periods when the server has legitimately nothing to do. In this case the script output will throw a zero and any automation you have in place will alert you to engine inaction needlessly.

So what we do is create a job which executes a server-side script  containing the single line,

REM Do Nothing (Server)

And have this task configured to execute even when the agent is disconnected. We then schedule this "Do Nothing" job on a machine which isn't likely to be deleted (like a WOL proxy) on a repeating schedule every 5minutes. This means that without fail the engine even when idling should be recording at least one job scheduling in that 15 minute period.

In short, once you've got a job with such a repeating schedule in place, you should never see no jobs scheduled in that 15minute window. 

 

Running the script

You have a couple options for running this script. You can use a scheduled task to fire this off every 15 minutes, or what we do here is trigger it with Monitor Solution.

If you wanted you could put auto-remediation directly into the vbscript. In that case I'd advise checking for activity in the last half-hour (to be on the safe side!) and then add an email function to the script to let you know that automatic remediation has taken place.

 

Logging

By default, the script will log to the folder C:\Logs\Maintenance, and this can be changed simply by ammending the header of the script,

Dim ofso,StrLogfile
 
StrLogPrefix="AxEngine_Job_Execution_"
StrLogRoot="C:\Logs\Maintenance"
 
In order to keep the log sizes under control, they are named according to the day of the week. When the script finds it's logging to a previous week's log file, it will simply delete it before commencing the refreshed writes. Your logging folder will therefore never contain more than 7 days worth of logs,
 
AX2.png
 
 
The logs format is simply a date stamp, followed by a dash, followed by the count of jobs the engine has found scheduled in the last 15 minutes as shown below,
 
10/25/2013 1:10:54 PM - 79
10/25/2013 1:25:53 PM - 56
10/25/2013 1:40:54 PM - 121
10/25/2013 1:55:54 PM - 144
10/25/2013 2:10:56 PM - 78
10/25/2013 2:25:52 PM - 79
10/25/2013 2:40:51 PM - 136
10/25/2013 2:55:51 PM - 103
10/25/2013 3:10:51 PM - 112
10/25/2013 3:25:51 PM - 76
10/25/2013 3:40:51 PM - 90
10/25/2013 3:55:51 PM - 24
10/25/2013 4:10:51 PM - 52
10/25/2013 4:25:51 PM - 55
10/25/2013 4:40:51 PM - 60
10/25/2013 4:55:51 PM - 98
10/25/2013 5:10:51 PM - 77
10/25/2013 5:25:51 PM - 12
10/25/2013 5:40:51 PM - 1
10/25/2013 5:55:51 PM - 1
10/25/2013 6:10:51 PM - 3
So this can be a nice record of server activity in general if you like to keep metrics of this type of thing.
 

How the Script Works

This script is really simple. The heart of the script is just the following lines,
 
Dim qSQLQuery,intJobCount
 
qSQLQuery="select COUNT(*) from event_schedule where DATEDIFF(MINUTE,end_time,GETDATE()) < 15"
 
 
intJobCount=ExecuteSQL("Altiris eXpress Database",qSQLQuery)
WriteLog intJobCount
 
wscript.echo intJobCount & ":"
 
wscript.quit
 
So all we're doing is making an ADODB connection to the Altiris eXpress Database and then querying for the number of items created in the event_schedule table in the last 15 minutes.
 
Amazingly simple idea that took me more than a few years though to come up with!

Hope you find this trick as useful as we have.

 
Kind Regards,
Ian/
 
 

Comments 1 CommentJump to latest comment

Maymne's picture

Unfortunately I get this error when running the script:

AxEngine_Service_Check.vbs(77, 3) Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
 
As I browsed through your other posts, I saw that you'd mentioned needing to use 32-bit cscript (or cmd) for the Protocol script when using it on a 64-bit server... apparently the same goes for this one as well. On switching to syswow64\cscript, it returned 4: as expected.
0
Login to vote