Xymon Mailing List Archive search

Devmon MATH

3 messages in this thread

list Ralph Mitchell · Mon, 24 Sep 2007 12:48:24 -0500 ·
Is anyone using MATH in devmon templates??  I'm trying to calculate
percent memory used for a couple of Windows 2000 servers and I'm
getting:

   "Error(s) while parsing 'PhysMemUsed' on xxxxxx"

The transforms file contains this:

     PhysMemUsed  : MATH : {PhysMemSize} - {PhysMemFree}
     PhysMemPerc  : MATH : ({PhysMemUsed} / {PhysMemSize}) x 100

and the corresponding OIDS are:

     PhysMemSize   : 1.3.6.1.4.1.232.11.2.13.1.0 : leaf
     PhysMemFree   : 1.3.6.1.4.1.232.11.2.13.2.0 : leaf

If I report PhysMemFree & PhysMemSize in the report message, I get
sensible values.  For example, right now they show 471 & 1152, so
PhysMemUsed would be 681 and PhysMemPerc would be 59%.

I get the above error message, and PhysMemPerc is displayed as "Parent
data missing".

Any clues??

Ralph Mitchell
list Charles Jones · Mon, 24 Sep 2007 10:56:54 -0700 ·
Should it be "* 100" instead of "x 100" ?
     PhysMemPerc  : MATH : ({PhysMemUsed} / {PhysMemSize}) x 100

list Ralph Mitchell · Mon, 24 Sep 2007 13:59:47 -0500 ·
quoted from Charles Jones
On 9/24/07, Charles Jones <user-e86b4aeade4e@xymon.invalid> wrote:
Should it be "* 100" instead of "x 100" ?
     PhysMemPerc  : MATH : ({PhysMemUsed} / {PhysMemSize}) x 100
No, there's a translation that happens in the dm_tests.pm module:

      # Convert our math symbols to their perl equivalents
        $expr =~ s/x/\*/g;  # Multiplication
        $expr =~ s/\^/**/g; # Exponentiation

I assume that having asterisks in the string causes problems with
other devmon code prior to that point.

Anyway, it's the subract that either doesn't work, or fails to create
the PhysMemUsed variable that gets used in the subsequent calculation.

Ralph Mitchell