Skip to main content
Skip table of contents

Message formats for Analytics workers

When launched, an Analytics worker connects to three channels:

  • A Statistics channel, which is used for sending its statuses (memory, CPU, etc.).

  • A Raw-events channel, which is used for sending of the generated events.

  • A Management channel, which is used as a means of receiving tasks for processing. A channels name is formed as <analytics type.uid>.

Statistics

A worker sends two types of messages to the Statistics channel:

  • Statistics on the resources used by the server that hosts the worker. This message is sent every four minutes. The message has the following format:

CODE
{
    "channel": "stats", // the channel name in push1st
    "data": {
        "cpu": {
          "cpu_count": 8,
          "cpu_loadavg_percent_15min": 12.5,
          "cpu_loadavg_percent_1min": 12.5,
          "cpu_loadavg_percent_5min": 12.5,
        }
        "memory": {
          "total_memory": 8342810624,
          "available_memory": 7360401408,
          "used_memory": 663388160,
          "used_percent_memory": 11.8
        }
        ipaddress: "192.168.205.151"
    }
}
  • Information on the cases state that are currently in progress on the worker. The message has the following format:

CODE
{
    "channel": "stats", // the channel name in the push1st
    "data": {
        "ovmsUid": "a6e862d2-c6ea-11ec-88bc-59d920260ee8", // uid of the analytics worker
        "streams": {  // a block with the case states description that are in progress on the current analytics worker
            "3d1a7e78-2458-11ed-9b5d-21123bef9093": {  // a case identifier 
                "frameProcessRate": 5.128205,  // a number of frames processed per second
                "starttime": 1663023697,  // the case start time on the analytics worker
                "status": "up",  // current status (which can be up,down,stopped)
                "streamUid": "ebb04683-8d33-4a94-8aac-c9ea9c6b45db", // a stream identifier
                "uptime": 120344  // continuous operation time of the case on the current analytics worker
            },
            "streamsCount": 1  // total number of cases on the analytics worker
        }
    },
    "event": "stats"
}

Events

When an event is identified, the Analytics worker sends a corresponding message to the Raw-events channel. A message format may differ depending on the analytics type. The general message format is as following:

CODE
{
    "channel": "raw-events", // the channel name in the push1st
    "data": {
        "AnalyticsType": "motion-detect", // an analytics type
        "CameraGroupUid": "3f3348a9-ae87-4902-947f-725fd25751e3",  // an identifier of a camera group 
        "JobUid": "beddb758-303e-11ed-8c49-bd223ebfa82e", //a unique identifier of an analytics case
        "StreamUid": "470b1c5e-748f-49a4-91e5-62f7ac53b8eb",  // a unique identifier of a video srteam
        "apiPort": "8086", // a port for the analytics worker API 
        "ovmsClientUid": "f45d2b96-9adb-11ec-8995-a3b0e5228375", // a unique identifier of the analytics worker
        "ovmsClientHostIp": "10.244.112.212" // the address of the worker that generated an event
        "timestampMs": 1663145196202, // time of an event generation  
        "eventFrameUrl": "/store/95064324-abc5-11ee-8c4f-b5c3d514a8ed/20240122/46707ff2-6505-4fb9-bed9-05a726af12df.jpg", // a link to an image of an event 
        .... // next, data related to a specific analytics case can be transferred
    },
    "event": "event"
}

The Management channel

The Management channel is used to transfer a case for processing to the Analytics worker. The channel name is formed as <analytics type.uid>.

CODE
{
   "name":"stream_event",
   "channels":[
      "face-recognition.cc71f36e-14c5-11ed-9bd9-bb5c75b9991b"
   ],
   "data":{
      "type":"job_create",  // a command for the analytics worker, which can be job_create, job_update, job_delete
      "data":{
         "CaseType":"face-recognition",  // an analytics type
         "CameraGroupUid":"be8ba3dd-419f-4a8b-93ab-907b58a7c063",// an identifier of a camera group
         "Source":{  // information on a video stream for analytics 
            "Uid":"8d1267c7-554a-4481-856c-4efb8c518d7d",
            "Url":"rtsp://demo.<vms>.io:5554/live/8d1267c7-554a-4481-856c-4efb8c518d7d/?token=F2v53E_ZDg_zXSswjSU2GF5rfhFpWnN7V_4_vbiuryeLLm7rcR3-H6jJwtI2e-5eelwpTSaoDAQ9oncDmGeOF1N_5MVuLJcJxdrUK8TILKAam7Es1Bg7gGEezzfhCDLTIu_f5M1R6oQkfyL5i1XA_A~~",
            "Output":{
               "Encoding":"none",
               "FPS":5
            }
         },
         "JobUid":"16a7dfd4-14bc-11ed-9bd9-bb5c75b9991b"  // identifier of an analytics case 
         .... //  next, data related to a specific analytics case can be transferred here
      }
   }
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.