Network Management

Change the downtime variable result from minutes to hours

The article shows how to change the downtime variable which displays in minutes to hours for a node down alert or any alert that is using such a variable

First published date

8/18/2020 2:21 PM

Last published date

8/18/2020 2:21 PM

Overview

  • Alerts triggered for nodes sometimes shows the node has been down for 100s of minutes as seen below. 
  • The user can changed this with some SQL. 

Product section

Orion Platform

Resolution

  • On the Alert, edit the Trigger Action. 
  • When adding the Variable for the Trigger Action, use the following SQL.
 
The node has been down for: 
${SQL: SELECT CAST( CAST(('${N=Alerting;M=Downtime}') AS int) / 60 AS varchar) + ' hours '  + right('0' + CAST(CAST(('${N=Alerting;M=Downtime}') AS int) % 60 AS varchar(2)),2) + ' minutes'}

-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.


Here is an example:
Add the the SQL at step 2 to the Alert Trigger Action;


The Alert result now shows minutes in hours.