cancel
Showing results for
Did you mean:
Level 10

## Alert show only two decimal places

What I need to do, to the alert shows only 2 decimal places.

For example:

Variable: Statistic data: \${StatisticData}

Result: Statistic data: 5,84696769714355

I need that show only 2 decimal places

Tags (6)
1 Solution
Level 10

In this example I used the variable \${StatisticData} to explain

\${SQL: Select CAST (\${StatisticData} AS Decimal(18,2))} %  (for numeric)
(18,2) = number of places before and after the comma

or

\${SQL:Select Substring ('\${StatisticData}',1,4) AS StatisticData} %  (for a string)

('\${StatisticData}',1,4) = selects a substring, in this case from first to fourth character, with the comma

9 Replies
Level 10

In this example I used the variable \${StatisticData} to explain

\${SQL: Select CAST (\${StatisticData} AS Decimal(18,2))} %  (for numeric)
(18,2) = number of places before and after the comma

or

\${SQL:Select Substring ('\${StatisticData}',1,4) AS StatisticData} %  (for a string)

('\${StatisticData}',1,4) = selects a substring, in this case from first to fourth character, with the comma

Level 8

Did you ever figure out how to make the decimal show? The Truncate(\${Statistic},1) does not work. We tried it several different ways, to no avail.

Tainã Rodrigues

Level 10

sbramlett

Hello,

I use this way:

\${SQL: Select CAST (\${StatisticData} AS Decimal(18,2))} %  (for numeric)

(18,2) = number of places before and after the comma

or

\${SQL:Select Substring ('\${StatisticData}',1,4) AS StatisticData} %  (for a string)

('\${StatisticData}',1,4) = selects a substring, in this case from first to fourth character, with the comma

Level 11

I found the SQL macro requires a FROM statement in order to function correctly. In this context it can be from any table since you are only applying an operator to an alert variable value.

Level 9

Hi,

I tried following html format but i got following message.

<font size="4" face="Verdana"><u><b>Storage Details:</b></u></font>

Storage Manufacturer  = <b>\${N=SwisEntity;M=Manufacturer}</b>
Storage Status    = <b>\${N=SwisEntity;M=OperStatusDescription}</b>
Storage Model    = <b>\${N=SwisEntity;M=Model}</b>
Storage Name     = <b>\${N=SwisEntity;M=Name}</b>
IOPS Value     = <b>\${N=SwisEntity;M=IOPSTotalThreshold.CurrentValue}</b>
Throughput Value   = <b>Truncate(\${N=SwisEntity;M=BytesPSTotalThreshold.CurrentValue},2)</b>
Throughput Value   = <b>\${N=SwisEntity;M=BytesPSTotalThreshold.CurrentValue}</b>
Throughput Value   = <b>\${SQL: Select CAST (\${N=SwisEntity;M=BytesPSTotalThreshold.CurrentValue} AS Decimal(18,2))}</b>
Throughput Value   = <b>\${SQL:Select Substring ('\${N=SwisEntity;M=BytesPSTotalThreshold.CurrentValue}',1,4) AS StatisticData} %</b>

**************************************************************************************************************************************************************

Message Detail;

Storage Manufacturer = EMC Corporation

Storage Status = Error

Storage Model = DMX4-24

Storage Name = 000290103038

IOPS Value = 72.8887405395508

Throughput Value = Truncate(538749.8125,2)

Throughput Value = 538749.8125

Throughput Value = \${SQL: Select CAST (538749.8125}

Throughput Value = \${SQL:Select Substring ('538749.8125',1,4)} %

Level 15

http://www.solarwinds.com/documentation/en/flarehelp/sam/default.htm#OrionAPMPHFormulaExamples.htm

Specifically this:

 Truncate Truncate({value},{number of decimal places}) Truncates a monitored value to a designated number of decimal places.

I think this is what you're after:

Truncate(\${StatisticData}, 2)

Level 10

Thanks for the answer dear Let me explain better... I'm using the Advanced Alert Manager, when I set the Trigger Action

NetPerMon Event Log: Statistic Data: \${StatisticData} it shows Statistic data: 5,84696769714355

What I need put on the place of \${StatisticData} to show just 2 decimal places? (the complete Syntax for Advanced Alert Manager)

Level 10

I try to replace with Truncate(\${StatisticData}, 2), but dont worked  Level 15

Sorry, I was mistaken, HERE's the page I was looking for:

http://www.solarwinds.com/documentation/en/flarehelp/sam/default.htm#OrionAPMAGConversionValue.htm

This might clear things up. For a script monitor, you can enter the formula I mentioned earlier so the output can be truncated to 2 decimal places. Hope this is what you're looking for.  