• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Custom Event Messaging

    User help
    4
    8
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      Wingnut2.0
      last edited by

      I have a data point with a string for a value that represents an alarm message from another system. To get notification in Mango Events I added an Event Detector which is working as planned. The Message that appears in list of events seems to come from the Alias of the Change Detector.
      The question I have is can this Event Message be changed to use the value of the data point instead of the alias of the Event Detector?

      Thank you

      1 Reply Last reply Reply Quote 0
      • JoelHaggarJ
        JoelHaggar
        last edited by

        have you tried leaving the Alias blank? If it's blank, Mango will auto-generate an event message that might be closer to what you want.

        1 Reply Last reply Reply Quote 0
        • phildunlapP
          phildunlap
          last edited by phildunlap

          Hi Wingnut2.0,

          Generally the answer is probably no. As Joel suggested you could remove the alias and see if that's closer to the message you are looking for, but the only way I can think of to easily do what you're describing would be to have an set point event handler set a virtual alphanumeric point with a change detector to the string you would like reported on the events page. Then you can turn the log level of the original event down, and the change events for the alphanumeric point will be the interesting things in the events list.

          But, that would have the disadvantage of not returning to normal and whatnot (if you use the same alphanumeric point to pump out other alarm messages too. If not, you could use a regex detector of .+ and set the alphanumeric point back to "" with the inactive action of the first event but it would have to be a one to one mapping.

          1 Reply Last reply Reply Quote 0
          • W
            Wingnut2.0
            last edited by

            Thank you, Joel. It’s certainly closer, but I was wondering if there is a way to possibly parse the incoming notification (datapoint.value) via a script and have the result passed to the event notification?

            1 Reply Last reply Reply Quote 0
            • phildunlapP
              phildunlap
              last edited by phildunlap

              Ah, I have a perhaps better solution:

              Create an SQL data source with credentials to the Mango database, then create a point that updates tables only with SQL like the following,

              update events set message=? where id=(select id from events where typeName='DATA_POINT' and typeRef1=? and typeRef2=? order by id desc limit 1);
              

              and parameters like,

              1. String
              2. Integer
              3. Integer

              then create a set point handler from the event in question to this SQL point, and add the original point that raised the event into the set point hander's script context. Our script will look like,

              return "('common.default|Point value changed to " + p.value + "|'," +
                event.getReferenceId1() + "," + event.getReferenceId2() + ")";
              

              'common.default' is a translation key for literals. The format of the message column appears to be messageKey|arg1|arg2|arg3|...| so I'm setting the message to "Point value changed to " + p.value in this example.

              If necessary, I can demonstrate it with the script on the email handler, then you could also set the subject line from there and it'll all be consistent (if you're emailing it too).

              1 Reply Last reply Reply Quote 0
              • W
                Wingnut2.0
                last edited by

                Works perfectly. Thank you.

                1 Reply Last reply Reply Quote 0
                • G
                  glamprecht
                  last edited by

                  I have a similar requirement in the event detectors. I would like to pass the point value that triggered the event detector the the process (in my case a bash script on a linux server) I can trigger the bash script with parameters, but I cannot give it the point value as a parameter. Is this at all possible? Event detectors seems to be the best way to do server side stuff such as running rsync to a remote device.

                  1 Reply Last reply Reply Quote 0
                  • phildunlapP
                    phildunlap
                    last edited by

                    Hi glamprecht,

                    Generally it is better to ask a new question in a new thread and link to the old thread that you think it may be related to. That way it has a specific title and whatnot.

                    Anyway, I would use a set point handler to solve that. You would have the option of setting your command to an alphanumeric SSH data point or mimicking the process handler's job by calling,

                    // point that raised event is in context as p
                    com.serotonin.m2m2.rt.maint.work.ProcessWorkItem.executeProcessCommand("myprogram " + p.value, 39 /* process timeout */);
                    return UNCHANGED;
                    
                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post