CODE
-----------------------------------------------------------------
-- Name: SQLReplication.lua
-- Author: Kevin Prestage
-- Required INM version: 3.3
-- Version: 1.0
-- Date: 2007-09-21
-- Description: This script will monitor the replication queue on
-- the specified server and track the number of transactions
-- pending replication and the number of minutes behind
-- the replication queue is.
--
--
-- Arguments:
-- 1) Server Name
-----------------------------------------------------------------
servername = GetArgument(0);
db = TLuaDB();
con = servername .. "@distribution";
print(con);
sql = "select count(*), min(entry_time), max(entry_time), datediff(minute, min(entry_time), max(entry_time)), datediff(minute, min(entry_time), getdate()) from msrepl_transactions";
x = db:Connect(con,TLuaDB.CLIENT_SQLSERVER);
result = "";
records = 0;
minutes = 0;
if (x == true) then
x = db:Execute(sql);
if (db:ResultAvilable() == true) then
db:NextRow();
records = db:GetCol(1);
minutes = db:GetCol(5);
result = records .. " transactions are pending replication. The oldest transaction pending replication is " .. minutes .. " minutes old";
StoreStatisticalData(0,records,0,"Records")
StoreStatisticalData(1,minutes,0,"Minutes")
end
else
result = db:GetErrorDescription();
end
SetExitStatus(result, x);
-- Name: SQLReplication.lua
-- Author: Kevin Prestage
-- Required INM version: 3.3
-- Version: 1.0
-- Date: 2007-09-21
-- Description: This script will monitor the replication queue on
-- the specified server and track the number of transactions
-- pending replication and the number of minutes behind
-- the replication queue is.
--
--
-- Arguments:
-- 1) Server Name
-----------------------------------------------------------------
servername = GetArgument(0);
db = TLuaDB();
con = servername .. "@distribution";
print(con);
sql = "select count(*), min(entry_time), max(entry_time), datediff(minute, min(entry_time), max(entry_time)), datediff(minute, min(entry_time), getdate()) from msrepl_transactions";
x = db:Connect(con,TLuaDB.CLIENT_SQLSERVER);
result = "";
records = 0;
minutes = 0;
if (x == true) then
x = db:Execute(sql);
if (db:ResultAvilable() == true) then
db:NextRow();
records = db:GetCol(1);
minutes = db:GetCol(5);
result = records .. " transactions are pending replication. The oldest transaction pending replication is " .. minutes .. " minutes old";
StoreStatisticalData(0,records,0,"Records")
StoreStatisticalData(1,minutes,0,"Minutes")
end
else
result = db:GetErrorDescription();
end
SetExitStatus(result, x);