Go to All Forums

SQL Script

Has  anyone create a VB script plugin with a SQL (MSSQL) script?

We currently use OpMan but am in the process of moving everything into Site24x7. I'd like to collect some SQL metrics specific to our system. Example is replication transactions...

Here is what OpMan runs:

TAB = chr(9)
Const adOpenStatic = 3
Const adUseClient = 3
Set objConn = WScript.CreateObject("ADODB.Connection")
Set objRS = WScript.CreateObject("ADODB.Recordset")
objConn.CommandTimeout =300
strConn = "Data Source=A_NAME;Initial Catalog=Distribution;User Id=ASQLUSER;Password=ASQLPASSWORD"
objConn.Open strConn
objRS.CursorLocation = adUseClient
objRS.ActiveConnection = objConn
objRS.CursorType = adOpenStatic

query = "distribution.dbo.sp_replmonitorsubscriptionpendingcmds @publisher ='ASERVERNAME', @publisher_db = 'DBNAME', @publication ='Publication_NAME', @subscriber ='SUBSCRIBER', @subscriber_db ='DBNAME', @subscription_type ='0'"
objRS.Source = query
objRS.Open
if objRS.RecordCount>0 then
For iRow = objRS.AbsolutePosition to objRS.RecordCount
wscript.echo "Message:This message will be used as alarm message."
wscript.echo "Data:"
wscript.echo "Instance1"& TAB & objRS.Fields(0).value
objRS.MoveNext
Next
end if

 

Any help would be much appreciated! :)

 

Attached is the graph above creates...

 

Thanks,

Rob

 

Attachments
Capture.JPG
Size: 22.85 KB
Reply 2
Replies (0)