I had what I think is a similar challenge with a printer probe. I found it
easiest to deal with it in the <snmp-device-variables> section.

I set a variable for each tray (you would do it for your power supplies.)

Here's my code in the variables section:
  InTrayA, (defined("InputNameA") == 1 ? "$InputNameA \n    \\4\\Status:
\\0\\ $InputCurrentLevelA \\3gi\\(-3 = some paper left)\\0mp\\ " : "No
tray"), CALCULATION

There are variables defined above this line for $InputNameA and
$InputCurrentLevelA - this code inserts the desired text.

Then in the display section, I just output $InTrayA.

Hope that helps,

Bob
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Stratolinks
Sent: Friday, March 30, 2012 3:29 PM
To: [email protected]; [email protected]
Subject: [IM-Talk] using Eval: to format snmp-device-display


A custom probe I have written to monitor the power status at our sites has
an parameter option for either 1 or 2 power supplies is working as follows:

Code:
<snmp-device-display>
\B5\Device Statistics:\0P\
 \B2\ ${eval: ($Power_Supplies_1_or_2 =1)?"Single $System_Voltage Volt Power
Supply":($Power_Supplies_1_or_2 =2)?"Dual $System_Voltage Volt Power
Supplies":"Unknown"}\0P\
    PSU # 1:   ${chartable: #.## : $InputA} Volts DC
    PSU # 2:   ${chartable: #.## : $InputB} Volts DC
    Battery:    ${chartable: #.## : $InputC} Volts DC
    AC Power: ${chartable: # : $InputD} VAC
    Temperature : ${chartable: # : $Sensor1} ° Celcius
</snmp-device-display>



The first eval displays either single or dual supply correctly.

In the snmp device display I want it to not display the results for the
voltage of the second power supply if the parameter is set to 1, but display
normally if the parameter is set to 2.

When I make this change for PSU#2:

Code:
<snmp-device-display>
\B5\Device Statistics:\0P\
 \B2\ ${eval: ($Power_Supplies_1_or_2 =1)?"Single $System_Voltage Volt Power
Supply":($Power_Supplies_1_or_2 =2)?"Dual $System_Voltage Volt Power
Supplies":"Unknown"}\0P\
    PSU # 1:   ${chartable: #.## : $InputA} Volts DC
    ${eval: ($Power_Supplies_1_or_2 =1)?"":"PSU # 2: ${chartable: #.## :
$InputB} Volts DC"}
    Battery:    ${chartable: #.## : $InputC} Volts DC
    AC Power: ${chartable: # : $InputD} VAC
    Temperature : ${chartable: # : $Sensor1} ° Celcius
</snmp-device-display>




Now when the probe parameter is set to 1 for a single power supply, that
line is now blank as desired (ideally it would skip the line entirely), but
when the parameter is set to 2 for dual power supplies, the line shows:


Code:
PSU # 2: <NotFound:chartable: #.## : $InputB> Volts DC



It appears as though it is treating the "${chartable: #.## : $InputB}" as a
variable.

I am not terribly familiar with perl and this may just need to be formatted
differently, but I have tried many different ways with parenthesis to get it
to interpret this the way I want, but I am stumped so I am posting here in
the hopes that it can be done and I just need some help to get me going the
right direction.

Thanks in advance for any assistance.


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

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





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

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

Reply via email to