Single Point Operations Interface Pipe

The Single Point Interface Operations Pipe (SPIP) provides an interface for application programs to transmit event reports that:

The input to SPIP is from a site-supplied external program or shell script. External application programs and scripts write requests to a pipe file on the Operations Sentinel server named spo_pipe. The complete path for the pipe is as follows:

\\operations-sentinel-server\pipe\spo_pipe

where operations-sentinel-server is the network name of the Operations Sentinel server. Programs sending data to spo_pipe do not receive any confirmation that the data was received or that the event report was processed.

SPIP receives data through spo_pipe. You can write event reports to spo_pipe from the following sources:

Examples

The following example shows how to send an alert on a Windows system using SPIP:

’************************************************************************************
’
’ PURPOSE: Send a sample alert event to Operations Sentinel.
’ 						’
’ OUTPUT: Returns 0 on normal exit.
’ 						Writes an event to the Windows Application Event Log if the SPO pipe
’ 						cannot be opened or the event cannot be written to the pipe.
’
’************************************************************************************
On Error Resume Next
’
’ Constants
’
Const ForReading = 1, ForWriting = 2
Const ERR_PREFIX = "Alert Script <vbs name here> Error: "
’
’ Declare variables
’
Dim wshArgs ’ input argument object
Dim wshShell ’ wscript shell object
Dim objNetwork ’ network object
Dim fso ’ file system object
Dim fpipe ’ pipe object
Dim strErr ’ error message
Dim numButton ’ button attributes
Dim ans ’ answer from the custom dialog
Dim strTitle ’ title of the dialog box
Dim strPipePath ’ path to the spo_pipe
Dim strSPO_Server ’ Used to hold the name of the spo server.
Dim strAlertText ’ Text of the alert
Dim strEventReport ’ event report sent to spo via the pipe
’
’ Init objects
’
Set wshArgs = Nothing
Set WshShell = CreateObject("WScript.Shell")
Set objNetwork = WScript.CreateObject("WScript.Network")
Set fso = CreateObject("Scripting.FileSystemObject")
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
’ Name: CleanUp
’’ Purpose: Discontinue association of object variables with the instantiated objects.
’ 							Assigning object variables to Nothing releases all the system and memory
’ 							resources associated with the previously referenced object.
’
’ Input Environment: None.
’
’ Output Environment: None.
’
’ Return Value: None.
’
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
Sub CleanUp()
		Set WshShell = Nothing
		Set objNetwork = Nothing
		Set fso = Nothing
		Set fpipe = Nothing
End Sub
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
’ Main program starts here.
’
’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’
Err.Clear
strTitle = "Error sending alert!"
numButton = vbOKOnly + vbExclamation + vbDefaultButton1
strSPO_Server = objNetwork.ComputerName
strPipePath = "\\" & strSPO_Server & "\pipe\spo_pipe"
strAlertText = " spip alert from vbs."
strEventReport = "TYPE=AL|CLASS=host" & "|INSTANCE=" & strSPO_Server
strEventReport = strEventReport & "|APPL=spip" & "|ALERTID=ed" & CStr(Idx)
strEventReport = strEventReport & "|SEV=critical|TEXT=" & CStr(Idx) & strAlertText
’
’ Open the pipe and write to it
’
Do
		Err.Clear
		Set fpipe = fso.OpenTextFile(strPipePath, ForWriting, True)
								If Err.number = 0 Then
										’
										’ Open was successful. Write to the pipe.
										’
				fpipe.WriteLine(strEventReport)
				fpipe.Close
				Exit Do
		ElseIf (Err.Number = -2147024665) Then
				’
				’ Pipe is busy...try again
				’
				strErr = "pipe busy"
										 WScript.Sleep 100
		Else
				’
				’ Error...send event to application log (set WRM to pick it up)
				’
				Exit Do
		End If
Loop Until (Err.number = 0)
’
’ Log error to event log if necessary
’
If Err.number <> 0 Then
		WshShell.LogEvent 1, ERR_PREFIX & Err.Number & VBLF & Err.Description & VBLF &
RR_OPEN_PIPE & strPipePath
		Call CleanUp()
		WScript.Quit (Err.Number)
End If
’
’ Clean up.
’
Call CleanUp()
’
’ Exit gracefully.
’
WScript.Quit 0
’
On Error Goto 0

The following example shows how to generate log entries from a file on a UNIX or Linux system.

Note: When you enter event reports in a text file, you must add a blank line following the last event report.

rcp spiptest.txt myuser@mysposrver://mysposerver/pipe/spo_pipe

where mysposerver is the name of the Operations Sentinel server and the file spiptest.txt contains one or more event reports, such as:

“TYPE=lg | CLASS=host | INSTANCE=mccoy | 
APPL=sample | TEXT=msg text.”
“TYPE=lg | CLASS=host | INSTANCE=mccoy | 
APPL=sample2 | TEXT=msg text2.”