Steve:
> --- "Chapman, Steve" wrote:
> Here is the problem. I have a OID that responds back with 2 if it ok
> and 4 if it fails. I would like to do some thing like
>
> module 1: if {module1} = 2 then "System up" or = 4 "System down".
>
> Right now it just displays the following
>
> module 1 : 2 or module 1 : 4
> --- end of quote ---
Great question. There are two answers:
1) There is an if/then/else operator that you can use in the ${eval: xxx}
macro.
To convert the number to the corresponding string in your <snmp-device-display>
section, write:
${eval: $val == 1 ? "OK" : "Bad"}
This says, if $val is one, output "OK", otherwise output "Bad". These can be
chained to test for multiple cases:
${eval: $val == 1 ? "OK" : $val == 2 ? "Bad" : $val == 3 ? "Other" : $val }
This outputs the following:
OK if it's 1
Bad if it's 2
Other if it's 3
$val if it's anything else
2) If the values come from an enumeration in a MIB, and you have imported
that
MIB into InterMapper, then a new facility will use information from the MIB to
display the desired string. [This was added in a recent version of InterMapper
4.5. We're adding this documentation to the Developer Guide as we speak...]
For example, the variable tcpRtoAlgorithm comes from the TCP-MIB that is
preloaded in InterMapper. If you read the MIB, you'll see that tcpRtoAlgorithm
is defined like this:
tcpRtoAlgorithm OBJECT-TYPE
SYNTAX INTEGER {
other(1), -- none of the following
constant(2), -- a constant rto
rsre(3), -- MIL-STD-1778, Appendix B
vanj(4) -- Van Jacobson's algorithm [5]
} ... etc...
To make InterMapper display the string instead of the number, create a variable
with a type of STRING (instead of DEFAULT or INTEGER), like this:
<snmp-device-variables>
tcpRtoAlgorithm, tcpRtoAlgorithm.0, STRING, "RTO Algorithm"
</snmp-device-variables>
When you use $tcpRtoAlgorithm in the <snmp-device-display> section, it will
appear as one of the strings above, instead of a number.
Please get back to me if you have further questions. Thanks.
Rich Brown [EMAIL PROTECTED]
Dartware, LLC http://www.dartware.com
10 Buck Road, PO Box 130 Telephone: 603-643-9600
Hanover, NH 03755-0130 USA Fax: 603-643-2289
____________________________________________________________________
List archives:
http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]