Camera Tag when using API

Answered

Comments

8 comments

  • Avatar
    Anton Babinov

    Hello Matthew,

    the "Camera disconnected" event does not provide attribute values that would be accessible via {event.source} in the "Do HTTP request" action so the only option would be is to create an individual rule for each camera. It may generate a lot of rules which would make the system difficult to support in the future.

    You can use our API call /ec2/saveEventRule to generate rules for each camera, so you wouldn't have to do it manually.

    As an alternative approach, you can execute API call /ec2/getCamerasEx to VMS every minute to get the list of all cameras in VMS. API response will include all possible information about each camera and you can look for the value “offline” in “status” field to detect disconnected cameras:

    {
          ...

    "status":"Offline",

    "statusFlags":"CSF_NoFlags",

    "typeId":"{6ae785e6-b7d2-832a-a6a0-6072f796d6af}",

    "url":"http://192.168.1.48:80/",

          ...
    }
    0
    Comment actions Permalink
  • Avatar
    Matthew Fox

    Thanks, that was helpful.  We are know running into an issue of mapping a camera to a specific port on a switch.  I was hoping to use the camera name, but found duplicates across several sites so that wont work.  We like the idea of using the Camera ID, but we will have over a thousand devices so the 3 digits won't work... Can we create other custom fields? Any thoughts or ideas?

    0
    Comment actions Permalink
  • Avatar
    Anton Babinov

    >We like the idea of using the Camera ID, but we will have over a thousand devices so the 3 digits won't work... Can we create other custom fields? Any thoughts or ideas?

    Do you mean Logical ID which can be assigned at the expert tab? For your case, you can use the actual CameraID value, which is unique for each camera and is being assigned by VMS. Here is an example of CameraID value - "0ce6db71-2a66-94c4-2774-85f79ff85a1f". You can find the CameraID either in the Camera Settings Dialog or by calling http://<serverIPaddress>:<port>/ec2/getCamerasEx API call(look for ”id" JSON key)

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi,

    > We are know running into an issue of mapping a camera to a specific port on a switch.
    > Any thoughts or ideas?

    I'd like to share several considerations on how to arrange a solution.

    1. It would be a good practice to manipulate network device settings not from the VMS server, but rather from Network Management/Monitoring System, because usually it has access to the management network(s).
    In this case VMS should notify (for example with "Do HTTP Action") the NMS on an event. For example, "Camera disconnected"
    On this notification NMS actually manipulates settings on a device indicated by notification by executing predefined actions.

    1.1. You can predefine somewhere a static table
    cameraId <-> network device:port using the method Anton has explained.

    1.2. In this case the "Do HTTP request" action would send a cameraId to the NMS.
    1.3. NMS runs a script, which looks up the "cameraId <-> network device:port" statics table and toggles the corresponding port.

    There is another way.
    2.  You can avoid defining a dedicated static table, because you already have one in your switches and in the NMS database.
    MAC address <-> Switch port.
    2.1. In this case "Do HTTP Action" would send a cameras' MAC address in the notification to the NMS.
    Since NMS monitors the network it knows the topology and periodically updates it (most modern NMS are capable of it), i.e. which network host is connected to which network device.
    2.2. Your NMS reacts to the notification with predefined action (if it has such a function), i.e. toggles a corresponding port on a switch.
    2.3 OR Your NMS reacts to the notification with running a script, which queries NMS, determines the switch and the port of the disconnected camera and toggles the port.

    0
    Comment actions Permalink
  • Avatar
    Norman - Nx Support

    Hi Matthew Fox,

    We have not heard back from you in a while, so we are going to assume your question has been answered and set this topic to 'Answered'.

    0
    Comment actions Permalink
  • Avatar
    Matthew Fox

    Thanks for all the info, A quick follow up.  If the VMS is on a locked down network, meaning we can not access the VMS through the 7001 port due to network restrictions (firewall), but can through sync (or connect), is there a way to use the api also using the sync (or Connect) to connect to a server?  

    0
    Comment actions Permalink
  • Avatar
    Norman - Nx Support

    Hi Matthew Fox,

    You can use the Nx Cloud relay to execute API call, but not directly to a 3rd party application. 
    See THIS support article. 

    So if you want to send an API command to the switch, assuming it is in the same LAN as the Nx server, you send a generic event to the Nx Server and then a Do HTTP request as the action in the rules engine to send an API call to the switch.  

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello Matthew,

    > but can through sync (or connect), is there a way to use the api also using the sync (or Connect) to connect to a server?

    I'm afraid I don't understand what do you mean.

    If the firewall blocks the 7001 port, you can try changing Server's port:

    Linux: /opt/networkoptix/mediaserver/etc/mediaserver.conf

    Windows: HKEY_LOCAL_MACHINE\SOFTWARE\Network Optix\Network Optix Media Server\

    For future. Your last question is not actually following up, but rather opening a new topic. It is better to create a separate request in such cases. Thank you for understanding.

     

    0
    Comment actions Permalink

Please sign in to leave a comment.