Wireless Access

 View Only
  • 1.  [API REST]Count all AP clients

    Posted Oct 03, 2024 03:35 AM

    Hello Dream Team,

    Please, I would like to ask you how can I query the Aruba REST API to get the number of Wifi clients of an AP device, whether CONNECTED or OFFLINE( over a period). I want to know if the AP has connected at least one client in the quarter. Thx



  • 2.  RE: [API REST]Count all AP clients

    Posted Oct 03, 2024 04:49 AM
    Edited by GorazdKikelj Oct 03, 2024 05:10 AM

    Hi.

    You can use pycentral-log module on GitHub repository https://github.com/GorazdKikelj/pycentral-log .

    Use following filter to select successful client association to the access point:

    {
        "device_type": "CLIENT",
        "sort": "-timestamp",
        "event_type": "Client Association Success",
        "from_timestamp": "2024-10-01" <--- your desired start date
    }

     File event_list.txt will contain all successful client associations for each AP that has this event.

    Limit is 30 days as Central will hold event data for 30 days.

    Best, Gorazd



    ------------------------------
    Gorazd Kikelj
    MVP Guru 2024
    ------------------------------



  • 3.  RE: [API REST]Count all AP clients

    Posted Oct 03, 2024 05:06 AM

    Run can looks like this:

    PS D:\Development\pycentral-log> & d:/Development/pycentral-log/.venv/Scripts/python.exe d:/Development/pycentral-log/run.py
     Run Collection
    INFO: __Using device list from Aruba Central event filter {'device_type': 'CLIENT', 'sort': '-timestamp', 'event_type': 'Client Association Success', 'from_timestamp': 1727733600}
    INFO: __Debug commands: {'device_type': 'IAP', 'commands': [{'command_id': 115, 'arguments': [{'name': '', 'value': ''}]}, {'command_id': 34, 'arguments': [{'name': '', 'value': ''}]}, {'command_id': 177, 'arguments': [{'name': '', 'value': ''}]}]}
    INFO: __Output Event file is {'filename': 'event_list.txt', 'directory': 'data/'}
    INFO: __Search conditions: {'inverse_search': False}
    INFO: Validating Input Dict...
    2024-10-03 10:39:40 - ARUBA_BASE - INFO - Loaded token from storage from file: token\tok_xxx.json
    INFO: Loaded token from storage from file: token\tok_xxx.json
    INFO: 4535 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAAC. : SMJ AP03
    INFO: 4536 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAAK. : SMJ AP53
    INFO: 4537 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG0AAAAAM. : SGC AP08
    INFO: 4538 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAA3. : SMJ AP07
    INFO: 4539 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAAS. : SMJ AP26
    INFO: 4540 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK1AAAAAC. : TP AP08
    INFO: 4541 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK1AAAAAJ. : TP AP10
    INFO: 4542 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK2AAAAA8. : TP AP12
    INFO: 4543 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAFK. : SMJ AP30
    INFO: 4544 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG0AAAAAF. : SGC AP07
    INFO: 4545 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAAF. : SMJ AP11
    INFO: 4546 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAA0. : SMJ AP28
    INFO: 4547 : QUEUED : Successfully queued troubleshooting commands for session  of device CNLGKAAAA4. : MOC AP
    INFO: 4548 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAA6. : SMJ AP24
    INFO: 4549 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK1AAAAAV. : TP AP09
    INFO: 4550 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK2AAAAAR. : TP AP20
    INFO: 4551 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK1KAAAAQ. : TP AP11
    INFO: 4552 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK5KAAAAW. : TP AP18
    INFO: 4553 : QUEUED : Successfully queued troubleshooting commands for session  of device CNK2AAAAAC. : TP AP13
    INFO: 4554 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCAAAAAH. : SMJ AP23
    INFO: 4555 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAAC. : SMJ AP25
    INFO: 4556 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAACJ. : SMJ AP47
    INFO: 4557 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAAB. : SMJ AP05
    INFO: 4558 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAAY. : SMJ AP33
    INFO: 4559 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAA1. : SMJ AP48
    INFO: 4560 : QUEUED : Successfully queued troubleshooting commands for session  of device CNPCKAAAAG. : SMJ AP31
    INFO: Total debug AP requested: 26, total AP submited: 26
    INFO: 4535 : COMPLETED : Successfully completed troubleshooting session 4535 of device CNPCAAAAAC : SMJ AP03
    ...
    INFO: Total debug APs to retry: 0
    PS D:\Development\pycentral-log> 



    ------------------------------
    Gorazd Kikelj
    MVP Guru 2024
    ------------------------------



  • 4.  RE: [API REST]Count all AP clients
    Best Answer

    Posted Oct 03, 2024 05:10 AM

    If you would like to know only devices that do not have the event you are looking for, then use "--inverse_search" parameter. 

    PS D:\Development\pycentral-log> & d:/Development/pycentral-log/.venv/Scripts/python.exe d:/Development/pycentral-log/run.py --inverse_search
     Run Collection
    INFO: __Using device list from Aruba Central event filter {'device_type': 'CLIENT', 'sort': '-timestamp', 'event_type': 'Client Association Success', 'from_timestamp': 1727733600}
    INFO: __Debug commands: {'device_type': 'IAP', 'commands': [{'command_id': 115, 'arguments': [{'name': '', 'value': ''}]}, {'command_id': 34, 'arguments': [{'name': '', 'value': ''}]}, {'command_id': 177, 'arguments': [{'name': '', 'value': ''}]}]}
    INFO: __Output Event file is {'filename': 'event_list.txt', 'directory': 'data/'}
    INFO: __Search conditions: {'inverse_search': True}
    INFO: Validating Input Dict...
    2024-10-03 11:06:21 - ARUBA_BASE - INFO - Loaded token from storage from file: token\tok_xxx.json
    INFO: Loaded token from storage from file: token\tok_xxx.json
    INFO: # all devices: 86 skipped devices: 31 selected devices: 55
    INFO: 4561 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG0AAAAAY. : SGC AP09
    INFO: 4562 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG3AAAAAH. : SGC AP01
    INFO: 4563 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG3AAAAAM. : SGC AP05
    INFO: 4564 : QUEUED : Successfully queued troubleshooting commands for session  of device CNG3AAAAAR. : SGC AP02



    ------------------------------
    Gorazd Kikelj
    MVP Guru 2024
    ------------------------------



  • 5.  RE: [API REST]Count all AP clients

    Posted 30 days ago

    Thanks Gorazd for your helping