Any way to include the *source* when Soft Trigger -> Do HTTP Request? Any variables for the HTTP

Answered

Comments

11 comments

  • Avatar
    Andrey Terentyev

    Hello Luke,

    There are no variables (aka placeholders) available for the "Soft Trigger" event.
    Only for "Generic Event" and "Analytics Event".
    For more details see the "Working with Nx Witness > Event Rules > Available Actions > Do HTTP Request" section of the built-in help.

    0
    Comment actions Permalink
  • Avatar
    Luke McFadden

    @andrey

    That’s disappointing to hear. It seems like that could be such a power addition in utilizing external services. Is there a particular reason why at least the event.cameraId is not available?

    0
    Comment actions Permalink
  • Avatar
    Luke McFadden

    I could use this Soft Trigger to make an external request, which would then search through event logs and pull out the source name.... but with multiple servers and locations, this could get quite complex.

    My goal is to use a Soft Trigger to create an open ticket.  All I need in the content is the camera name.  But with 150+ cameras, and soon to be 400+ in Nx, this doesn't scale well.

    If I had the camera name, it would be a two step process for my to script out to create a new ticket vs. searching the event logs which would be 10-20, with reliability issues since the server could be offline whenever the script checks.

    0
    Comment actions Permalink
  • Avatar
    Tagir Gadelshin

    Luke McFadden

    Thanks for the feedback!
    There is only one reason -- we hadn't developed it yet.
    We are planning to include this in our event rules engine, as soon as our rules engine refactoring is finished. In the future, you will be able to include different event parameters in different action fields. We see a lot of use cases where it will be beneficial.

    {device.name} is one of the first ones we are thinking of. Also, {device.ip}, {event.time} and so on

    (internal) jira:VMS-11899

    0
    Comment actions Permalink
  • Avatar
    Luke McFadden

    @Tagir

    Is there a loose eta on the new event engine?

    Device.Id would be helpful as well for subsequent API calls.

    As well as Name and ID for the server and system.

    0
    Comment actions Permalink
  • Avatar
    Tagir Gadelshin

    Luke McFadden
    unfortunately, we are postponing this feature due to lots of testing coverage and test scenarios that it has. Event rules touch almost all parts of the software.

    I can only say that our next release (4.3) won't have this. I know that it's kinda disappointing, but we try to deliver a high-quality product and that requires quite a time for developing and testing every aspect.

    don't get me wrong: we are developing it, and we don't put it away as "Future plans".

    0
    Comment actions Permalink
  • Avatar
    Luke McFadden

    Tagir, so, is that potentially 6 months? 2 years?

    0
    Comment actions Permalink
  • Avatar
    Tagir Gadelshin

    Luke McFadden my best guess 4.3 (that won't have this) will become available in a year or so. Any other estimates will be pure speculation, unfortunately.

    0
    Comment actions Permalink
  • Avatar
    Luke McFadden

    Tagir Gadelshin. I'm using the Send Email as a workaround, and that's going alright.  Is there any way to modify the template that it is using?  Using a Soft Trigger with Send Email is including the camera name (and IP), but it would be great to get a bit more specific information that I can parse for creating tickets.  Is there a server file that sets the email specifics?

     

    0
    Comment actions Permalink
  • Avatar
    Tagir Gadelshin

    Luke McFadden
    Can you elaborate, what do you need, what is this info? As I described in other posts, we plan to improve our Event Rules engine and enhance it with the ability to use event parameters in actions. So you will be able to customize the contents of email (or any other actions) via Event Rule. Would that solve the problem?

    As of now, there is no such option as modifying the email template. Email contents are generated by the server and they are hard-coded, with no configuration options at this point. Maybe only the email webpage itself may be tweaked somehow, but not in terms of adding new variables.

    Also, one idea that I have: you can use a script, that will create one rule per camera and in the Send HTTP request part it will send the camera id in HTTP content section to your external service. The camera id then can be used to pull the data about this camera via API. Not scalable and not the best solution, I agree. It requires creating a rule each time camera is added or replaced, but still, worth mentioning.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi Luke,

    My goal is to use a Soft Trigger to create an open ticket. All I need in the content is the camera name. But with 150+ cameras, and soon to be 400+ in Nx, this doesn't scale well.

    I agree, it would be nice to create one rule for processing Soft Trigger event on all cameras. As you see, at the moment it's not possible.

    But there is an automated solution for configuring large number of cameras.

    You could create a script that would create per camera a  "Soft Trigger" rule with Do HTTPS request action containing camera name either in the URL or in the request body.

    Here is a script outline.

    1. Use the /ec2/getCamerasEx API to get camera list and attributes you need (name, id)

    2. Use the /ec2/getEventRules API to get all the existing event rules.

    3. For each camera iterate through the list of rules.

    3.1. If a rule exists for a camera just go to the next camera == if the "Comments" field of a rule contains a tag.

    When creating a rule, you can mark it with special symbols (a tag) in the "Comments" field and search for the tag at this step.

    3.2. If the is no rule for a camera, generate JSON object for a rule and append the object to the list of rules to be created.

     An example of JSON  object can be seen in an item of the array returned by GET /ec2/getEventRules.

    4. Pass the list of rules to be created to the /ec2/saveEventRule API.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.