cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 10

Convert "Down Time" which is in minutes, into hours:mins

How do I convert the output of "Down Time" which is in minutes, into hours:mins:secs?

For example, using the variable ${N=Alerting;M=DownTime} we get the "Down time" in minutes.  one of our nodes was down for 213 minutes..

How can I convert this calculation so that when we get the "Node Reset email" we'll see the "down time" in hours:mins?


Thanks!



0 Kudos
10 Replies
Level 10

${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'}

for an "blah hours bling minutes" format or

${SQL: SELECT CAST( CAST(('${N=Alerting;M=Downtime}') AS int) / 60 AS varchar) + ' :'  + right('0' + CAST(CAST(('${N=Alerting;M=Downtime}') AS int) % 60 AS varchar(2)),2)}

for a "blah:bling" format.

I like the first format more because the second one looks too much like a time to me, but I don't like the 0 hours thing... haven't written a case to take care of that, yet.

gsmith@houseloan.com Worked like a charm!!  I'm not going back and changing all my 'reset' alerts to include this.  So much better!!

Thanks again,

John L.

0 Kudos

gsmith,

This is exactly what I was looking for !!!

Great work, much appreciated

0 Kudos

How do we get this to work in Alerts ?

0 Kudos

No worries i figured it out it was giving Macro SQL error since i copied the code wrongly, its working like a charm.... just we need to copy the above queries in alert message body for RESET action.

pastedImage_0.png

Simulate action is showing the new variable with hours and minutes.

pastedImage_1.png

I hope this was proper answer for the question, excellent work gsmith@houseloan.com

Level 12

I've not tried it myself but wonder if you can use mathematical operators within it or previous so it would be a / 60 , if its a custom poller then you can perform a transform on it. An SQL custom query could also be performed on the table and field in question.

0 Kudos

jodelgado

I know this has been asked before, as many people prefer the output in "days hours:minutes:seconds" format, but I cannot seem to find the answer in my notes.

I know the alert/active alert page shows exactly what you are asking, so I am sure it is already in there somewhere.
I will keep looking, as this should already be in my notes, and needs to be.

0 Kudos

Did we get how to convert this Down Time from minutes to days:hours:min ? Truly it has to be built in capability.

0 Kudos

no luck yet!

0 Kudos

Have you tried finding the oid it uses and then doing a transform in 'Orion universal device poller' and then using that in the alert?

0 Kudos