Get camera name in the plugin (not in the DeviceAgent constructor)
AnsweredI want to get name of the camera periodically.
It seems like I can't do it with nx::sdk::IDeviceInfo since I get segfault if I save it and try to use it.
Is it possible only with HTTP API?
-
What is the scenario that you are trying to solve?
Are you able to copy the name as a string from in the constructor and store the new string inside the DeviceAgent?
0 -
I want to send a new camera name to my cloud service when it was changed.
Ideally I want to execute code only when it was changed but I don't see such callbacks, therefore I take this name every N seconds.0 -
Do you want to execute this code in your cloud service or on the plugin side?
Ideally I want to execute code only when it was changed but I don't see such callbacks
Renaming cameras doesn't seem like something that can be done often. Do you want this so you can display correct camera name if it was changed at your cloud service or for something else?
therefore I take this name every N seconds.
Right now, using HTTP API is the only way to do it.
0 -
>Renaming cameras doesn't seem like something that can be done often. Do you want this so you can display correct camera name if it was changed at your cloud service or for something else?
Yes, I just take camera names from the Nx and I want to keep them syncrhonized.
>Do you want to execute this code in your cloud service or on the plugin side?
On the plugin side. I meant that I want to send name of the camera to my cloud when user rename the camera in Nx.>Right now, using HTTP API is the only way to do it.
Thanks, it works.0 -
In addition to said, there could be another possible solution.
Since the cloud is yours, you could implement sync routine there.1. Connect your System to the Nx cloud.
2. In your cloud, utilize Nx Cloud API for periodically collecting data on cameras in the System and detecting renames and other changes.
Please, see this article for more details
https://support.networkoptix.com/hc/en-us/articles/360016266074-Cloud-API-Route-API-Calls-via-Nx-Cloud0 -
Hello Andrey,
I've been using HTTP API for a while, and now I noticed that it uses a lot of resources.
Here is an example:The first graph shows the system monitoring while I'm polling HTTP Api every ten seconds. The second one shows the system without regular polling initially, and then I start to send queries every second.
There is no such problem with the cloud, thanks. However, it's strange that I can't simply get the camera name without connecting the system to the cloud or consuming too many resources. Is there a plan to improve it?
0 -
Hendrik Baekeland
hi!
what API call do you use?0 -
Hello, Tagir,
Thanks for answering,
I've tried both /ec2/getCamerasEx/?id=<some_id> and /ec2/getCameraUserAttributesList/?id=<some_id>0 -
do you request it N times (once for each camera)? That might be the issue, maybe requesting full list once and then parsing it on your side will cause less load on the system.
Also, we have lighter version of it, ec2/getCameras, but it's proprietary.
In 5.0 we have a new API for this, so we encourage you to check it and adapt your integration. You can find the latest version here https://meta.nxvms.com/downloads/patches
0 -
Also, as I understand, excessive resource consumption happens only when you call it from the plugin, right?
probably it's not a server issue, as it does not consume that much resources when you do it not from the plugin, but from the external service (via Cloud or simply doing direct HTTP request to the server)0 -
>Also, as I understand, excessive resource consumption happens only when you call it from the plugin, right?
No, It doesn't matter how to call it. For example, I used a script with curl in the second scenario (the second graph).>do you request it N times (once for each camera)? That might be the issue, maybe requesting full list once and then parsing it on your side will cause less load on the system.
I'm polling the name of one camera in the first graph, so there are not so many queries. But yes, I have one worker per camera. Batching is a good idea, thanks.>In 5.0 we have a new API for this, so we encourage you to check it and adapt your integration.
Could you please clarify what I should look for?If it helps to work on this issue, I'm running all of this on the Jetson Nx.
0 -
Could you describe your setup in more detail, please?
How many cameras do you have connected to the Server? Do you invoke API directly on the Server or vie the cloud? Can you share your code, please?
0 -
While Andrey Terentyev will be helping you with a particular load issue, here is the link for our 5.0 versions: https://meta.nxvms.com/downloads/patches
0 -
Hello Andrey,
I'm not sure there is an easy way to give you the sources.
You can reproduce the behavior from the second graph with a simple one-line script:
while true; do curl --insecure -X GET 'https://admin:password@localhost:7001/ec2/getCamerasEx?id=<camera_id>'; sleep 1; done
It's enough to poll every second to increase its CPU usage up to 60%.
I run it on the Jetson + DW Server 4.2.0 -
Thanks, Tagir
0 -
Hello Hendrick,
I'm not sure there is an easy way to give you the sources.
Usually, a link to the google drive or similar is ok.
It's enough to poll every second to increase its CPU usage up to 60%.
I confirm the significant CPU usage increase. Our developers reported there is a bug, seems has been fixed and currently in review, in the processing API requests. I'll update here when I check it.
JIRA-VMS-30000
0 -
Thanks for the confirmation, Andrey
0 -
Hendrick,
Here is a workaround.
Force header with "Connection: close". CPU load does not increase much in this case.
while true; do curl --insecure -H "Connection: close" -X GET 'https://admin:password@localhost:7001/ec2/getCamerasEx?id=<camera id>'; sleep 1; done
0 -
Hello, Andrey,
It helped, thank you.0
Please sign in to leave a comment.
Comments
19 comments