This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Alert should update database entries

Hi guys.

I am in need for an alert that will trigger a VBScript that will update some values in an Orion table.

We have two views defined - one view for all our internet connections and one view for all our servers. Once the internet connection dies I do not want to see the servers in that office marked as dead too as that is obvious (too much red on my screen). Therefore I want to update the database so I set a "do-not-show" value on those servers, once the internet dies, as they should then not be listed in Orion.

I am a beginner in VBScripts so I don't know how to connect to a database from that, but if you have an example script that I can tweak then I would really appreciate it. Hopefully this can be done without having an ODBC connection.

Thanks / Joe

  • I found out myself. I got it from a webpage I do not recall anylonger or else I would have posted the source. I found though others when searching on "DBConn.open szADOConn":

     

    ' Open a database connection
    szADOConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;" &_
                "Initial Catalog=BDKBNetPerfMon;Data Source=SQLSRV\SOLARWINDS;" &_
                "Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;" &_
                "Workstation ID=SolarWinds;"
    Set DBConn = CreateObject("ADODB.Connection")
    DBConn.open szADOConn

     

    ' Get the Device_Type and Caption
    SqlQuery = "SELECT Site_Location, Device_Type, Caption FROM Nodes WHERE NodeID=" & argNodeID
    Set cmd = CreateObject("ADOdb.Command")
    cmd.CommandType = &H0001  ''adCmdText
    cmd.ActiveConnection = DBConn
    cmd.CommandText = SqlQuery
    Set RecordSet = CreateObject("ADODB.Recordset")
    Set RecordSet = cmd.Execute(szSQLlc)
    Dim Site_Location
    Dim Device_Type
    Dim Caption
    Site_Location = RecordSet("Site_Location")
    Device_Type = RecordSet("Device_Type")
    Caption = RecordSet("Caption")
    Set RecordSet = Nothing
    Set cmd = Nothing

     

    WScript.Echo Site_Location & " and " & Device_Type & " and " & Caption