0
# Statistics
1
2
Server statistics and metrics for monitoring Rocket.Chat server usage, performance, and system information.
3
4
## Capabilities
5
6
### Server Statistics
7
8
```python { .api }
9
def statistics(self, **kwargs):
10
"""
11
Get server statistics.
12
13
Parameters:
14
- refresh (bool, optional): Force statistics refresh
15
16
Returns:
17
requests.Response: Comprehensive server statistics
18
"""
19
20
def statistics_list(self, **kwargs):
21
"""
22
List statistics data.
23
24
Parameters:
25
- offset (int, optional): Number of items to skip
26
- count (int, optional): Number of items to return
27
28
Returns:
29
requests.Response: Statistics list
30
"""
31
```
32
33
## Statistics Structure
34
35
```python { .api }
36
StatisticsObject = {
37
"uniqueId": "str", # Server unique identifier
38
"installedAt": "datetime", # Installation date
39
"version": "str", # Rocket.Chat version
40
"totalUsers": "int", # Total user count
41
"activeUsers": "int", # Active user count
42
"totalRooms": "int", # Total room count
43
"totalChannels": "int", # Public channel count
44
"totalPrivateGroups": "int", # Private group count
45
"totalDirect": "int", # Direct message count
46
"totlalLivechat": "int", # LiveChat room count
47
"totalMessages": "int", # Total message count
48
"totalThreads": "int", # Total thread count
49
"totalLivechatVisitors": "int", # LiveChat visitor count
50
"uploads": { # Upload statistics
51
"total": "int",
52
"totalSize": "int"
53
},
54
"federation": "dict", # Federation statistics
55
"importer": "dict", # Import statistics
56
"integrations": "dict", # Integration statistics
57
"migration": "dict", # Migration statistics
58
"push": "dict", # Push notification statistics
59
"usage": "dict", # Usage statistics
60
"apps": "dict", # App statistics
61
"services": "dict" # Service statistics
62
}
63
```
64
65
## Usage Examples
66
67
```python
68
# Get server statistics
69
stats = rocket.statistics()
70
stats_data = stats.json()
71
72
print(f"Server Version: {stats_data['version']}")
73
print(f"Total Users: {stats_data['totalUsers']}")
74
print(f"Active Users: {stats_data['activeUsers']}")
75
print(f"Total Messages: {stats_data['totalMessages']}")
76
print(f"Total Rooms: {stats_data['totalRooms']}")
77
78
# Get upload statistics
79
uploads = stats_data['uploads']
80
print(f"Total Uploads: {uploads['total']}")
81
print(f"Upload Size: {uploads['totalSize']} bytes")
82
83
# Force refresh statistics
84
fresh_stats = rocket.statistics(refresh=True)
85
86
# List statistics (paginated)
87
stats_list = rocket.statistics_list(count=50)
88
```