The purpose of the PHANTOM.MONITOR program is to detect and clean up after hung phantoms. It is meant to be run on an hourly schedule either by “crontab” on unix or by Windows’ “Task Scheduler”. Additionally, it is run by the PHANTOM.CONSOLE program on initialization and each time the “(R)efresh” command is executed.
PHANTOM.MONITOR should be run by your operating system’s job scheduling tool (either crontab or Task Scheduler) every hour on the hour. It only needs to be run within the main logon for your system, as long as all of the logons share the same time zone. If you are in a multi-time zone environment, it should be run once per time zone in the main logon for each time zone.
Maintenance of the unix crontab and Windows’ Task Scheduler tools is the responsibility of the agency and/or their operating system support people. You may find our Scripts for System Launched Processes page helpful in getting this set up.
The logic for the detection of a hung phantom is different depending upon whether a process is currently executing.
If a process is currently executing, a phantom is considered to be hung if the maximum time parameter specified for that process has been exceeded. Since the PHANTOM.MONITOR is run hourly, there may be as much as a 1 hour delay in detecting that the time limit has been exceeded. There are some processes, such as interactive database services, which are never intended to stop. These processes require some special programming, executed on a regular basis, which will update the database with the date and time that the program checked in. For those processes, if the maximum time has been exceeded, the PHANTOM.MONITOR looks to see if the program has checked in within the last 10 minutes. If so, it’s not hung.
If a phantom is in a wait state (the status is “waiting to launch a process”, “nothing to do”, or “stop requested”), it is considered to be hung if the last status update is more than 10 minutes ago.
Once a phantom has been recognized as hung, its status is changed to “hung”, and an email is sent out to the recipients specified in the Email recipients screen of the Phantom Console.
When a phantom is started, part of the initialization is to register the port and operating system pid numbers in the PHANTOM-STATUS file. When a phantom shuts itself down in an orderly manner, these items are removed. However, when a phantom gets hung it doesn’t have the opportunity to do that kind of housekeeping. A secondary function of the PHANTOM.MONITOR program is to look for orphan PORT and PID items in the PHANTOM-STATUS file and remove them.
Every run of PHANTOM.MONITOR is registered in the MONITOR-LOG item in the PHANTOM-LOG file. The time and date of the run is recorded. If any phantoms are newly recognized as being hung, that fact is noted, along with the reason behind that recognition.
Copyright 2011, Cubs Consulting, Inc.