Page 1 of 1

Show varible value in /tool e-mail

Posted: Tue Apr 15, 2008 7:54 am
by airstream
Hi all, Due to a recent downgrade from v3 back to 2.9.51 some of our scripts need adjusting. Most notable is the script handling of /tool e-mail.

We are trying to do this:
:set foo 900
 /tool e-mail send server= subject="variable is $foo" body="value is $foo"
But the 2.9 ROS wont accept the $foo in the body of the email (invalid argument). How do I wrap this value in the body to display the value in the generated email?

Re: Show varible value in /tool e-mail

Posted: Tue Apr 15, 2008 10:09 am
by mrz
subject=("variable is " . $foo) body=("value " . $foo)

Re: Show varible value in /tool e-mail

Posted: Tue Apr 15, 2008 10:25 am
by airstream
Hi, Thanks for your help there, the Email scripts are working! :wink:

Now having trouble with my logical statements in another script:
{:local warninglevel
:local name
:local surname
:local usage
:local bytesin
:local bytesout
:local bytestotal
:local megstotal
:local cap
:local comment
:local newcomment
:local lastwarning
:local newwarning
:local percentage
:local percentile
:local warn
:local update
:local email
:local server
:local username

:set server
/tool user-manager user
:foreach i in=[/tool user-manager user find subscriber=admin] do={

:set name [get $i first-name]
:set surname [get $i last-name]
:set comment [get $i group-name]
:set bytesin [get $i download-used]
:set bytesout [get $i upload-used]
:set bytestotal ($bytesin + $bytesout)
:set email [get $i email]
:set username [get $i name]

:set megstotal ($bytestotal / 1000000)
:set cap [:pick $comment 0 4]
:set lastwarning [:pick $comment 4 6]
:set percentage (($megstotal*100) / $cap)

:if ($percentage < 50) do={ :set warninglevel 10 ; :log info ("---set to--- " . $warninglevel) }

:if ($percentage > 50) do={
:if ($percentage < 75) do={ :set warninglevel 50 ; :log info ("---set to--- " . $warninglevel) }
:if ($percentage > 75) do={ :set warninglevel 75 ;}

:if ($percentage > 75) do={
:if ($percentage < 90) do={ :set warninglevel 75 ;}
:if ($percentage > 90) do={ :set warninglevel 90 ;}

:if ($percentage > 90) do={
:if ($percentage < 100) do={ :set warninglevel 90 ;}
:if ($percentage > 100) do={ :set warninglevel 99 ;}

:log info ($name . " percentage " . $percentage . " warnlevel " . $warninglevel ) } }
- Kudos to Kridge who provided the script source -
At this line (added for debug) the warninglevel value is null
:log info ($name . " percentage " . $percentage . " warnlevel " . $warninglevel ) } }
At this point of the script $percentage has a value but it wont assign the warninglevel variable to the values in marks if the statement is true. could you point me to the correct syntax here?