.. _arbitrator-API-resources-v2-configs-asset_groups: ``/v2/configs/asset_groups`` ----------------------------- .. tabularcolumns:: |p{1.5cm}|p{5cm}|p{8.5cm}| +---------+-------------------------------+--------------------------------------------------------------+ | Method | URL | Description | +=========+===============================+==============================================================+ | GET | ``/v2/configs/asset_groups`` | Retrieves current list of all asset_groups and all children | | | | underneath. | +---------+-------------------------------+--------------------------------------------------------------+ | POST | ``/v2/configs/asset_groups`` | Adds a new asset_groups and all children. | +---------+-------------------------------+--------------------------------------------------------------+ | PUT | ``/v2/configs/asset_groups`` | Modifies an existing asset_groups and all children. | +---------+-------------------------------+--------------------------------------------------------------+ | DELETE | ``/v2/configs/asset_groups`` | Deletes an existing asset_groups. | +---------+-------------------------------+--------------------------------------------------------------+ .. note:: ``asset_group_id`` of 0 is reserved for the "Ungrouped" Asset Group Header (required) .................. ``x-lxt-api-token``: "token from login" GET ... ``/v2/configs/asset_groups`` * Example 1: Get All Asset Groups Command: :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9[...] --insecure -w "RESP_CODE: %{response_code}" -X GET https:///api/v2/configs/asset_groups Output (formatted): :: { "status":200, "message":"Success", "data":[ {"asset_group_id": 0, "name": "Ungrouped", "assets": [{ "asset_id":"07a3525a54cacf44d00b220a77a3d16046[...]", "name": "Local System", "ipaddress": "10.13.37.172", "hostname": "RayHawaiiArb2", "customer": "", "last_method": "", "last_byte_time": 0, "did": "Unknown", "mac_address": "Unknown", "address": "", "version": "Unknown", "manufacturer": "LayerX Technologies", "timezone": "UTC", "description": "Local Arbitrator Platform", "model": "Unknown", "asset_groups": [], "assets": [], "profiles": [] }, { "asset_id":"3c7bada1022172641f5e4e319[...]", "name": "127.0.0.1", "ipaddress": "127.0.0.1", "hostname": "local", "customer": "", "last_method": "raw_udp", "last_byte_time": 1582644506, "did": "Unknown", "mac_address": "Unknown", "address": "", "version": "Unknown", "manufacturer": "Unknown", "timezone": "Unknown", "description": "", "model": "Unknown", "asset_groups": [], "assets": [], "profiles": [] }] } RESP_CODE: ``200`` POST ..... ``/v2/configs/asset_groups`` Input Data This is an example input object describing a single Asset Group, with no child asset groups and no assets. Note: Sub-object "asset_groups" and "assets" may be pre-populated, including their sub- objects. :: { "name": "A Group", "description": "Anything", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "123 Main Street", "assets": [], "asset_groups": [] } Filled entry example :: { "name": "A Group", "description": "Anything", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "123 Main Street", "asset_groups": [ { "asset_group_id": "GG56YBLHYBDMFVQH161[...]", "name": "testEmpty.sh8", "description": "Anything", "enabled": 1, "locked": 0, "parent_id": 10, "physical_address": "123 Main Street", "assets": [], "asset_groups": [] } ] "assets": [ { "asset_id": "XQATXO524O3Q0HZQ16[...]", "name": "172", "ipaddress": "10.13.37.172", "hostname": "hawaiiIsoSp10", "customer": "", "last_method": "", "last_byte_time": 0, "did": "Unknown", "mac_address": "Unknown", "address": "", "version": "Unknown", "manufacturer": "LayerX Technologies", "timezone": "UTC", "description": "Local Arbitrator Platform", "model": "Unknown", "asset_groups": [], "assets": [], "profiles": [{ "profile_id": "LXTAE3NIJH37W3C81560[...]", "asset_id": "XQATXO524O3Q0HZQ161099[...]", "probe_group_id": "LXTCSP5DDP62CC6C[...]", "enabled": 1, "interval": 30, "start_time": -1, "start_weekdays": 127, "end_window": 86400, "assets": [ { "asset_id": "XQATXO524O3Q0HZQ1610[...]" } ], "credentials": [], "probe_groups": [ { "probe_group_id": "LXTCSP5DDP62CC6C156[...]", "name": "Local System Stats", "description": "Probes the local Arbitrator platform for statistics.", "profiles": [{"profile_id": "LXTAE3NIJH37W3C815605[...]"}], "probes": [{ "probe_id": "LXTQITGJ6DFZ00TD15605399[...]", "name": "Disk Stats", "short_message": "DISK", "command": "get_arb_stat.sh -d", "description": "Local System Disk Usage", "locked": 0, "enabled": 1, "unit": "", "autoscale": 0, "probe_groups": [{"probe_group_id": "LXTCSP5DDP62CC6C156054[...]"}]}, {"probe_id": "LXTQITGJ6DFZ00TD15605399[...]", "name": "Memory Stats", "short_message": "MEM", "command": "get_arb_stat.sh -m", "description": "Watches Memory Consumption", "locked": 0, "enabled": 1, "unit": "", "autoscale": 0, "probe_groups": [{"probe_group_id": "LXTCSP5DDP62CC6C15[...]"}]}, {"probe_id": "LXTQITGJ6DFZ00TD15605[...]", "name": "CPU Stats", "short_message": "CPU", "command": "get_arb_stat.sh -c", "description": "Watches CPU Usage", "locked": 0, "enabled": 1, "unit": "", "autoscale": 0, "probe_groups": [{"probe_group_id": "LXTCSP5DDP62CC6C15605400[...]"}]}, {"probe_id": "LXTQITGJ6DFZ00TD1560539[...]", "name": "Outbound Network Traffic (kBps)", "short_message": "OBNET", "command": "get_arb_stat.sh -o", "description": "Watches Outbound Network Statistics", "locked": 0, "enabled": 1, "unit": "", "autoscale": 0, "probe_groups": [{"probe_group_id": "LXTCSP5DDP62CC6C156054[...]"}]}, {"probe_id": "LXTQITGJ6DFZ00TD156053[...]", "name": "Inbound Network Traffic (kBps)", "short_message": "IBNET", "command": "get_arb_stat.sh -i", "description": "Watches Inbound Network Statistics", "locked": 0, "enabled": 1, "unit": "", "autoscale": 0, "probe_groups": [{"probe_group_id": "LXTCSP5DDP62CC6C1560[...]"}]} ] } ] } ] } ] } * Example 1: POST asset group Command: :: curl -s -H "x-lxt-api-token: xxx" --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group1 -X POST https:///v2/configs/asset_groups ie. :: curl -s -H x-lxt-api-token:eyJ0eXAiO[...] --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group1 -X POST https://10.13.37.14/v2/configs/asset_groups -d '{"name":"ExampleName", "description":"Anything", "enabled":1, "locked":0, "parent_id":"", "physical_address":"123 Main Street"}' Output (formatted): :: {"status": 200, "message": "Success", "data": [{"asset_group_id": "S33HDW6Z5205ICNK1[...]", "name": "ExampleName", "description": "Anything", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "123 Main Street", "assets": [], "asset_groups": [] } ] } RESP_CODE: ``200`` * Example 2: POST asset group with asset Input Data This is an example input object describing a single Asset Group with a single Asset. :: {"name": "ExampleName", "description": "ExampleDescription", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "1234 Main Street", "assets": [{"name": "TestAsset", "ipaddress": "10.13.37.55", "hostname": "", "customer": "", "last_method": "", "last_byte_time": 0, "did": "", "mac_address": "", "address": "", "version": "", "manufacturer": "", "timezone": "UTC", "description": "", "model": "", "asset_groups": [], "assets": [], "profiles": [] } ] } Command :: curl -s -H "x-lxt-api-token: xxx" --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group1 -X POST https:///v2/configs/asset_groups ie. :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV[...] --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group1 -X POST https://10.13.37.14/v2/configs/asset_groups Output (formatted): :: {"status": 200, "message": "Success", "data": [{"asset_group_id": "SZ3HWDCRGS69SLR0158[...]", "name": "ExampleName", "description": "ExampleDescription", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "1234 Main Street", "assets": [{"asset_id":"TMWPJN8312ZUVX9V1582[...]", "name": "TestAsset", "ipaddress": "10.13.37.55", "hostname": "Unknown", "customer": "", "last_method": "", "last_byte_time": 0, "did": "Unknown", "mac_address": "Unknown", "address": "", "version": "Unknown", "manufacturer": "Unknown", "timezone": "UTC", "description": "", "model": "Unknown", "asset_groups": [{"asset_group_id":"SZ3HWDCRGS69SLR0158[...]"}], "assets": [], "profiles": []}], "asset_groups": [] }] } RESP_CODE: ``200`` * Example 3: PUT asset_groups: Modify Asset Group Input data :: {"asset_group_id": "R4ICXBVWMU5C21YL1582[...]", "name": "New Name", "description": "New Description", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "1234 New Main Street", "assets": [], "asset_groups": [] } Command: :: curl -s -H "x-lxt-api-token: xxx" --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group1 -X POST https:///v2/configs/asset_groups ie. :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV1Q[...] --insecure -w "RESP_CODE: %{response_code}" -d@test_data/asset_group2 -X POST https://10.13.37.14/v2/configs/asset_groups Output (formatted): :: {"status": 200, "message": "Success", "data": [{"asset_group_id": "R4ICXBVWMU5C21YL158266549[...]", "name": "New Name", "description": "New Description", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "1234 New Main Street", "assets": [], "asset_groups": [] }] } RESP_CODE: ``200`` PUT .... ``/v2/configs/asset_groups`` * Example 1: Put Asset Group Input Data :: {"asset_group_id": "GG56YBLHYBDMFVQH16110060[...]", "name": "New Name 2" } Command :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV1QiL[...] --insecure -w RESP_CODE: %{response_code} -d@./test/input_data.json -X PUT https://10.13.37.14/api/v2/configs/asset_groups Output (formatted): :: {"status": 200, "message": "Success", "data": [{"asset_group_id": "GG56YBLHYBDMFVQ[...]", "name": "New Name 2" "description": "New Description", "enabled": 1, "locked": 0, "parent_id": "", "physical_address": "1234 New Main Street", "assets": [], "asset_groups": [] }] } RESP_CODE: ``200`` DELETE ....... ``/v2/configs/asset_groups`` * Example 1: Delete Asset Group Input Data :: {"asset_group_id": "GG56YBLHYBDMFVQH161[...]" } Command :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV1Q[...] --insecure -w RESP_CODE: %{response_code} -X DELETE https://10.13.37.14/api/v2/configs/asset_groups/GG56[...] or :: curl -s -H x-lxt-api-token:eyJ0eXAiOiJKV1QiLCJ[...] --insecure -w RESP_CODE: %{response_code} -d@./test/DELETE.7.input_data.json -X DELETE https://10.13.37.14/api/v2/configs/asset_groups Output (formatted): :: {"status":null,"message":null,"data":[]} RESP_CODE: ``200``