10 Replies Latest reply on Jan 4, 2018 2:14 PM by jlinkowsky

# 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!

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

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 will keep looking, as this should already be in my notes, and needs to be.

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

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

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

no luck yet!

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

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?

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

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.

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

\${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.

5 of 5 people found this helpful
• ###### Re: Convert "Down Time" which is in minutes, into hours:mins

gsmith,

This is exactly what I was looking for !!!

Great work, much appreciated

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

How do we get this to work in Alerts ?

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

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.

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

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

1 of 1 people found this helpful
• ###### Re: Convert "Down Time" which is in minutes, into hours:mins

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.