Skip to main content
Skip table of contents

Получение медиасерверов

Получение медиасерверов

Получение главного и вторичного медиасерверов для трансфера потока. В случае, если поток заведен только на 1 медиасервер (без резервирования), то в ответе не будет вторичных медиасерверов

CODE
Если поток заведен без резервирования потока (на один медиасервер), то его можно завести с резервированием при выборе определённого кластера (параметр cluster_id).
Если кластер не был выбран, то будет происходить поиск медиасервера, который не состоит в кластере.

Если поток заведён с резервированием (на два медиасервера), то будет происходить поиск медиасервера, который находится в кластере. Поиск будет осуществляться с учитыванием группы медиасервера, которая выбрана или не выбрана на камере.

В рамках трансфера можно перенести поток на кластер вне группы камеры, выбрав вручную кластер, на который сделать трансфер, но при этом группа с камеры никуда не пропадёт.

Про алгоритм поиска доступных серверов см. Поиск доступного медиасервера

Про алгоритм работы группы медиасерверов см. Создание группы Медиасервера

GET /api/admin/v1/cameras/{camera}/stream/{stream}/transfer/servers

Параметры метода

int camera, уникальный идентификатор камеры


int stream, уникальный идентификатор потока


integer cluster_id, id кластера медиасерверов, в который необходимо перенести поток

200 OK

Успешный ответ

