Всем привет.
Есть задача проверять статус камер в ПО ITV Intellect, состояние камер можно получить через api по следующему запросу: Ответ:
Создал Templates, в нем создал правила обнаружения:
Name: Cameras discovery
Type: HTTP agent
Key: videoserver.camera.discovery
URL: http://{$API_PASS}:{$API_USER}@{HOST.IP}:8085/web2/secure/configuration/
*{$API_PASS},{$API_USER} - вынес в макросы шаблона
В LLD макрос указал:
{#CAMERA} $[?(@.type == "CAM")].id
по идее я должен получить в {#CAMERA} "CAM:23"
потом создаю прототип данных
Name: Videoserver Camera {#CAMERA}
Type: HTTP agent
Key: videoserver.camera.state.[{#CAMERA}]
URL: http://{$API_PASS}:{$API_USER}@{HOST.IP}:8085/web2/secure/configuration/{#CAMERA}/
тут я должен получить:
И как значения указываю в Preprocessing
JSONPath $.state.id
При проверки получаю ошибку Cannot create item: item with the same key "videoserver.camera.state.[{#CAMERA}]" already exists.
подозреваю что ошибка в районе LLD макрос, в чем может быть ошибка?
Есть задача проверять статус камер в ПО ITV Intellect, состояние камер можно получить через api по следующему запросу: Ответ:
Code:
[
{
"type": "CAM",
"id": "CAM:23",
"extId": "23",
"name": "Камера 23",
"displayId": "2;1;3",
"monitorId": "1;3;5",
"state": {
"id": "armed",
"type": "NORMAL",
"fullState": "ARMED"
},
"presets": []
},
{
"type": "SLAVE",
"id": "SLAVE:СCTV",
"extId": "СCTV",
"name": "LOCALHOST",
"state": {
"id": "connected",
"type": "NORMAL",
"fullState": "DISCONNECTED"
}
},
{
"type": "DISPLAY",
"id": "DISPLAY:3",
"extId": "3",
"name": "Экран 2",
"displayId": "3",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
}
},
{
"type": "DISPLAY",
"id": "DISPLAY:1",
"extId": "1",
"name": "Экран 1",
"displayId": "1",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
}
},
{
"type": "MONITOR",
"id": "MONITOR:6",
"extId": "6",
"name": "Монитор 6",
"displayId": "3",
"monitorId": "6",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
},
"camList": [
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43"
]
},
{
"type": "MONITOR",
"id": "MONITOR:4",
"extId": "4",
"name": "Монитор 4",
"displayId": "1",
"monitorId": "4",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
},
"camList": [
"31",
"32",
"33",
"34",
"35",
"36",
"37",
"38",
"39",
"40",
"41",
"42",
"43"
]
},
{
"type": "SLAVE",
"id": "SLAVE:WS",
"extId": "WS",
"name": "Компьютер WS",
"state": {
"id": "connected",
"type": "NORMAL",
"fullState": "DISCONNECTED"
}
},
{
"type": "MONITOR",
"id": "MONITOR:5",
"extId": "5",
"name": "Монитор 5",
"displayId": "3",
"monitorId": "5",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
},
"camList": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30"
]
},
{
"type": "MONITOR",
"id": "MONITOR:3",
"extId": "3",
"name": "Монитор 3",
"displayId": "1",
"monitorId": "3",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
},
"camList": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30"
]
},
{
"type": "MONITOR",
"id": "MONITOR:1",
"extId": "1",
"name": "Монитор 1",
"displayId": "2",
"monitorId": "1",
"state": {
"id": "normal",
"type": "NORMAL",
"fullState": null
},
"camList": [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28",
"29",
"30",
"31",
"32",
"33",
"34",
"35",
"36"
]
}
]
Создал Templates, в нем создал правила обнаружения:
Name: Cameras discovery
Type: HTTP agent
Key: videoserver.camera.discovery
URL: http://{$API_PASS}:{$API_USER}@{HOST.IP}:8085/web2/secure/configuration/
*{$API_PASS},{$API_USER} - вынес в макросы шаблона
В LLD макрос указал:
{#CAMERA} $[?(@.type == "CAM")].id
по идее я должен получить в {#CAMERA} "CAM:23"
потом создаю прототип данных
Name: Videoserver Camera {#CAMERA}
Type: HTTP agent
Key: videoserver.camera.state.[{#CAMERA}]
URL: http://{$API_PASS}:{$API_USER}@{HOST.IP}:8085/web2/secure/configuration/{#CAMERA}/
тут я должен получить:
Code:
{
"type": "CAM",
"id": "CAM:23",
"extId": "23",
"name": "Камера 23",
"displayId": "2;1;3",
"monitorId": "1;3;5",
"state": {
"id": "armed",
"type": "NORMAL",
"fullState": "ARMED"
},
"presets": []
}
JSONPath $.state.id
При проверки получаю ошибку Cannot create item: item with the same key "videoserver.camera.state.[{#CAMERA}]" already exists.
подозреваю что ошибка в районе LLD макрос, в чем может быть ошибка?
Comment