Execute and Wait

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Execute and Wait

Post by MirkoW »

Hi,

i have a test that countains 2 actions.

at first it run a script that create a file, this file are addet as attachment into thr second sendmail-action.

its able to run the first action and wait util this script are finished befor HM is beginning the second action?
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Re: Execute and Wait

Post by mp1 »

Heini_net wrote:Hi,

i have a test that countains 2 actions.

at first it run a script that create a file, this file are addet as attachment into thr second sendmail-action.

its able to run the first action and wait util this script are finished befor HM is beginning the second action?
Maybe you can send the mail after the second consecutive bad result?
(see start action --> start when)

Or you generate the mail via script?

Regards,

Martin
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

no i run a script at first with the first action and this script create a textfile.

the second action sent a mail to me and i want to add the created file as attachment.

so if the file not created fast enough so the the second sendmail action wont add the file.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

its able to run the first action and wait util this script are finished befor HM is beginning the second action
I have provided solution when you asked how to "add result of an app to Mail Action"
http://www.ks-soft.net/cgi-bin/phpBB/vi ... php?t=4902

You should use HM Script action with ExecuteProgram HMScript command to start your script and wait for results.
http://www.ks-soft.net/hostmon.eng/mfra ... #actScript

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

Hi,

can i use params in the HMS file too ?

for example i'm running this script:

C:\WINDOWS\system32\wscript.exe C:\HM-Konfiguration\cpuprocess.vbs "c:\TEMP\%TestID%-Process.txt" "%HostAddr%"

the first param create a file name based on the thest id but i cant get anny error messages and this script does not create a file. but if i'm using this command for action "execute external app" so it works.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

can i use params in the HMS file too ?
Yes.
Please read the manual: http://www.ks-soft.net/hostmon.eng/mfra ... acroparams
for example i'm running this script:
C:\WINDOWS\system32\wscript.exe C:\HM-Konfiguration\cpuprocess.vbs "c:\TEMP\%TestID%-Process.txt" "%HostAddr%"
Where is ExecuteProgram command?

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

KS-Soft wrote:
can i use params in the HMS file too ?
Yes.
Please read the manual: http://www.ks-soft.net/hostmon.eng/mfra ... acroparams
for example i'm running this script:
C:\WINDOWS\system32\wscript.exe C:\HM-Konfiguration\cpuprocess.vbs "c:\TEMP\%TestID%-Process.txt" "%HostAddr%"
Where is ExecuteProgram command?

Regards
Alex
i have created a new test with the "run hms script"-action

the ExeCuteProgramm Command contain this:

C:\WINDOWS\system32\wscript.exe C:\HM-Konfiguration\cpuprocess.vbs "c:\TEMP\%TestID%-Process.txt" "%HostAddr%"
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

1) May I see entire HMScript?

2) You may check action result using system log or Quick Log.
What do you see in Quick Log?
http://www.ks-soft.net/hostmon.eng/mfra ... ickLogPane
Note 1: Quick Log may work in 3 different modes:
- Show test results
- Show actions
- Show test results and actions
Note 2: If you select specific test in Test Details pane, HostMonitor will display latest actions triggered by this test only.

3) I would recommend to use /B command line parameter for wscript.exe

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

file attachment does not work because i receive follor errormessage:

Error: Attachment file not found (c:\TEMP\%TestID%-Process.txt)

but this file are exist.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I assume your script has been executed and file was created? What action shows this error? "Send e-mail" action? What version of HostMonitor do you use?

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

hi,

i have found the reason for this.

i 'm using a vbs script with wscript.sleep. but this does not work. hm receive only a error but i dont know whats the error message. it called only "error(s) detectet" but if i run the hms script manually so i dont receive any error messages. :-?

so hm dont wait until the "run external app" return and start the next action. and the next action are faster than the first action who create the file.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

1) Have you added /B (batch mode) parameter?
2) I would recommend to use cscript.exe instead of wscript.exe

3) If you see some error then please explain where do you see this error. If you see "error(s) detected" message in HostMonitor's log, please provide exact log record. I think message should provide more details. Isn't it?
I assume this error reported by "Execute HMScript" action? Am I right?
Then we return to the same point - may I see your script? I asked this several times.

How I can help you to find the problem if you do not provide any details??

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

hi, i have found an easier solution for my problem.

i use the sleep.exe with "run hms script" for waiting.
Post Reply