Argent HP OVSD Integration

Overview

The following document describes the customisation that is to be configured to allow Argent Extended Technology to integrate with HP OVSD.

The following diagram shows an overview of the data flow of the Integration.

Red Data Path

A relator triggers an alert (Incident.cmd) this calls a vbscript (Incident.vbs) and passes it two variables.

Incident.vbs does a select from the SQL DB using AGUniqueID to get required data (EventID, Nodename, Priority, Owner, Description) for OVSD incident.

Incident.vbs then passes the data to the sd_event executable which then pushes the data to the OVSD listener.

Green Data Path

When an incident is updated in OVSD it will pass data (Argent EventID, status, Operator, memo, Ov incident No) and call ws-argentEventupdater.vbs, which will take this data and POST it to the Web Service.

The webservice (service.vb) will take the data and do a SQL update using the Argent EventID.

The existing Argent routine (AAC_AnswerAlert.exe /server=ac_server /eid=event_id “memo” ) for External Answering or closing events from the command line does not provide enough functionality to do what is shown in this document.

User Process Flow

The flow shows what happens from an operator viewpoint and all integration design was based on the following flow chart-

The red points show each of the key integration steps, following pages shows some screen shots of what this will look like from an Argent Console perspective.

Flow Diagram Point 1

Event Generated in Argent Console (42166)

This relator called the CD_HPOVSD_SD_EVENT system command which calls a vbscript to collect appropriate variables and then sent information using the HP sd_event program.

Details on this script and process later in the Article.

Customer need the following variables sent from Argent to OVSD

HP Attribute Name

  Argent Variable

CI (Configuration Item)   %AGNodeName%
Description   Obtained from AAC_Console Table (short_description)
Priority   Obtained from AAC_Console Table (priority)
Owner   Obtained from XT_Master_Catalog Table (Owner)
EventID   Obtained from AAC_Console Table (EventID)
    SQL Lookup based on %AGUniqueID%

Flow Diagram Point 2

OVSD will execute the following process to update the Argent Event (details of this script later in the article)

ws-ArgentEventUpdater parameter1 parameter2 parameter3 parameter4 parameter5

The following updates Argent Event (42166), leaving it unanswered (0), setting the operator (SD), adding to the memo field (Reviewing Incident) and adding the OVSD Incident # (12345)

      ws-ArgentEventUpdater 42166 0 SD “Reviewing Incident” 12345

Event is left unanswered and a memo is added

Flow Diagram Point 3

The following updates Argent Event (42166), setting it answered (1), setting the operator (SD), adding to the memo field (Incident Completed….) and adding the OVSD Incident # (12345)

ws-ArgentEventUpdater 42166 1 SD “Incident Completed by Server Team – restarted Alerter Service” 13458

Event is set to Answered and a memo is added

Flow Diagram Point 4

The following updates Argent Event (42166), setting it Resolved (2), setting the operator (SD), adding to the memo field (Incident Closed….) and adding the OVSD Incident # (12345)

ws-ArgentEventUpdater 42166 2 SD “Incident Closed by SD – restarted Alerter Service” 13458

Event is set to resolved and memo is added

Process To Create An HP OVSD Incident From Argent.

1. Argent Alert (System Command)

Calls incident.cmd (below) and passes two Argent Variables..(%AGUniqueID% – %AGNodeName%)

This command then calls a VB script with two variables

2. VB script (incident.vbs) is called it performs the following SQL Functions

Executes a SQL query to obtain

job_number
priority
short_description

From the AAC_Console Table using the AGUniqueID

Executes a SQL query to obtain

owner

From the XT_Master_Catalog_Machine Table using the AGNodeName

3. It executes the HP sd_event command with switches

cmd /C c:\Argent\HPOVSD\sd_event.exe -f (…) -v (..)

-f sd_event.ini

SD Event.ini

LOGFILE=sd_event.log

ERROR_LOGFILE=sd_event_error.log

ACCOUNT=system/servicedesk

PORT=30980

MAPPING=external_event

CLASSNAME=incident

MODUS=insert

LANGUAGE=GB

-v

event_ID = Job_number (from AAC_Console)
description = short_description (from AAC_Console)
CI = %AGNodeName%
Priority = priority (from AAC_Console)
Owner = owner (from XT_Master_Catalog_Machine)