JSON
{
    "stream": {
        "id": 790,
        "type": "high",
        "camera_id": 769,
        "status": "active",
        "url": "rtsp://mediaserver1.vms.local:5554/live/b15f7ce5-0b6d-4983-afdd-c0df7233d5d5/",
        "bitrate": 3396,
        "resolution": "2048x1536",
        "output_rate": 0,
        "ip": "mediaserver1.vms.local",
        "uuid": "e69ac611-5602-438e-a4d1-a344f9730884",
        "sound": "tracks-v1",
        "streams_count": 0,
        "server": {
            "id": 3,
            "type": "media_server_v2",
            "schema": "https",
            "domain": "labMS5.vms.local",
            "internal": "8080",
            "external": "8443",
            "m4f": "8443",
            "rtsp": "5554",
            "publish": "7554",
            "traffic_in": 7521,
            "traffic_out": 0,
            "status": 1,
            "is_enabled": 0,
            "is_main": 0,
            "has_cache": 0,
            "proxy": ".vms.local",
            "created_at": "2021-05-27 16:15:02",
            "updated_at": "2022-06-23 11:47:02",
            "group_type": "all",
            "can_delete": false,
            "streams_limit": 1000,
            "bitrate_limit": 60000,
            "extra": {
                "io": {
                    "read_rate": 0,
                    "read_bytes": 0,
                    "write_rate": 0,
                    "write_bytes": 0
                },
                "cpu": {
                    "total": 4,
                    "usage": 5,
                    "stime_sec": 20824,
                    "utime_sec": 20824
                },
                "mem": {
                    "rss": 552714240,
                    "share": 9740288,
                    "usage": 2524610560
                },
                "net": {
                    "in_bitrate": 7701504,
                    "out_bitrate": 0
                },
                "drives": {
                    "/": {
                        "fs": "ext4",
                        "mount": "/",
                        "inode_free": 1479657,
                        "inode_total": 1605632,
                        "capacity_free": 19082600448,
                        "capacity_total": 25759584256
                    },
                    "/boot": {
                        "fs": "ext4",
                        "mount": "/boot",
                        "inode_free": 65220,
                        "inode_total": 65536,
                        "capacity_free": 806678528,
                        "capacity_total": 1023303680
                    },
                    "/storage": {
                        "fs": "ext4",
                        "mount": "/storage",
                        "inode_free": 32750059,
                        "inode_total": 32768000,
                        "capacity_free": 100222844928,
                        "capacity_total": 527371075584
                    }
                },
                "server": {
                    "ip4": "192.168.200.17",
                    "name": "MS-21.03-lts",
                    "build": "44ce34f",
                    "uptime": 598678,
                    "startat": 1655375344,
                    "version": "21.03",
                    "hostname": "labMS5.vms.local",
                    "revision": "lts",
                    "timestamp": "20220616091725"
                },
                "cluster": {
                    "id": "2",
                    "node": "5",
                    "enable": "true",
                    "hostname": "labMS5.vms.local"
                },
                "license": {
                    "own": "Vms",
                    "type": "enterprise",
                    "issued": 1687510022
                },
                "streams": {
                    "total": 36,
                    "active": 10,
                    "clients": 0
                },
                "storages": {
                    "/storage": {
                        "fs": "",
                        "err": 0,
                        "name": "default",
                        "mount": "/storage",
                        "inode_free": 32750059,
                        "inode_total": 32768000,
                        "capacity_free": 100222844928,
                        "capacity_total": 527371075584
                    }
                }
            }
        },
        "sub_servers": [
            {
                "id": 4,
                "type": "media_server_v2",
                "schema": "https",
                "domain": "labMS6.vms.local",
                "internal": "8080",
                "external": "8443",
                "m4f": "8443",
                "rtsp": "5554",
                "publish": "7554",
                "traffic_in": 11097,
                "traffic_out": 74437,
                "status": 1,
                "is_enabled": 1,
                "is_main": 0,
                "has_cache": 0,
                "proxy": ".vms.local",
                "created_at": "2021-05-27 16:15:44",
                "updated_at": "2022-06-23 11:47:02",
                "group_type": "all",
                "can_delete": false,
                "streams_limit": 1000,
                "bitrate_limit": 60000,
                "extra": {
                    "io": {
                        "read_rate": 0,
                        "read_bytes": 0,
                        "write_rate": 0,
                        "write_bytes": 0
                    },
                    "cpu": {
                        "total": 17,
                        "usage": 16,
                        "stime_sec": 24862,
                        "utime_sec": 24862
                    },
                    "mem": {
                        "rss": 4763152384,
                        "share": 7630848,
                        "usage": 8239378432
                    },
                    "net": {
                        "in_bitrate": 11363312,
                        "out_bitrate": 76223576
                    },
                    "drives": {
                        "/": {
                            "fs": "ext4",
                            "mount": "/",
                            "inode_free": 1477791,
                            "inode_total": 1605632,
                            "capacity_free": 18827964416,
                            "capacity_total": 25759584256
                        },
                        "/boot": {
                            "fs": "ext4",
                            "mount": "/boot",
                            "inode_free": 65220,
                            "inode_total": 65536,
                            "capacity_free": 806674432,
                            "capacity_total": 1023303680
                        },
                        "/storage": {
                            "fs": "ext4",
                            "mount": "/storage",
                            "inode_free": 32743234,
                            "inode_total": 32768000,
                            "capacity_free": 16777216,
                            "capacity_total": 527371075584
                        }
                    },
                    "server": {
                        "ip4": "192.168.200.18",
                        "name": "MS-21.03-lts",
                        "build": "44ce34f",
                        "uptime": 175342,
                        "startat": 1655798680,
                        "version": "21.03",
                        "hostname": "labMS6.vms.local",
                        "revision": "lts",
                        "timestamp": "20220616091725"
                    },
                    "cluster": {
                        "id": "2",
                        "node": "6",
                        "enable": "true",
                        "hostname": "labMS6.vms.local"
                    },
                    "license": {
                        "own": "Vms",
                        "type": "enterprise",
                        "issued": 1687510022
                    },
                    "streams": {
                        "total": 36,
                        "active": 20,
                        "clients": 14
                    },
                    "storages": {
                        "/storage": {
                            "fs": "",
                            "err": 0,
                            "name": "default",
                            "mount": "/storage",
                            "inode_free": 32743234,
                            "inode_total": 32768000,
                            "capacity_free": 16777216,
                            "capacity_total": 527371075584
                        }
                    }
                }
            }
        ],
        "transfer_servers": [
            {
                "id": 1,
                "type": "media_server_v2",
                "schema": "https",
                "domain": "labMS3.vms.local",
                "internal": "8080",
                "external": "8443",
                "m4f": "8443",
                "rtsp": "5554",
                "publish": "7554",
                "traffic_in": 7288,
                "traffic_out": 33306,
                "status": 1,
                "is_enabled": 1,
                "is_main": 1,
                "has_cache": 0,
                "proxy": ".vms.local",
                "created_at": "2021-05-27 16:07:46",
                "updated_at": "2022-06-23 11:47:02",
                "group_type": "all",
                "can_delete": false,
                "streams_limit": 1000,
                "bitrate_limit": 600000,
                "extra": {
                    "io": {
                        "read_rate": 0,
                        "read_bytes": 0,
                        "write_rate": 0,
                        "write_bytes": 0
                    },
                    "cpu": {
                        "total": 34,
                        "usage": 4,
                        "stime_sec": 20136,
                        "utime_sec": 20136
                    },
                    "mem": {
                        "rss": 1686056960,
                        "share": 9834496,
                        "usage": 3573452800
                    },
                    "net": {
                        "in_bitrate": 7462464,
                        "out_bitrate": 34105264
                    },
                    "drives": {
                        "/": {
                            "fs": "ext4",
                            "mount": "/",
                            "inode_free": 1427904,
                            "inode_total": 1589248,
                            "capacity_free": 14389350400,
                            "capacity_total": 25491165184
                        },
                        "none": {
                            "fs": "swap",
                            "mount": "none",
                            "inode_free": 0,
                            "inode_total": 0,
                            "capacity_free": 0,
                            "capacity_total": 0
                        },
                        "/boot": {
                            "fs": "ext4",
                            "mount": "/boot",
                            "inode_free": 97984,
                            "inode_total": 98304,
                            "capacity_free": 1229950976,
                            "capacity_total": 1551745024
                        },
                        "/storage": {
                            "fs": "ext4",
                            "mount": "/storage",
                            "inode_free": 32751136,
                            "inode_total": 32768000,
                            "capacity_free": 3980582912,
                            "capacity_total": 527371075584
                        }
                    },
                    "server": {
                        "ip4": "192.168.200.15",
                        "name": "MS-21.03-lts",
                        "build": "44ce34f",
                        "uptime": 598678,
                        "startat": 1655375344,
                        "version": "21.03",
                        "hostname": "labMS3.vms.local",
                        "revision": "lts",
                        "timestamp": "20220616091725"
                    },
                    "cluster": {
                        "id": "100",
                        "node": "3",
                        "enable": "true",
                        "hostname": "labMS3.vms.local"
                    },
                    "license": {
                        "own": "Vms",
                        "type": "enterprise",
                        "issued": 1687510022
                    },
                    "streams": {
                        "total": 47,
                        "active": 15,
                        "clients": 11
                    },
                    "storages": {
                        "/storage": {
                            "fs": "",
                            "err": 0,
                            "name": "default",
                            "mount": "/storage",
                            "inode_free": 32751136,
                            "inode_total": 32768000,
                            "capacity_free": 3980582912,
                            "capacity_total": 527371075584
                        },
                        "/storage2": {
                            "fs": "",
                            "err": -2,
                            "name": "secondary",
                            "mount": "/storage2",
                            "inode_free": 0,
                            "inode_total": 0,
                            "capacity_free": 0,
                            "capacity_total": 0
                        }
                    }
                }
            }
        ],
        "transfer_sub_servers": [],
        "created_at": "2022-01-28 02:56:12",
        "updated_at": "2022-06-23 11:47:04",
        "is_preview_from_server": true,
        "is_archive_from_server": null,
        "is_enabled": true,
        "source": "manual",
        "is_sound_enabled": false,
        "reconnect_attempt": 0,
        "reconnect_total": 2,
        "reconnect_time": null,
        "disconnections_count": 0,
        "is_actual": true
    },
    "primary_server": {
        "id": 6,
        "type": "media_server_v2",
        "schema": "https",
        "domain": "labMS8.vms.local",
        "internal": "8080",
        "external": "8443",
        "m4f": "8443",
        "rtsp": "5554",
        "publish": "555",
        "traffic_in": 16326,
        "traffic_out": 0,
        "status": 1,
        "is_enabled": 1,
        "is_main": 0,
        "has_cache": 0,
        "proxy": ".vms.local",
        "created_at": "2021-05-27 16:17:06",
        "updated_at": "2022-06-23 11:47:02",
        "group_type": "all",
        "can_delete": false,
        "streams_limit": 6000,
        "bitrate_limit": 600000,
        "extra": {
            "io": {
                "read_rate": 0,
                "read_bytes": 0,
                "write_rate": 0,
                "write_bytes": 0
            },
            "cpu": {
                "total": 9,
                "usage": 10,
                "stime_sec": 13635,
                "utime_sec": 13635
            },
            "mem": {
                "rss": 734384128,
                "share": 10625024,
                "usage": 2889834496
            },
            "net": {
                "in_bitrate": 16718096,
                "out_bitrate": 0
            },
            "drives": {
                "/": {
                    "fs": "ext4",
                    "mount": "/",
                    "inode_free": 1472856,
                    "inode_total": 1605632,
                    "capacity_free": 18185441280,
                    "capacity_total": 25759584256
                },
                "/boot": {
                    "fs": "ext4",
                    "mount": "/boot",
                    "inode_free": 65220,
                    "inode_total": 65536,
                    "capacity_free": 806674432,
                    "capacity_total": 1023303680
                },
                "/storage": {
                    "fs": "ext4",
                    "mount": "/storage",
                    "inode_free": 32746195,
                    "inode_total": 32768000,
                    "capacity_free": 347016241152,
                    "capacity_total": 527371075584
                }
            },
            "server": {
                "ip4": "192.168.200.20",
                "name": "MS-21.03-lts",
                "build": "44ce34f",
                "uptime": 352264,
                "startat": 1655621758,
                "version": "21.03",
                "hostname": "labMS8.vms.local",
                "revision": "lts",
                "timestamp": "20220616091725"
            },
            "cluster": {
                "id": "3",
                "node": "8",
                "enable": "true",
                "hostname": "labMS8.vms.local"
            },
            "license": {
                "own": "Vms",
                "type": "enterprise",
                "issued": 1687510022
            },
            "streams": {
                "total": 28,
                "active": 14,
                "clients": 0
            },
            "storages": {
                "/storage": {
                    "fs": "",
                    "err": 0,
                    "name": "default",
                    "mount": "/storage",
                    "inode_free": 32746195,
                    "inode_total": 32768000,
                    "capacity_free": 347016241152,
                    "capacity_total": 527371075584
                }
            }
        },
        "cluster": {
            "id": 3,
            "name": "Кластер 3",
            "type": "main-secondary",
            "internal": 555,
            "external": 555,
            "m4f": 555,
            "rtsp": 555,
            "publish": 555,
            "streams_limit": 6000,
            "bitrate_limit": 600000,
            "created_at": "2021-05-27 17:14:48",
            "updated_at": "2022-05-27 12:40:53"
        },
        "bitrate": "24345"
    },
    "secondary_servers": [
        {
            "id": 5,
            "type": "media_server_v2",
            "schema": "https",
            "domain": "labMS7.vms.local",
            "internal": "8080",
            "external": "8443",
            "m4f": "8443",
            "rtsp": "5554",
            "publish": "555",
            "traffic_in": 17103,
            "traffic_out": 4040,
            "status": 1,
            "is_enabled": 1,
            "is_main": 0,
            "has_cache": 0,
            "proxy": ".vms.local",
            "created_at": "2021-05-27 16:16:26",
            "updated_at": "2022-06-23 11:47:02",
            "group_type": "all",
            "can_delete": false,
            "streams_limit": 6000,
            "bitrate_limit": 600000,
            "extra": {
                "io": {
                    "read_rate": 0,
                    "read_bytes": 0,
                    "write_rate": 0,
                    "write_bytes": 0
                },
                "cpu": {
                    "total": 8,
                    "usage": 9,
                    "stime_sec": 19980,
                    "utime_sec": 19980
                },
                "mem": {
                    "rss": 506998784,
                    "share": 8732672,
                    "usage": 2489462784
                },
                "net": {
                    "in_bitrate": 17513312,
                    "out_bitrate": 4136840
                },
                "drives": {
                    "/": {
                        "fs": "ext4",
                        "mount": "/",
                        "inode_free": 1475252,
                        "inode_total": 1605632,
                        "capacity_free": 2042609664,
                        "capacity_total": 25759584256
                    },
                    "/boot": {
                        "fs": "ext4",
                        "mount": "/boot",
                        "inode_free": 65220,
                        "inode_total": 65536,
                        "capacity_free": 806674432,
                        "capacity_total": 1023303680
                    },
                    "/storage": {
                        "fs": "ext4",
                        "mount": "/storage",
                        "inode_free": 32761037,
                        "inode_total": 32768000,
                        "capacity_free": 358257672192,
                        "capacity_total": 527371075584
                    }
                },
                "server": {
                    "ip4": "192.168.200.19",
                    "name": "MS-21.03-lts",
                    "build": "44ce34f",
                    "uptime": 598677,
                    "startat": 1655375345,
                    "version": "21.03",
                    "hostname": "labMS7.vms.local",
                    "revision": "lts",
                    "timestamp": "20220616091725"
                },
                "cluster": {
                    "id": "3",
                    "node": "7",
                    "enable": "true",
                    "hostname": "labMS7.vms.local"
                },
                "license": {
                    "own": "Vms",
                    "type": "enterprise",
                    "issued": 1687510022
                },
                "streams": {
                    "total": 28,
                    "active": 11,
                    "clients": 1
                },
                "storages": {
                    "/storage": {
                        "fs": "",
                        "err": 0,
                        "name": "default",
                        "mount": "/storage",
                        "inode_free": 32761037,
                        "inode_total": 32768000,
                        "capacity_free": 358257672192,
                        "capacity_total": 527371075584
                    }
                }
            },
            "bitrate": "55055"
        }
    ]
}

401 Unauthorized

Токен авторизации не передан или не валидный Получение токена

cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/cameras/{camera}/stream/{stream}/transfer/servers' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "camera": 0,
    "stream": 0,
    "cluster_id": "integer"
}'
PHP
PHP
$data = array (
  'camera' => 0,
  'stream' => 0,
  'cluster_id' => 'integer',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/admin/v1/cameras/{camera}/stream/{stream}/transfer/servers', false, $context);
JavaScript errors detected

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

If this problem persists, please contact our support.