-
Notifications
You must be signed in to change notification settings - Fork 4
Get UnifiDailyClientStats
external help file: UniFiTooling-help.xml HelpVersion: 1.1.0 Locale: en-US Module Guid: 7fff91a0-02eb-4df2-84d5-c7d3cd7f7a5d Module Name: UniFiTooling online version: https://github.com/Enatec/UniFiTooling/raw/master/docs/Get-UnifiDailyClientStats.md schema: 2.0.0
Get daily statistics for a given user/client via API on the UniFi SDN Controller.
Get-UnifiDailyClientStats [[-UnifiSite] <String>] [-Mac] <String> [[-Start] <String>] [[-End] <String>]
[[-Attributes] <String[]>] [<CommonParameters>]
Get daily statistics for a given user/client via Ubiquiti (UBNT) UniFi RESTful API request on the UniFi SDN Controller.
For convenience, we return the traffic Megabytes and not in bytes (as the UniFi does it).
We also return real timestamps instead of the epoc/unix timestaps that the UniFi API returns.
Sample output: Time : 2/1/2019 1:00:00 AM rx_bytes : 105.0 rx_kb : 0.10 rx_mb : 0.00 rx_gb : 0.00 rx_tb : 0.00 rx_rate : 650000.0 rx_rate_mbps : 634.77 rx_retries : 0 rx_packets : 2.5 tx_bytes : 213.0 tx_kb : 0.21 tx_mb : 0.00 tx_gb : 0.00 tx_tb : 0.00 tx_rate : 650000.0 tx_rate_mbps : 634.77 tx_retries : 1 tx_packets : 4.5 Traffic_bytes : 318 Traffic_kb : 0.31 Traffic_mb : 0.00 Traffic_gb : 0.00 Traffic_tb : 0.00 Signal : -65 Signal_plain : -65.0
In reality, we filter out all 0.00 values (e.g. tx_mb above) You can Filter for whatever parameter you like (e.g. with Select-Object)
Get-UnifiDailyClientStats -Mac '78:8a:20:59:e6:88'
Get daily user/client statistics for given (78:8a:20:59:e6:88) user/client in the default site
(Get-UnifiDailyClientStats -Mac '78:8a:20:59:e6:88' -Start '1548971935421' -End '1548975579019')
Get daily user/client statistics for a given (78:8a:20:59:e6:88) user/client in the default site for a given time period.
(Get-UnifiDailyClientStats -Mac '78:8a:20:59:e6:88' -Start '1548980058135')
Get daily user/client statistics for a given (78:8a:20:59:e6:88) user/client in the default site for the last 60 minutes (was the timestamp while the sample was created)
(Get-UnifiDailyClientStats -Mac '78:8a:20:59:e6:88' -UnifiSite 'contoso')[-1]
Get daily user/client statistics for a given (78:8a:20:59:e6:88) user/client in the site 'contoso'
Get-UnifiDailyClientStats -Mac '78:8a:20:59:e6:88' -Attributes 'rx_bytes', 'tx_bytes', 'signal', 'rx_rate', 'tx_rate', 'rx_retries', 'tx_retries', 'rx_packets', 'tx_packets')
Get all Values from the API
ID of the client-device to be modified
Type: String
Parameter Sets: (All)
Aliases: Site
Required: False
Position: 1
Default value: Default
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Client MAC address (required)
Type: String
Parameter Sets: (All)
Aliases: UniFiMac, MacAddress
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Startpoint in UniFi Unix timestamp in milliseconds
Type: String
Parameter Sets: (All)
Aliases: Startpoint, StartTime
Required: False
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Endpoint in UniFi Unix timestamp in milliseconds
Type: String
Parameter Sets: (All)
Aliases: EndPoint, EndTime
Required: False
Position: 4
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
array containing attributes (strings) to be returned, defaults to rx_bytes and tx_bytes
Type: String[]
Parameter Sets: (All)
Aliases: attribs, UniFiAttributes
Required: False
Position: 5
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
defaults to the past week (7*24 hours) Ubiquiti announced this with the Controller version 5.8 - It will not work on older versions! Make sure that "Clients Historical Data" (Collect clients' historical data) has been enabled in the UniFi controller in "Settings/Maintenance"