sumo wrote:
> 
> I expanded the example above with "old_role" and "cur_role":
> 
> clvSysForwardedBits, .1.3.6.1.4.1.5089.1.2.1.2.0, DEFAULT, "The current total 
> number of forwarded bytes"
> p2, $p1, CALCULATION, ""
> p1, $p0, CALCULATION, ""
> p0, $clvSysForwardedBits, CALCULATION, ""
> role, ((${p0} > 1000) && (${p1} > 1000) && (${p2} > 1000)) ? "ACTIVE" : 
> "SLAVE", CALCULATION, ""      
> old_role, $cur_role, CALCULATION, ""
> cur_role, $role, CALCULATION, ""
> 
> The output looks something like this:
> 
> Current role: ACTIVE
> Old role: 0
> Poll 0 forwarded bits:  62.07 Mbps
> Poll 1 forwarded bits:  43.26 Mbps
> Poll 2 forwarded bits:  48.85 Mbps
> 


Variables in expressions default to a numeric context.  For example, the 
expression:

    $cur_role 

returns the numeric value of $cur_role, which is 0 when $cur_role := "ACTIVE".

Always force a string context by using quotes. Change your last two expressions 
to this:

old_role, "$cur_role", CALCULATION, ""
cur_role, "$role", CALCULATION, ""

(The only exception to this rule is the =~ operator which promotes the left 
argument to a string context automatically.)


-------------------- m2f --------------------

Read this topic online here:
http://forums.dartware.com/viewtopic.php?p=3405#3405





____________________________________________________________________
List archives: 
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [email protected]

Reply via email to