1 Reply Latest reply on Sep 2, 2009 7:13 AM by JoeDoe

    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

        • Re: Alert should update database entries

          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