The SD_Event program generates a log file with what will be sent to the OVSD server

Example: this is part of the data stream (log) sent to the OVSD listener

VALUE_LIST="username=system#password=servicedesk#mapping=external_event#

className=incident#modus=INSERT#event_ID=42074#description=Service Alerter on node

ARGENT-ANDREWM is not running.#CI=ARGENT-ANDREWM#Priority=4#Owner=Network Team#"

Incident.vbs


'Set & collect variables 
Dim ArgObj, UniqueID, AGNodeName
Set ArgObj = WScript.Arguments
UniqueID = ArgObj(0)
AGNodeName = ArgObj(1)

'Set Database connection and Open
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=SQLOLEDB;Data_ Source=localhost;Trusted_Connection=Yes;Initial Catalog=Argent;"

'Execute SQL statement against DB connection
Set rs = objconnection.Execute("Select * FROM [Argent].[dbo].[AAC_Console]_ WHERE pckey = " & "'" & UniqueID & "'")
set strjob = rs("job_number")
set strPri = rs("Priority")
set strEvent = rs("short_description")

Set rs1 = objconnection.Execute("Select owner FROM_ [Argent].[dbo].[XT_Master_Catalog_Machine] WHERE machine = " & "'" &_ AGNodeName & "'")
set strOwn = rs1("owner")


objConnection.Close

'Execute external program and pass variables to it
Set WshShell = WScript.CreateObject("WScript.Shell")
strcmd = "cmd /C c:\Argent\HPOVSD\sd_event.exe -f sd_event.ini -v event_ID=" &_ strjob & " description=" & chr(34) & strEvent & chr(34) & " CI=" & chr(34) &_ AGNodename & chr(34) & " Priority=" & chr(34) & strPri & chr(34) & " Owner=" &_ chr(34) & strOwn & chr(34)

WshShell.Run strcmd, 0,true

Set wshShell = Nothing


Update An Event In Argent From HP OVSD.

There are two components to this, the first is the Web Service running on the Argent Extended Technology Server and the second is a script that can be run from the OVSD Server to pass parameters to the Argent Console thru the Web Service.

Web Service for Argent Console Event Updates

I have created a VB.net web service that can be called from any where on the network.

Browsing to http://servername/Argentwebservice/service.asmx shows the Web Service details

Click on ArgentEventUpdate will then expose the parameters of the web service, you can test the web service by populating the parameter fields and invoking – this will update the Event with the matching Event ID.

The service can have the parameters passed as an HTTP Get as below

http://localhost/webservice/service.asmx/ArgentEventUpdate?EventID=42799&Status=2&OVOperator=SD&OVMemo=test it out&OVIncidentNo=1234

Web Service is made up of the following: (also the web.config file)

Service.asmx

< %@ WebService Language=”vb” CodeBehind=”~/App_Code/Service.vb” Class=”ARGENT_XT” % >

service.vb


Imports System.Web.Services

Imports System.Data.SqlClient

Imports System.Data

Imports System





