MuruR

e2e Scripting help for generating an alarm

Discussion created by MuruR on Mar 20, 2017
Latest reply on Mar 20, 2017 by danst04

Hi All,

 

Good day

 

I am new to e2e_appmon scripting. I have a question about generating an alarm for each of the transaction when it fails alone.Need an alarm post failing each steps.

 

I have a script which does the following

 

1. Open the website

2.log on to the website

3.click on the page within a website post logon

4.Some steps

5.Some steps

6.Logoff

 

I have if condition for step1 to generate an alarm. It works fine. However would like to know how i can generate the alarm for each of the other steps from step2. I dont know where and how to put the condition for other steps. Below is the sample script.

 

 

 

dim qos$(10) 'Ten qos names should do for most cases? The first is normally blank!

' Required for NimBUS system calls (like sending QoS'es)
include "Nimbus-functions.src"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' close_communicator - closes the Microsoft Lync App if it appears

function close_communicator()
if existw("COMMUNICATOR.EXE|CommunicatorMainWindowClass|Microsoft Lync ",1) = 0 then 'Window does not exist, exit function!
exitfunction
endif
'If we get here we need to do some controlled closing of windows etc. Add code as appropriate
'for your application! Some examples:

CloseWindow("COMMUNICATOR.EXE|CommunicatorMainWindowClass|Microsoft Lync ",1)

endfunction

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' close_communicator - closes the Microsoft Lync App if it appears

function close_explorer()

if IsRunning("IEXPLORE.EXE") = 0 then 'Internet Explorer not running so we exit
exitfunction
endif

killApp("IEXPLORE.EXE",1)
' MsgBox ("Ran Kill Ex")

endfunction

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' prepare - makes sure the app is not already running and sets up the NimBUS connections.
function prepare()
'#ignoreerrors=0 'we are running automatically, so no one sees the error message anyway!
'MsgBox("Running Prepare")
close_communicator()
close_explorer()
nimInit()
endfunction

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' cleanup - checks the rc code and sends NULLs where appropriate. Calls close_app, closes the
' connections to NimBUS and exits the script (returning rc)
function cleanup(rc)
if rc > 0 then
if rc <= 1 then
nimQoSSendNull(qos$(1))
endif
if rc <= 2 then
nimQoSSendNull(qos$(2))
endif
if rc <= 3 then
nimQoSSendNull(qos$(3))
endif
if rc <= 4 then
nimQoSSendNull(qos$(4))
endif
if rc <= 5 then
nimQoSSendNull(qos$(5))
endif
if rc <= 6 then
nimQoSSendNull(qos$(6))
endif
endif

close_explorer() 'Make sure everything is closed up nice and tight!

nimEnd()
end(rc)
endfunction

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Set your variables that you will need later on
#IgnoreErrors = 0

'Get the profile name from the Probe's environment or default to Manual Run.

script$ = nimGetEnv$("APPMON_PROFILE_NAME","KPN-Annet-v1")

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Uncomment next line to create log file
LogFile("C:\Program Files\Nimsoft\e2e_scripting\Logs\" + script$ + ".log",1,0)

' Fill in your qos targets. You might want to use the script name here as well, to make finding the
' QoS entries easier! Needs to be set up early, since these qos targets are used to send NULLs in
' the cleanup function.
qos$(1) = script$ + " - Open Annet"
qos$(2) = script$ + " - Login"
qos$(3) = script$ + " - Search Customer"
qos$(4) = script$ + " - Open Fiber"
qos$(5) = script$ + " - Open Client"
qos$(6) = script$ + " - Logoff"

'Used to enumerate the different steps your scripts takes. Every step which has a QoS target associated
'with it should have an entry in the qos$ array! This approach lets you have enumerated steps, but if
'you decide to add a step between two existing steps you will not have to change all the step numbers
'in your script. You WILL have to change the qos$ array however!!
step = 1

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This is where the "real" work begins
prepare() 'Gotta prepare ourselves

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Step1 Open the Annet


nimQoSStart()

ret=StartBrowser("IE", "http://annet.kpn.org/", 3)

 

If ret<>0 then

supp$ = script$
subsys$ = "e2e_appmon"
msg$ = "Failed to open Annet"
nimAlarm(5,msg$,supp$,subsys$)
nimQoSStop()
nimQoSSendTimer(qos$(step))

End If

'Step1 is completed


'Step2 Login to Annet

 

step = step + 1
nimQoSStart()

UsePage("Annet Login - r01")
WriteHTML("INPUT TEXT[NAME= 'loginForm:userName']", "UIM6")
WriteHTML("INPUT TEXT[NAME= 'loginForm:organizati']", "SERVICE")
WriteHTMLEncrypted("INPUT PASSWORD[NAME= 'loginForm:password']", "FTNsS6GHWjK211wpZylaTGNhmm")
ClickHTMLElement("A[INNERTEXT= 'Meld aan']")

supp$ = script$
subsys$ = "e2e_appmon"
msg$ = "Failed to login to Annet"
nimAlarm(5,msg$,supp$,subsys$)
nimQoSStop()
nimQoSSendTimer(qos$(step))

'Step2 is completed

 

'Step3 Search the customer

step = step + 1
nimQoSStart()

UsePage("Annet Zoek Klant - r01")
WriteHTML("INPUT TEXT[ID= 's_zipcode']", "7559BS")
WriteHTML("INPUT TEXT[ID= 's_housenr']", "53")
ClickHTMLElement("A[INNERTEXT= 'Zoek',INDEX='2']")

supp$ = script$
subsys$ = "e2e_appmon"
msg$ = "Failed to search the customer on Annet"
nimAlarm(5,msg$,supp$,subsys$)
nimQoSStop()
nimQoSSendTimer(qos$(step))

'Step3 is completed

 

 

Any help is appreciated.

 

Thanks,

Regards,

Murugesh

Outcomes