You are on page 1of 1

How Postilion calculates uptime of installed application :

Precursor to task uptime calculation When a Postilion Application is installed, an entry


iswritten to the 'task' table of the Postilion database. This entry contains information
thatcan be used for calculating the uptime of the application. There is a sql job,
"Postilion - Monitor - Postilion Tasks", which runs every 1 minute. This job
executes the stored procedure 'task_set_down' which is responsible for
setting theamount of time that all Postilion Applications have been up since the
'start_date'. Thestart_date is set to the current time (ie. now) the first time that the
above stored procruns. (Once Transaction Manager (Realtime Framework) is installed
for the first time,and the stored proc is created.) Note that the entire task uptime
computation relies onSQL Server Agent running. Subsequent runs of the stored proc will
make use of thisstart_date to determine the percentage uptime of all installed Postilion
applications.In order for the stored proc to be able to determine if a Postilion application
is runningor not, the application must update its status in the task table. This happens
when theapplication is running. Every 30 seconds (if all is well) each Postilion application
updatesits entry in the task table. It is responsible for updating its Status, as well as
updatingthe time at which the status was last updated (last_checked).Calculation of the
uptimeWhen the stored proc (task_set_down) runs every minute, it goes through the list
of allapplications in the task table, and for each one it sets the State to DOWN where
thedifference between the current time and the last_updated time is greater that
150seconds (45 seconds from 4.1 on). (ie. where the application has not updated its
statusin the last two and a half minutes). - This is reflected in the Postilion Monitor where
thestate of the application will change to down, and the monitor will go red. (Although
thedefault refresh period of the monitoring console is only every 1 minute, so the
changecould take a while to manifest visually) For all tasks (applications) that have now
beenmarked as being DOWN, the next step performed by the stored proc is to calculate
thetotal number of seconds that the application has been down (since the start_date)
Thisis calculated as being the time difference between the time that the stored proc
lastchecked the applications status (last_checked) and the current time (now) (typically
thiswill be 60 seconds), plus the number of seconds that the application has already
beendown. ie.total_time = old_down_time + new_down_time (The number of seconds
that anapplication has already been marked as being down, is stored in the task table
for eachapplication.) Once the total number of seconds that the application has been
down isknown, it is a simple calculation to determine the applications uptime where the
uptimeis defined as being the amount of time that an application has not been DOWN
since thestart_date, presented as a percentage of the total time between the start_time
and thecurrent_time. So an applications uptime, as a percentage, is calculated as:100 *
(no_of_seconds_between_start_date_and_now
-no_of_seconds_application_has_been_down) /
(no_of_seconds_between_start_date_and_now)

You might also like