SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
debugging a script

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
debugging a script
Author Message
pgis



Joined: 28 Feb 2007
Posts: 2
Country: United States

Post debugging a script Reply with quote
I just installed an evaluation version of 24x7 on a server and I decided to test the "Monitoring file-server Disk space" script.
I created a new job from the multiple server template. I specified my servers & devices as "\\portal2\c$,\\portal2\d$".
These are different servers from the one that 24x7 was installed on.

Running the job in debug mode generates a popup window that says that there are syntax errors in the script and to run the job in "Run Now".

Running it in normal mode puts a message in the log "An error occurred while executing automation script Line 1: Syntax error."
(Line 1 contains comments.)

Running it in Test mode seems to lock up the Scheduler. Under "My Computer", I do see a network drive being created "C$ on 'portal2' (T:)".
But it never disconnects and reconnects to the 2nd drive in the list. 24x7 is displaying "(Not Responding)" in its blue header bar.

After stopping 24x7 by killing the process, restarting 24x7, I can reproduce the results (after I manually disconnect the network drive.)
I am running as a domain admin and I can manually map both network drives. I've also rebooted and tried it again. Same results.
Wed Feb 28, 2007 6:50 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
Please post the script and I will point to place containing the syntax error that causes this job to abort.
Wed Feb 28, 2007 6:59 pm View user's profile Send private message
pgis



Joined: 28 Feb 2007
Posts: 2
Country: United States

Post Reply with quote
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' 24x7 Scheduler 3.4.26
'' Job Template: Multiple file server free space monitor
'' Generated on 28-February-2007 17:04
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub Main()
Dim WshNetwork, DriveLetter, RemotePath, FileSys, list, d, s, pos
' use T as a temp drive, use a different letter if T is already in use
DriveLetter = "X:"
list = "\\portal2\c$,\\portal2\d$"
Set WshNetwork = CreateObject("WScript.Network")

' parse volume list and process each volume one-by-one
Set FileSys = CreateObject("Scripting.FileSystemObject")
Do While list <> ""
' get path; each item should be in \\my_server\my_volume format
pos = InStr(list, ",")
if pos = 0 then pos = Len(list) + 1
RemotePath = Trim(Left(list, pos - 1))
list = mid(list, pos + 1)

' map network drive
WShNetwork.MapNetworkDrive DriveLetter, RemotePath

' get space usage
Set d = FileSys.GetDrive(DriveLetter)


' notify admin if free space has fallen below 5000 MBytes
If d.FreeSpace/1024/1024 < 5000 Then
s = "Volume: " & d.VolumeName & " (" & RemotePath & ")" & vbCrLf & _
"Available Space To User: " & FormatNumber(d.AvailableSpace/1024/1024, 0) & " Mbytes" & vbCrLf & _
"Free Space: " & FormatNumber(d.FreeSpace/1024/1024, 0) & " Mbytes" & vbCrLf & _
"Total Size: " & FormatNumber(d.TotalSize/1024/1024, 0) & " Mbytes" & vbCrLf & _
"Percent Free: " & FormatNumber(d.FreeSpace/d.TotalSize*100, 0) & "%"

JALScript.Execute("MailSend ""batch agent"", """", ""paul.gilberti@brattle.com"", " & _
" ""Low free space warning"", " & _
" ""Free space on volume " & RemotePath & _
" dropped below 5000 MBytes." & vbCrLf & _
vbCrLf & s & " "" ")
End If

' remove mapping
WShNetwork.RemoveNetworkDrive DriveLetter
Loop

' free resources
Set d = Nothing
Set FileSys = Nothing
Set WshNetwork = Nothing
End Sub
Wed Feb 28, 2007 7:03 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7849

Post Reply with quote
This VBScript internally makes a cross language call. It loads JAL script engine and attempts to use it to execute a dynamic script for sending an email message. That dynamic script has only 1 line and when an error occurs in that line you get "An error occurred while executing automation script Line 1: Syntax error."

Code:
JALScript.Execute("MailSend ""batch agent"", """", ""paul.gilberti@brattle.com"", " & _
" ""Low free space warning"", " & _
" ""Free space on volume " & RemotePath & _
" dropped below 5000 MBytes." & vbCrLf & _
vbCrLf & s & " "" ")


It might sound a bit misleading. It is just, the error is wired up several levels, from JAL to VBScript host from VBScript host to job VBScript and from there to the job queue and then to scheduler engine level.

Anyway, I think the problem is in "batch agent" - this doesn't look like a valid MAPI profile name or email address. If you have 24x7 configured to use MAPI for sending emails please specify a valid MAPI profile name and make sure to provide the correct password, don't leave password parameter empty. If you have it configured to use SMTP please make sure to specify a valid email address that can be used to send emails.


As for the hanging, please be aware that VBSCript's GetDrive operation is not very efficient and if the volume is large it could take a very long. Please be patient and let it run.

Code:
Set d = FileSys.GetDrive(DriveLetter)


If you are interested in fast and efficient disk space monitoring, check out 24x7 Event Server http://www.softtreetech.com/i24x7es.htm. This software is specifically designed for such things and its event-monitoring engine is very robust.
Wed Feb 28, 2007 10:55 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 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
Design by Freestyle XL / Flowers Online.