 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
Abts Wim
Joined: 01 Sep 2004 Posts: 8
|
|
Error using the monitor disk space template |
|
Hi, I just tried creating a free disk space monitor job using the template. Whenever I run the job I get the error message 'Type mismatch' on the line 'IsLess Mbytes, 20000, problem' What should I change? Here's the script : Dim job_state, string Dim update_state, boolean Dim already_notified, boolean Dim bytes, number Dim Mbytes, number Dim problem, boolean // job state flag is used to prevent the job from sending // notification messages every 3 minutes after first message // has been sent. // get job state IniFileGetKey "win.ini", "Status", "Free Space on Disk E", job_state // get free space DiskGetFreeSpaceEx "E:", bytes // convert to Mbytes Divide bytes, 1048576, Mbytes // if less than 20000MB, notify system administrator IsLess Mbytes, 20000, problem If problem, NOTIFY, CHECK_STATE NOTIFY: // insufficient space // check job state, state "MESSAGE SENT" indicates that the message has been // already sent, so skip sending email this time isEqual job_state, "MESSAGE SENT", already_notified IfThen already_notified, DONE MailSend "", "", "xxx@xxx.xxx", & "!!! Low of disk space !!!", & "Amount of free disk space has fallen bellow 20.000 Mbytes!" // message sent! Now, to prevent sending other subsequent annoying messages every 3 minutes, // set job state to "MESSAGE SENT" then exit IniFileSetKey "win.ini", "Status", "Free Space on Disk E", "MESSAGE SENT" Exit CHECK_STATE: // monitored server is running // if the job state is not "READY", update it // Note: job state may be other then "READY" after server was restarted NotEqual job_state, "READY", update_state IfThen update_state, UPDATE_STATE, DONE UPDATE_STATE: IniFileSetKey "win.ini", "Status", "Free Space on Disk E", "READY" DONE: // all done Thanks
|
|
Thu Mar 23, 2006 9:17 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: Error using the monitor disk space template |
|
I just copied your script (changed E: to C:) and have no problems running it. In order to help you with this issue I need you to turn on the tracing option in the Tools/Options menu, Log page; Trace Enabled and return the job. Post the resulting trace (script.log file) so we can see where it breaks and what is causing that. : Hi, : I just tried creating a free disk space monitor job using the template. : Whenever I run the job I get the error message 'Type mismatch' : on the line 'IsLess Mbytes, 20000, problem' : What should I change? : Here's the script : Dim job_state, string : Dim update_state, boolean : Dim already_notified, boolean : Dim bytes, number : Dim Mbytes, number : Dim problem, boolean : // job state flag is used to prevent the job from sending : // notification messages every 3 minutes after first message : // has been sent. : // get job state : IniFileGetKey "win.ini", "Status", "Free Space on : Disk E", job_state : // get free space : DiskGetFreeSpaceEx "E:", bytes : // convert to Mbytes : Divide bytes, 1048576, Mbytes : // if less than 20000MB, notify system administrator : IsLess Mbytes, 20000, problem : If problem, NOTIFY, CHECK_STATE : NOTIFY: // insufficient space : // check job state, state "MESSAGE SENT" indicates that the message : has been : // already sent, so skip sending email this time : isEqual job_state, "MESSAGE SENT", already_notified : IfThen already_notified, DONE : MailSend "", "", "xxx@xxx.xxx", & : "!!! Low of disk space !!!", & : "Amount of free disk space has fallen bellow 20.000 Mbytes!" : // message sent! Now, to prevent sending other subsequent annoying messages : every 3 minutes, : // set job state to "MESSAGE SENT" then exit : IniFileSetKey "win.ini", "Status", "Free Space on : Disk E", "MESSAGE SENT" : Exit : CHECK_STATE: // monitored server is running : // if the job state is not "READY", update it : // Note: job state may be other then "READY" after server was : restarted : NotEqual job_state, "READY", update_state : IfThen update_state, UPDATE_STATE, DONE : UPDATE_STATE: IniFileSetKey "win.ini", "Status", : "Free Space on Disk E", "READY" : DONE: // all done : Thanks
|
|
Thu Mar 23, 2006 10:03 am |
|
 |
