Any way to include the *source* when Soft Trigger -> Do HTTP Request? Any variables for the HTTP
In ProgressThe Soft Trigger -> HTTP Request seems great. But I'm not able to find any documentation for if we can use server/camera data or variables to dynamically build the JSON payload? The event log shows the source camera when the Soft Trigger happens, but I'm not sure the formatting to reference that in the HTTP content section.
-
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.
-
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 -
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". -
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.
-
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?
-
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. -
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.
-
A variable with the logged in user would be great. We want to use it for opening doors/gates shown on the camera, but kinda need who requested it to be logged. If it could be sent through with the request then it would be logged in our access control system (instead of the gate being opened by "NX Witness" it would be opened by a specific person).
I see there's a log of when the rule is activated, but the only place I could see that logged a user was in the audit log when the rule was changed.
-
Hello Andrew,
A variable with the logged in user would be great.
Thanks for the idea.
Meanwhile, here is a possible solution.
Each rule has the "Available to" setting. By configuring that, you can differentiate users to whom the rule (and the trigger) is visible.
By putting a tag in the "Comments" field, you could find the specific rule in the log files. See a screenshot attached.
-
Tagir Gadelshin and Andrey Terentyev Any update on device variables for soft triggers with the Do HTTP Request? It's very painful trying to create automations around the text that comes from "Send an Email"
Ideally I'd be able to build out JSON for the Do HTTP Request that would capture the device details from the soft trigger.
device.namedevice.ip
device.uuid
device.mac
server.id
server.name
system.id
system.name
We're trying to build out an automation to create DHCP reservations / address names on our Firewalls. This would be quick and easy if we had some device variables made available to the Soft Trigger.
-
Hi,
First of all, let me clarify something in order you don't mislead yourself.
All the placeholders are related to an Event, not to an Action.
At the moment, there are two types of events having placeholders filled on event: Analytics event, Generic event.
That means the "Do HTTP Request" action can have placeholders in its parameters filled ONLY if it's caused by an event of the type mentioned above.
Unfortunately, there is no new placeholder added to the existing event types.
We're trying to build out an automation to create DHCP reservations / address names on our Firewalls. This would be quick and easy if we had some device variables made available to the Soft Trigger.
Of course, I don't know all the details, but here is what occurs to my mind.
You could use a Generic Event and the {event.source} placeholder to pass device/camera id to the HTTP request, which would be accepted by your web service. The web service could further request all the necessary device information via Server API. /rest/v1/devices, for example.So, the workflow could be something like:
Soft Trigger -> Generic Event -> Do HTTP Request -> web service. requests info via API->Manipulates DHCP/Firewalls.
-
Thanks for the reply Andrey Terentyev
I understand your logic, but can you explain how I'd cause a Soft Trigger to trigger the Generic Event?
Meaning, what is the specific configuration of the Soft Trigger to result in allowing the Generic Event -> Do HTTP Request to send the Camera ID into my webhook for further processing via API?
Would it have to be Soft Trigger -> Do HTTP Request to /api/createEvent ? And if so, how would I pass in the camera ID to the request... if the ID is not available as a parameter/variable in Soft Trigger?
Thanks for the clarity.
-
Hello,
Would it have to be Soft Trigger -> Do HTTP Request to /api/createEvent ?
Yes, exactly.
And if so, how would I pass in the camera ID to the request... if the ID is not available as a parameter/variable in Soft Trigger?
When configuring a rule, you bind the soft trigger to a camera by defining "At". Since you know the specific camera, you can specify its ID in the "Do HTTP Request" action of the soft trigger, namely in the "source" for the /api/createEvent API.
Massive creation of rules per camera can be easily automated via API with a script.
-
I see, but if I'm doing this, I could just automate adding the camera ID to the request in the Soft Trigger and completely avoid the generic event.
This would be *wildly* easier to maintain if there was *any* sort of variable available for the Soft Trigger. I'm perplexed why a soft trigger that is displayed on a camera, can't reference a variable for that camera.
This seems key to easier automation/integrations.
-
Hey Andrey Terentyev, any update on new placeholders with the newest 5.0 releases? I'm not sure if this conversation is pre or post 5.0.
I think what I'm trying to do is inline with what Luke McFadden is looking for: More placeholders that have context of where the original Event came from. So if you do "Camera disconnected" then the Camera ID, server ID, etc. are available to pass into the HTTP request.
For my case I'm looking for any issues with the camera system to essentially send a webhook to an external app, so the external app can log the issue, send emails, notify users in that app, etc.
It seems not even the cloudSystemID is in the headers of the HTTP request, so if Nx Witness makes a call to an external app it can't even be identified what system it came from.
It seems you want a Soft trigger to make an HTTP request to itself, then that Generic Event makes an HTTP request to an external app, but like you say the Soft trigger doesn't have any placeholder values so it sounds like you want to make 500 rules for all 500 cameras? Even if we use a script to make these it doesn't scale at all if we are doing multiple Events per camera...
I'm still reading through docs and more posts here so apologies if I'm missing something, but that's kind of the idea I'm getting right now...hopefully this doesn't derail this thread but it sounds like a similar request. Thank you!
Please sign in to leave a comment.
Comments
20 comments