![]() ![]() |
Nov 23 2007, 05:13 AM
Post
#1
|
|
|
Power user ![]() ![]() ![]() Group: Power users Posts: 192 Joined: 17-May 07 Member No.: 958 |
Here is an expanded Backup Exec check that uses the new SQL Server functionality in Lua. The paramters are the name of the SQL Server that the backup exec database is on, and the name of the job you want to track. Please note, this assumes that the account INM is runing under has access to the Backup Exec database. If it does not, you will want to modify this script to use alternate credentials. In addition to alerting of a failed job, this script will also store some valuable statistics (Number of files backed up, duration in minutes, backup rate in MB/Min and total MB backed up). The script assumes an error when the status is anything other than 19 (Success) or 3 (Complete but with Exceptions).
This has only been tested on Backup Exec 11D. Here is the script....enjoy..... CODE -----------------------------------------------------------------
-- Name: BEJobStatus.lua -- Author: Kevin Prestage -- Required INM version: 3.3 -- Version: 1.0 -- Date: 2007-11-22 -- Description: Checks the status of the last occurance of the -- specified Backup exec job. Will go into alarm when the -- status is anything other than 19 (Success) or 3 -- (Complete but with Exceptions). It will also -- store statistics including duration in minutes, size of backup -- set in MB, Backup rate in MB/Minute and the total number of -- files backed up. -- -- Arguments: -- 1) Server Name -- 2) Name of the backup job. ----------------------------------------------------------------- servername = GetArgument(0); jobname = GetArgument(1); db = TLuaDB(); con = servername .. "@BEDB"; print(con); sql = "select top 1 isjobactive, finaljobstatus,actualstarttime, endtime, elapsedtimeseconds,totaldatasizebytes, totalratembmin, totalnumberoffiles, totalnumberofdirectories "; sql = sql .. "from vwJobHistorySummary "; sql = sql .. "where JobName = '" .. jobname .. "' and isjobactive = 0 "; sql = sql .. "order by actualStartTime desc"; x = db:Connect(con,TLuaDB.CLIENT_SQLSERVER); result = ""; minutes = 0; size = 0; rate = 0; files = 0; if (x == true) then x = db:Execute(sql); if (db:ResultAvilable() == true) then db:NextRow(); status = db:GetCol(2); if (status == "19") then result = "SUCCESS"; end if (status == "3") then result = "COMPLETE W/Exceptions"; end if (result == "") then result = "The last execution of this job was not successful."; x = false; else minutes = db:GetCol(5) / 60; size = db:GetCol(6) / 1048576; rate = db:GetCol(7); files = db:GetCol(8); result = result.. " " .. minutes.. " Minutes, " .. size .. " MB, " .. rate .. " MB/Min, " .. files .. " Files Backed Up."; --print (result); StoreStatisticalData(0,minutes,0,"Minutes") StoreStatisticalData(1,size,0,"MB") StoreStatisticalData(2,rate,0,"MB/Min") StoreStatisticalData(3,files,0,"Files") end end else result = db:GetErrorDescription(); end SetExitStatus(result, x); |
|
|
|
Dec 18 2007, 10:27 AM
Post
#2
|
|
|
New to the forum Group: Members Posts: 8 Joined: 7-June 06 From: Oslo, Norway Member No.: 300 |
I tried your Intellipool LUA Script for Backup Exec 11D. I'm not able to get my standalone Intellipool server to get access to the Backup Exec server in the domain. The monitor then goes in an alarm with the following message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. (17) I tried to change the credentials in the LUA monitor settings page but it did not help me out of it. May I have to write som extra lines in the LUA script to assign my credentials? Where and what do I have to edit ? Best regards Ronny Johnsen - JPC Norway |
|
|
|
Dec 18 2007, 02:40 PM
Post
#3
|
|
|
Power user ![]() ![]() ![]() Group: Power users Posts: 192 Joined: 17-May 07 Member No.: 958 |
Try changing the following line in the Lua Script
CODE x = db:Connect(con,TLuaDB.CLIENT_SQLSERVER); to CODE x = db:Connect(con,"username", "password",TLuaDB.CLIENT_SQLSERVER); |
|
|
|
Mar 2 2008, 07:48 PM
Post
#4
|
|
|
New to the forum Group: Members Posts: 8 Joined: 7-June 06 From: Oslo, Norway Member No.: 300 |
Long time and many tries...
I can't get this to work. If I join the INM Host Server to the Domain, the following credetials works. x = db:Connect(con,"domain\username", "password",TLuaDB.CLIENT_SQLSERVER); If the INM host is a Standalone server in the LAN, tries to connect to a server in the domain, with Backup Exec 11D & SQL 2005 Express, I get the same error message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. (17) Any more suggestions ? Ronny Johnsen - JPC Norway |
|
|
|
Mar 2 2008, 07:53 PM
Post
#5
|
|
|
Power user ![]() ![]() ![]() Group: Power users Posts: 192 Joined: 17-May 07 Member No.: 958 |
Long time and many tries... I can't get this to work. If I join the INM Host Server to the Domain, the following credetials works. x = db:Connect(con,"domain\username", "password",TLuaDB.CLIENT_SQLSERVER); If the INM host is a Standalone server in the LAN, tries to connect to a server in the domain, with Backup Exec 11D & SQL 2005 Express, I get the same error message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. (17) Any more suggestions ? Ronny Johnsen - JPC Norway By default SQL Server Express does not allow remote connections. Have you enabled them? This might help: http://www.datamasker.com/SSE2005_NetworkCfg.htm |
|
|
|
Mar 2 2008, 09:29 PM
Post
#6
|
|
|
New to the forum Group: Members Posts: 8 Joined: 7-June 06 From: Oslo, Norway Member No.: 300 |
Thanks for your very fast answer.
You are probably right in your answer. I tried this now, and unfortunately, this seems to be a tricky one. I've set SQL Express 2005 to allow remote connections, but it seems not to be listening to me... I still cant connect. I will maybe move the BEDB to our SQL2000 Full version instead. Ronny Johnsen - JPC Norway |
|
|
|
Mar 2 2008, 09:32 PM
Post
#7
|
|
|
Power user ![]() ![]() ![]() Group: Power users Posts: 192 Joined: 17-May 07 Member No.: 958 |
Thanks for your very fast answer. You are probably right in your answer. I tried this now, and unfortunately, this seems to be a tricky one. I've set SQL Express 2005 to allow remote connections, but it seems not to be listening to me... I still cant connect. I will maybe move the BEDB to our SQL2000 Full version instead. Ronny Johnsen - JPC Norway If you have query analyzer or another querying tool that can connect to SQL Server, try connecting to the instance of SQL Express from a remote computer using that. This way we can determine if it is a SQL Server issue, or a problem with the Lua script. Also, try stopping and starting the SQL Server service. You may need to do that for the remote connections to take effect. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 10th September 2010 - 10:05 PM |