Abts Wim
Joined: 01 Sep 2004 Posts: 8
|
|
Re: Error using the monitor disk space template |
|
Hi, Here's the trace log : JAL **** 24/03/2006 09:19:39 **** JAL 7: DIM JAL 7: Executing DIM("JOB_STATE", "STRING") JAL 8: DIM JAL 8: Executing DIM("UPDATE_STATE", "BOOLEAN") JAL 9: DIM JAL 9: Executing DIM("ALREADY_NOTIFIED", "BOOLEAN") JAL 10: DIM JAL 10: Executing DIM("BYTES", "NUMBER") JAL 11: DIM JAL 11: Executing DIM("MBYTES", "NUMBER") JAL 12: DIM JAL 12: Executing DIM("PROBLEM", "BOOLEAN") JAL 19: INIFILEGETKEY JAL 19: Executing INIFILEGETKEY("win.ini", "Status", "Free Space on Disk c", "") JAL Return "" JAL 22: DISKGETFREESPACEEX JAL 22: Executing DISKGETFREESPACEEX("c:", "0") JAL Return "3730355200" JAL 24: DIVIDE JAL 24: Executing DIVIDE("3730355200", "1048576", "0") JAL Return "3557,5439453125" JAL 26: ISLESS JAL 26: Executing ISLESS("3557,5439453125", "300000", "false") Then a popup window appears, saying that a type mismatch occured ... This is currently running on a Win2000 server, but I tried the same on a windows XP machine, with the same result. I'm using version 3.4.26. Regards : I just copied your script (changed E: to C:) and have no problems running it. : In order to help you with this issue I need you to turn on the tracing option : in the Tools/Options menu, Log page; Trace Enabled and return the job. : Post the resulting trace (script.log file) so we can see where it breaks : and what is causing that.
|
|
Fri Mar 24, 2006 4:30 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: Error using the monitor disk space template |
|
There is something strange about 3557,5439453125. It should look like 3557.5439453125 and treated like a number. The rest is a side effect of that. When the script does the IsLess comparison it finds comma in the left value, assumes the left value is a string and the right value is a number and then as a result you get the "mismatch" error. When I run the same script here, and I use different regional settings, everything works fine. Therefore I suggest you make a small change in the script to overcome the comma issue and make the script work on your system, before line 26 insert the following: Round Mbytes, 0, Mbytes : Hi, : Here's the trace log : JAL : **** 24/03/2006 09:19:39 **** : JAL 7: DIM : JAL 7: Executing DIM("JOB_STATE", "STRING") : JAL 8: DIM : JAL 8: Executing DIM("UPDATE_STATE", "BOOLEAN") : JAL 9: DIM : JAL 9: Executing DIM("ALREADY_NOTIFIED", "BOOLEAN") : JAL 10: DIM : JAL 10: Executing DIM("BYTES", "NUMBER") : JAL 11: DIM : JAL 11: Executing DIM("MBYTES", "NUMBER") : JAL 12: DIM : JAL 12: Executing DIM("PROBLEM", "BOOLEAN") : JAL 19: INIFILEGETKEY : JAL 19: Executing INIFILEGETKEY("win.ini", "Status", : "Free Space on Disk c", "") : JAL Return "" : JAL 22: DISKGETFREESPACEEX : JAL 22: Executing DISKGETFREESPACEEX("c:", "0") : JAL Return "3730355200" : JAL 24: DIVIDE : JAL 24: Executing DIVIDE("3730355200", "1048576", : "0") : JAL Return "3557,5439453125" : JAL 26: ISLESS : JAL 26: Executing ISLESS("3557,5439453125", "300000", : "false") : Then a popup window appears, saying that a type mismatch occured ... : This is currently running on a Win2000 server, but I tried : the same on a windows XP machine, with the same result. : I'm using version 3.4.26. : Regards
|
|
Fri Mar 24, 2006 9:25 am |
|
 |
Abts Wim
Joined: 01 Sep 2004 Posts: 8
|
|
Re: Error using the monitor disk space template |
|
: There is something strange about 3557,5439453125. It should look like : 3557.5439453125 and treated like a number. The rest is a side effect of : that. When the script does the IsLess comparison it finds comma in the : left value, assumes the left value is a string and the right value is a : number and then as a result you get the "mismatch" error. : When I run the same script here, and I use different regional settings, : everything works fine. Therefore I suggest you make a small change in the : script to overcome the comma issue and make the script work on your : system, before line 26 insert the following: Round Mbytes, 0, Mbytes I tried this but it generates a divide by zero error in the round line. For your information, we use , as decimal point. Any more ideas?
|
|
Fri Mar 24, 2006 11:24 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7963
|
|
Re: Error using the monitor disk space template |
|
How about next 3 lines instead of Round Dim RoundedMB, number GetToken ",", Mbytes, RoundedMB Set Mbytes, RoundedMB : I tried this but it generates a divide by zero error in the : round line. : For your information, we use , as decimal point. : Any more ideas?
|
|
Fri Mar 24, 2006 2:38 pm |
|
 |
Abts Wim
Joined: 01 Sep 2004 Posts: 8
|
|
Re: Error using the monitor disk space template |
|
: How about next 3 lines instead of Round : Dim RoundedMB, number : GetToken ",", Mbytes, RoundedMB : Set Mbytes, RoundedMB Yes, this worked. Thanks
|
|
Mon Mar 27, 2006 3:45 am |
|
 |
|
|
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
|
|
|