35 Replies Latest reply on Jul 21, 2016 7:11 AM by dwskinner

    How to get the Alert triggered duration

      Has anyone able to achive this

      I am trying to get the duration in mins in advance alerts for which the alert has been generated

      Something like

      Alert RESET time - Alert Trigger time.

      I can figure out something link ${DateTime - AlertTriggerTime}

      now how to get this working.

        • Re: How to get the Alert triggered duration

          hey anyone able to crack this out ????

          • Re: How to get the Alert triggered duration
            jkennedy

            I would like to accomplish this also. When an alert is reset, I would like to send how long the alert was active in the reset action. 

            Example

            Trigger when the sky is blue.

            Reset when the sky is no longer buy.

            Reset action sends an email saying how long the sky was blue.

              • Re: How to get the Alert triggered duration
                denny.lecompte

                That's pretty straightforward.  I've captured that feature request.

                  • Re: How to get the Alert triggered duration
                    andressk

                    Hi,

                    Is there some advance with this kind of Alert Trigger variable that shows the reset time or something like that, that shows the total amount of time for an outage on a reset alert?

                    Thanks 

                      • Re: How to get the Alert triggered duration
                        KwameB

                        I would also like to know if this was implemented since 2009.  Currently I have Alert Trigger Time: ${AlertTriggerTime} & ${ShortTime} to show when the alert was triggered & reset.  However, If I have a delay on the Reset Timer I believe that the actual time the alarm was reset would be displayed incorrectly by ${ShortTime}. What would be displayed is the time the reset action is executed.

                        For example, if a node goes down @ 1:00pm a trigger action (e.g. an e-mail) would be sent with alert time 1:00pm.

                        Let's say it comes back up @ 1:10 pm but I have a 5 min delay on the Reset timer, I won't get an e-mail @ 1:10 i will get it @ 1:15 after the reset timer expires. Therefore the e-mail would be sent out with the time the e-mail was sent & not the time the reset condition was met.

                        It would be good if there was a ${AertReset} variable. 

                          • Re: How to get the Alert triggered duration
                            netlogix

                            If you are just looking for the math to be done, you could try ${SQL:Select ${AlertTriggerTime} - ${ShortTime}}

                             

                            Edit: hmmm thats not working... I think the variable types are wrong... need to do a cast or something... let me look at this, unless anybody else can quickly fix my mistake here.

                             

                            Ok, does this work: ${SQL:Select Convert(time,Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}'))}

                              • Re: How to get the Alert triggered duration
                                Questionario

                                last one works :P

                                just wanted to post that you need to convert it to the same type first :)

                                thanks for this, integrated this into our alerts as a gimmick to see how long it took to solve the problem ;)

                                • Re: How to get the Alert triggered duration
                                  Questionario

                                  Hi netlogix,

                                   

                                  for some reason the query now produces sql errors:

                                  MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value

                                   

                                  any idea on how to fix this?

                                    • Re: How to get the Alert triggered duration
                                      netlogix

                                      hmmm...  I don't know.  The only thing I can think of right now is that is might have to do with some sort of roll-over happening (was it more than 24 hours?).  I'll start giving this some thought, in the mean time, can you see if there was anything out of the norm with that specific occurrence?  Or, is it happening all the time now?

                                      (The reason I am thinking roll over is because I didn't test that and I am not sure how I can... yet)

                                        • Re: How to get the Alert triggered duration
                                          Questionario

                                          it did go to the next day, yes...

                                          All alerts I checked today seemed to have this behaviour, I'll check tomorrow and see if alerts resetting on the same day work fine

                                          PS: i am on APM 4.0.2 and NPM v10.1.2

                                          • Re: How to get the Alert triggered duration
                                            Questionario

                                            it does not seem to be a rollover problem...

                                            we got this error for an alert that lasted 12minutes but not for an alert that rolled over...

                                            however an alert that lasted for more than 6weeks shows only the hours (6h42mins)

                                             

                                            whether it works or doesn't seems to be totally random for me

                                              • Re: How to get the Alert triggered duration
                                                netlogix

                                                hmm... ok, thats what it will do for a day roll over, thats something else to figure out how to fix.

                                                It is still working fine for me, it could be odd or unexpected format of the string in Time or Alert Trigger Time, or the result of the math
                                                For now, can you add this to an alert that is having the issue?
                                                Time: '${Time}'
                                                Converted: '${SQL:Select Convert(datetime,'${Time}')}'

                                                AlertTriggerTime: '${AlertTriggerTime}'
                                                Converted: '${SQL:Select Convert(datetime,'${AlertTriggerTime}')}'

                                                With Math: '${SQL:Select Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}')}'

                                                The only other thing I could think of is to create a stored procedure to do this, but I don't like putting stored procedures in a database ... (I don't know how to say it, designed/owned/supported/updated/managed/serviced by someone else - solarwinds)

                                                  • Re: How to get the Alert triggered duration
                                                    netlogix

                                                    Ok, here is what I have now: ${SQL:Select datediff(day, Convert(datetime,'${AlertTriggerTime}'),Convert(datetime,'${Time}'))} days and ${SQL:Select Convert(time,Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                    It's a bit ugly, but I can't think of a better way without some type of extensive "if then else" logic that I don't know how to get it working.  I was hoping I could just apply a better format to it by changing the "Convert(time" to something like "Convert(duration", but I can't find anything easy like that.

                                                    Questionario - Have you seen you more of the issue? any pattern?

                                                      • Re: How to get the Alert triggered duration
                                                        Questionario

                                                        no pattern but here is an example....

                                                        ---

                                                         

                                                        This alert was active for MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. days and MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.

                                                        This email was sent: 26/06/2011 01:27:42 .

                                                         

                                                        Testing variables:

                                                        Time: '13:27'

                                                        Converted: '01.01.1900 13:27:00'

                                                        AlertTriggerTime: '26.06.2011 12:09:05'

                                                        Converted: 'MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'

                                                        With Math: 'MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'

                                                        ---

                                                        The alarm text for this is

                                                        ---

                                                        This alert was active for ${SQL:Select datediff(day, Convert(datetime,'${AlertTriggerTime}'),Convert(datetime,'${Time}'))} days and ${SQL:Select Convert(time,Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}'))}
                                                        This email was sent: ${DD}/${MM}/${Year} ${HH}:${Minute}:${Second} ${AM/PM}.

                                                        Testing variables:
                                                        Time: '${Time}'
                                                        Converted: '${SQL:Select Convert(datetime,'${Time}')}'
                                                        AlertTriggerTime: '${AlertTriggerTime}'
                                                        Converted: '${SQL:Select Convert(datetime,'${AlertTriggerTime}')}'
                                                        With Math: '${SQL:Select Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}')}'

                                                        ---

                                                          • Re: How to get the Alert triggered duration
                                                            netlogix

                                                            That looks like it is having an issue with converting the date.  I think it is something to do with the difference in date format.  yours is dd.mm.yyyy, and mine is mm.dd.yyyy.  So I think your SQL server is complaining that it can't find a month 26.  There has to be a way to handle the difference in date format.  I will look into it, but if you or anybody else knows how to handle the date formatting, please chime in.

                                                              • Re: How to get the Alert triggered duration
                                                                Questionario

                                                                I certainly have no idea :-\

                                                                I wouldnt know why SQL would have a problem with it though... if it saves it in that format, it should be able to convert it as well....

                                                                 

                                                                the orion server and the sql server are running on the same machine btw.

                                                                  • Re: How to get the Alert triggered duration
                                                                    cdoyle

                                                                    "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."

                                                                     

                                                                    I've been able to correct this error in the past by changing the default database language for the SQL user account. Typically I've seen it when the database user is expecting the dd.mm.yyyy date format, but the application is expecting mm.dd.yyyy

                                                                    You can do this using SQL Server Management Studio

                                                                    - Open this tool and connect to your SQL server as SA.

                                                                    - Expand the Security folder

                                                                    - Expand the Logins folder

                                                                    - Locate the SolarwindsNPM user (or the user Orion is using to connect to the DB). Right click this user and go to Properties.

                                                                    - On the General page, towards the end, you will see a drop down menu next to "Default language". 

                                                                  • Re: How to get the Alert triggered duration
                                                                    Questionario

                                                                    Hi,

                                                                     

                                                                    I have modified it to work for our environment as follows:

                                                                    ---

                                                                    ${SQL:Select datediff(day, Convert(datetime,'${AlertTriggerTime}'),Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}'))} days and ${SQL:Select Convert(time,Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                    ---

                                                                    However if I change it from plain text to HTML, I get the following error:

                                                                    ---

                                                                    MACRO SQL ERROR - Unclosed quotation mark after the character string '8/17/2011 11:00:31 AM'.
                                                                    Incorrect syntax near '8/17/2011 11:00:31 AM'.'),Convert(datetime,'@{2011-08-17 11:00:31 AM'))} days and MACRO SQL ERROR - Unclosed quotation mark after the character string '2011'.
                                                                    Incorrect syntax near '2011'.-@{08-17 11:00:31 AM') - Convert(datetime,'8/17/2011 11:00:31 AM'))}

                                                                    ---

                                                                      • Re: How to get the Alert triggered duration
                                                                        Questionario

                                                                        Hi,

                                                                        I opened a ticket for this not working with HTML (Ticket#265369) and I have been given a workaround.

                                                                         

                                                                        So, in order to use this with plaintext emails in the alert reset action use this:

                                                                        ---

                                                                        This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                        ---

                                                                        For HTML emails use this:

                                                                        ---

                                                                        This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'$@Year@-$@MM@-$@DD@ $@HH@:$@Minute@:$@Second@ $@AM/PM@')-Convert(datetime,'$@AlertTriggerTime@'))))} days and ${SQL:Select Convert(time,Convert(datetime,'$@Year@-$@MM@-$@DD@ $@HH@:$@Minute@:$@Second@ $@AM/PM@') - Convert(datetime,'$@AlertTriggerTime@'))}

                                                                        ---

                                                                        This works great for me, the result looks something like this: "This alert was active for 1 days and 03:46:10"

                                                                  • Re: How to get the Alert triggered duration
                                                                    Questionario

                                                                    Hi netlogix,

                                                                    the string

                                                                    ${SQL:Select datediff(day, Convert(datetime,'${AlertTriggerTime}'),Convert(datetime,'${Year}-${MM}-${DD}  ${HH}:${Minute}:${Second} ${AM/PM}'))}

                                                                     

                                                                    seems to return the number of calendar days that have passed, therefore if an alarm goes off at 11pm and clears at 1am, it will return 1day and 2 hours while the alert was only active for 2 hours. you know how to get around this?

                                                                      • Re: How to get the Alert triggered duration
                                                                        netlogix

                                                                        I got an alert like that to and have been thinking about it.  I came up with this:

                                                                        ${SQL:Select Floor(Convert(float,(Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))}

                                                                        I also tested it up to 23:59:59 and it returned 0.  I had a different one that would return 1 after 12:00:00 (half day), but thats not what I want and would assume the same for you.

                                                                        Thanks for your help on this... we work together pretty well.

                                                                         

                                                                        *** I edited the SQL - I was missing a ")" at the end, there should be 4 not 3

                                                                          • Re: How to get the Alert triggered duration
                                                                            Questionario

                                                                            haha, my help? ;-)

                                                                            yes, we are a good team! you do the work and I steal the results! ;-)

                                                                            I will try this out and post again if this does not work, if it does work I will edit the answer of this thread accordingly :-)

                                                                              • Re: How to get the Alert triggered duration
                                                                                Dagash

                                                                                Good day!

                                                                                And does it works? Try to use all the version from ths topic, but they don't work with cause 

                                                                                 'MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'

                                                                                 

                                                                                I think my reason is the same, cause:

                                                                                 



                                                                                For now, can you add this to an alert that is having the issue? 

                                                                                Time: '${Time}'

                                                                                Converted: '${SQL:Select Convert(datetime,'${Time}')}'

                                                                                AlertTriggerTime: '${AlertTriggerTime}'

                                                                                Converted: '${SQL:Select Convert(datetime,'${AlertTriggerTime}')}'

                                                                                With Math: '${SQL:Select Convert(datetime,'${Time}') - Convert(datetime,'${AlertTriggerTime}')}'

                                                                                 



                                                                                 

                                                                                Time: '13:08'

                                                                                Converted: '01.01.1900 13:08:00'

                                                                                AlertTriggerTime: '22.11.2011 13:08:04'

                                                                                Converted: 'MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'

                                                                                With Math: 'MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'

                                                                                 

                                                                                I have try to

                                                                                 



                                                                                "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."

                                                                                 

                                                                                I've been able to correct this error in the past by changing the default database language for the SQL user account. Typically I've seen it when the database user is expecting the dd.mm.yyyy date format, but the application is expecting mm.dd.yyyy

                                                                                 

                                                                                You can do this using SQL Server Management Studio

                                                                                - Open this tool and connect to your SQL server as SA.

                                                                                - Expand the Security folder

                                                                                - Expand the Logins folder

                                                                                - Locate the SolarwindsNPM user (or the user Orion is using to connect to the DB). Right click this user and go to Properties.

                                                                                - On the General page, towards the end, you will see a drop down menu next to "Default language". 

                                                                                 



                                                                                 

                                                                                But it's don't help me too.

                                                                                  • Re: How to get the Alert triggered duration
                                                                                    Questionario

                                                                                    did you guys try what I marked as solution?

                                                                                    We use this and it works like a treat!

                                                                                    This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${Year}-${MM}-${DD} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                      • Re: How to get the Alert triggered duration
                                                                                        Dagash

                                                                                        Yes, of course. But did not work, therefore, decided to ask.

                                                                                        
                                                                                          
                                                                                        did you guys try what I marked as solution?
                                                                                        We use this and it works like a treat!
                                                                                        
                                                                                        This alert was active for MACRO SQL ERROR - Преобразование типа данных varchar в тип данных datetime привело к выходу значения за пределы диапазона.
                                                                                        days and MACRO SQL ERROR - Преобразование типа данных varchar в тип данных datetime привело к выходу значения за пределы диапазона.
                                                                                         
                                                                                        
                                                                                        
                                                                                        




                                                                                        Error began writing in Russian after the change the user of database language, but actually it's the only thing that has changed.
                                                                                        In translation it reads as

                                                                                        
                                                                                         MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value. 
                                                                                        days and MACRO SQL ERROR - The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.
                                                                                        
                                                                                        


                                                                                        This is sad.

                                                                                         

                                                                                        Update/

                                                                                        I'm sorry, i'm a stupid. 

                                                                                        You year.month.day date, but I day.month.year. Naturally swapping everything worked, badly hung up on one's head will not work.Thank you very much!

                                                                                        My version is 

                                                                                         

                                                                                        
                                                                                         This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${DD}-${MM}-${Year} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${DD}-${MM}-${Year} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}
                                                                                        
                                                                                        


                                                                                          • Re: How to get the Alert triggered duration
                                                                                            Questionario

                                                                                            do you use the 12h or 24h clock in russia?

                                                                                            Try the following for 12h format, if it doesn't work I'll look up the syntax for 24h format (I think its just ${Hour} instead of ${HH}:

                                                                                            This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                              • Re: How to get the Alert triggered duration
                                                                                                Dagash

                                                                                                Good day Questionario! 

                                                                                                We use 24H clock. I have already done the script for my needs, after reading your comment yesterday(Thank you that was taken out of torpor). For date like day.month.year and 24h clock it will be

                                                                                                 

                                                                                                
                                                                                                 This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${DD}.${MM}.${Year} ${Hour}:${Minute}:${Second}')
                                                                                                -Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${DD}.${MM}.${Year} ${Hour}:${Minute}:${Second}')
                                                                                                - Convert(datetime,'${AlertTriggerTime}'))}
                                                                                                
                                                                                                
                                                                                                 

                                                                                                 



                                                                                                I think its just ${Hour} instead of ${HH}:

                                                                                                 



                                                                                                You are right.

                                                                                                P.S. I test it only in "Alarm manager test", it's returns me 0 days and 00:00:00. Fortunately / unfortunately nothing is broke) Tomorrow i think i could give 100% answer. I will accomplish your goal here about the results.

                                                                                                  • Re: How to get the Alert triggered duration
                                                                                                    Questionario

                                                                                                    sounds like its working fine for you! :)

                                                                                                    Would you mind trying the original query and only change the time format but not the date format?

                                                                                                    Would be nice if we could find a query that works for everyone =)

                                                                                                      • Re: How to get the Alert triggered duration
                                                                                                        Dagash

                                                                                                        Yes, it works!

                                                                                                        But unfortunately / fortunately nothing broke so far, my conclusions are based on the test. but I am an optimist and believe thatwork should

                                                                                                         

                                                                                                         



                                                                                                        Would be nice if we could find a query that works for everyone =)

                                                                                                         



                                                                                                         

                                                                                                         

                                                                                                        But it has been done, actually turns out patterns for date formats:

                                                                                                         


                                                                                                        24 hours

                                                                                                         

                                                                                                        1. For month.day.year hour: minute: second

                                                                                                        ${SQL:Select Floor(Convert(float,(Convert(datetime,'${MM}.${DD}.${Year} ${HH}:${Minute}:${Second})-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${MM}.${DD}.${Year} ${HH}:${Minute}:${Second}) - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                                        2. For day.month.year hour: minute: second

                                                                                                        ${SQL:Select Floor(Convert(float,(Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second})-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second}) - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                                        12 Hours


                                                                                                        1. For day.month.year hour: minute: second

                                                                                                        ${SQL:Select Floor(Convert(float,(Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} 

                                                                                                        days and ${SQL:Select Convert(time,Convert(datetime,'${DD}.${MM}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}


                                                                                                        2. For month.day.year hour: minute: second

                                                                                                        ${SQL:Select Floor(Convert(float,(Convert(datetime,'${MM}.${DD}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}')-Convert(datetime,'${AlertTriggerTime}'))))} 

                                                                                                        days and ${SQL:Select Convert(time,Convert(datetime,'${MM}.${DD}.${Year} ${HH}:${Minute}:${Second} ${AM/PM}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                                         

                                                                                                        Thus in fact we need to change only to those requests:

                                                                                                        1.    Date

                                                                                                          ${MM}.${DD}.${Year} there if you change the order of them, You change form of parsing  

                                                                                                        2.    Time

                                                                                                           ${Hour}:${Minute}:${Second}for 24H  or ${HH}:${Minute}:${Second} ${AM/PM} for 12H, 

                                                                                                         there if you change the order of them, You change form of parsing  

                                                                                                         

                                                                                                        the presentation as I understand it (correct me if I'm wrong) is taken from the locale of the system or the user's locale database.

                                                                                                        I try it for plaint text.



                                                                                                        In fact, would be great if someone will check their work for the rest of regimes, as I'm going on vacation and all the free time to closethe case.

                                                                                                        If it's working, it was a good conversation, if not, I will be happy to pick on together.

                                                                                                          • Re: How to get the Alert triggered duration
                                                                                                            Questionario

                                                                                                            What I ment was to try the following:

                                                                                                            This alert was active for ${SQL:Select Floor(Convert(float,(Convert(datetime,'${Year}-${MM}-${DD} ${Hour}:${Minute}:${Second}')-Convert(datetime,'${AlertTriggerTime}'))))} days and ${SQL:Select Convert(time,Convert(datetime,'${Year}-${MM}-${DD} ${Hour}:${Minute}:${Second}') - Convert(datetime,'${AlertTriggerTime}'))}

                                                                                                            Because when I wrote this, I read that YEAR-MONTH-DAY cannot be misinterpreted and I just assumed that 12h time format would also work for everyone...

                                                                                                            If the query above would work for you I think it should work for everyone (hopefully) or at least there will be only 2 queries to choose from, 12h and 24h time format.

                                                                    • Re: How to get the Alert triggered duration
                                                                      dwskinner

                                                                      We have made a new SQL script to find the alert duration to give us the time in {days hours minutes} form and all testing have worked. We are using NPM 11.5.3 and SAM 6.2.3

                                                                       

                                                                      Object was down for ${SQL:Select '${N=Alerting;M=Downtime}'/1440} Days ${SQL: Select '${N=Alerting;M=Downtime}'%1440/60} Hours ${SQL: Select '${N=Alerting;M=Downtime}'%1440%60;} Minutes 

                                                                       

                                                                      I hope this helps others with the alert duration problem