KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

'wrapper' for non-dependant scripts

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
dpeterka



Joined: 21 Jul 2003
Posts: 13

PostPosted: Sat Aug 13, 2005 10:10 pm    Post subject: 'wrapper' for non-dependant scripts Reply with quote

We run a Java engine (WebSphere) which hosts a number of applications any of which can fail for a number of reasons that makes the usage of Host Monitor's built in dependencies ability not as useful as we would like. As a result we've made a 'wrapper' test.

The idea is that a failed test writes to a text log and a master test reads from that text log and generates a global alert. For our purposes this opens a single ticket in our help desk application rather than a whole bunch.

Children tests on failure run a Action Profile that executes an external script like so:
cscript D:\HostMonitor4\TicketGen\shared\WriteLog.vbs "%TestName%"

Contents of this script are:
Dim filename, ArgObj, TestName, objFSO, thisFile
filename = "D:\HostMonitor4\TicketGen\shared\log.txt"


Set ArgObj = WScript.Arguments
TestName = ArgObj(0)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set thisFile = objFSO.OpenTextFile(filename, 8, True)

'Append the TestName to the file.
thisFile.WriteLine TestName

'Cleanup
thisFile.close
Set objFSO = nothing

The Master test is VBS test that contains the following:

const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"

FUNCTION PerformTest()
Dim filename, fso,f1,thisFile

Set fso = CreateObject("Scripting.FileSystemObject")
filename = "D:\HostMonitor4\TicketGen\shared\log.txt"
On Error Resume Next
set f1 = fso.OpenTextFile(filename,1)
thisFile = f1.ReadAll
On Error GoTo 0
If thisFile <> "" Then
PerformTest=statusBad&thisFile
f1.Close
Else
PerformTest=statusAlive
f1.Close
End If
END FUNCTION

...........
You can get the results of the failed tests by putting in %REPLY%
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index