Public Class ARGENT_XT



    

    Public Sub ArgentEventUpdate(ByVal EventID As String, ByVal Status As String, ByVal OVOperator As String, ByVal OVMemo As String, ByVal OVIncidentNo As String)



        Dim myado As ARGENT_XT

        myado = New ARGENT_XT()



        Dim Message As String

        Dim ALLmemo As String

        Dim SQLmemo As String

        Dim strout As String

        Dim myConnection As SqlConnection

        Dim mySqlCommand As SqlCommand

        Dim mySqlCommand1 As Sqlcommand

        Dim myDataReader As SqlDataReader



        Dim oFile As System.IO.File

        Dim oWrite As System.IO.StreamWriter

        Dim FILE_NAME As String = "C:\Argent\HPOVSD\Logs\wslog.txt"



        myConnection = New SqlConnection("user id=sa; password=; initial catalog=Argent; data source=localhost")

        'myConnection = New SqlConnection("Integrated Security = SSPI; initial catalog=Argent; data source=localhost")



        mysqlcommand1 = New Sqlcommand("Select memo from AAC_Console WHERE job_number = '" & EventID & "'", myconnection)

        myConnection.Open()

        myDataReader = mySqlCommand1.ExecuteReader(CommandBehavior.CloseConnection)





        While (myDataReader.Read())

            If mydatareader.Item(0) IsNot DBNull.Value Then

                SQLmemo = myDataReader.Item(0)

            Else

                SQLmemo = vbcrlf

            End If

        End While





        myDataReader.Close()

        myconnection.close()







        ALLmemo = SQLmemo & vbcrlf & now & " " & OVOperator & Vbcrlf & "OVSD# = " & OVIncidentNo & vbcrlf & OVmemo & vbcrlf



        mySqlCommand = New SqlCommand("Update AAC_Console Set answered = '" & status & "'" & ", " & "memo = '" & ALLmemo & "'" & ", " & "answer_time = getdate()" & ", " & "operator = '" & OVoperator & "'" & " WHERE job_number = '" & EventID & "'", myconnection)



        Try

            myConnection.Open()

            mySqlCommand.ExecuteNonQuery()

            Message = "Argent Event Updated in AAC_Console."

        Catch myException As Exception

            Message = "Couldn't update record: " + myException.ToString()

        Finally

            myConnection.Close()

        End Try





        If oFile.Exists(FILE_NAME) = True Then

            oWrite = oFile.AppendText(FILE_NAME)

            strout = now() & ", " & EventID & ", " & Status & ", " & OVOperator & ", " & OVMemo & ", " & OVIncidentNo

            oWrite.WriteLine(strout)

            oWrite.Close()

        Else

            oWrite = oFile.CreateText(FILE_NAME)

            strout = now() & ", " & EventID & ", " & Status & ", " & OVOperator & ", " & OVMemo & ", " & OVIncidentNo

            oWrite.WriteLine(strout)

            oWrite.Close()

        End If





End Sub





End Class

Script for passing data to Web Service (from OVSD Server)

Execute the following VB script, this will take the parameters and POST to the web service.

WS-ArgentEventUpdater.vbs parameter1 parameter2 parameter3 parameter4 parameter5


    parameter1 = Argent Event ID (job_number)

    parameter2 = Argent Event Status (0 = unanswered, 1 = answered, 2 =Resolved)

    parameter3 = Argent Event operator (SD)

    parameter4 = Notes to add to Argent Memo

    parameter5 = OVSD Incident #

    


  1. Script gets parameters as variables

  2. Set up HTTP XML connection

  3. Set Content-type

  4. Send data

WS-ArgentEventUpdater.vbs


'Set variables for switches

Dim ArgObj, EventID, Status, OVOperator, OVmemo, OVIncidentNo

Set ArgObj = WScript.Arguments

EventID = ArgObj(0)

Status = ArgObj(1)

OVOperator = Argobj(2)

OVMemo = ARGobj(3)

OVIncidentNo = Argobj(4)



'Set up the HTTP XML objects

Const HOST = "http://localhost/webservice/"

Const URL = "service.asmx"

Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

xmlhttp.open "POST", HOST & URL & "/ArgentEventUpdate", false



'Set the Content-Type header to the specified value

xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"



'Send the request synchronously

xmlhttp.send "EventID=" & EventID & "&Status=" & Status & "&OVOperator=" & OVOperator & "&OVMemo=" & OVMemo & "&OVIncidentNo=" & OVIncidentNo

Installing The Integration Components

Components to generate OVSD Incident

Create a folder C:\Argent\HPOVSD
Create a folder C:\Argent\HPOVSD\Logs

Copy

incident.cmd

incident.vbs

sd_event.exe

sd_event.ini

into C:\Argent\HPOVSD

Setup a System Command Alert

Set up a relator to use this Alert

Components to Update Argent Events (WebService)

Create a folder C:\Argent\HPOVSD\Argent_Webservice

Copy into folder Service.asmx, web.config

Create a folder C:\Argent\HPOVSD\Argent_Webservice\app_code

Copy into folder Service.vb

The following steps assume that IIS is installed – and there is a web Site running (default will do)

Create a Virtual Directory…

Name the Virtual Directory

Point at the folder created…

Leave Permissions as default…

Goto Properties of New Virtual Directory

Goto ASP.NET Tab – change to Version 2.0…

Now Test Web Service…

Browse to http://localhost/ArgentWebService/service.asmx

You should see the above

Click on the ArgentEventUpdate Method

You will see the following page.

This will allow you to update an Event in the Argent Console…