Provide API to get node statistics, including node count by status
Bug #1584926 reported by
Christian Reis
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
It would be very convenient for MAAS to return some basic statistics on the nodes registered, including in order of priority:
* Total number of nodes registered
* Number of nodes per user
* Number of nodes per status
* Number of nodes per zone
Related branches
lp:~mpontillo/maas/node-statistics-bug-1584926--part1
Rejected
for merging
into
lp:~maas-committers/maas/trunk
- Gavin Panella (community): Needs Fixing
-
Diff: 588 lines (+444/-22)5 files modifiedsrc/maasserver/api/nodes.py (+86/-9)
src/maasserver/api/support.py (+83/-0)
src/maasserver/api/tests/test_machines.py (+40/-5)
src/maasserver/api/tests/test_nodes.py (+234/-7)
src/maasserver/testing/testclient.py (+1/-1)
lp:~mpontillo/maas/node-statistics-bug-1584926--part2
Rejected
for merging
into
lp:~maas-committers/maas/trunk
- MAAS Maintainers: Pending requested
-
Diff: 560 lines (+466/-3)4 files modifiedsrc/maasserver/api/devices.py (+34/-1)
src/maasserver/api/machines.py (+86/-0)
src/maasserver/api/tests/test_devices.py (+69/-2)
src/maasserver/api/tests/test_machines.py (+277/-0)
Changed in maas: | |
status: | New → Triaged |
importance: | Undecided → Medium |
assignee: | nobody → Mike Pontillo (mpontillo) |
status: | Triaged → In Progress |
milestone: | none → 2.0.0 |
Changed in maas: | |
milestone: | 2.0.0 → 2.1.0 |
Changed in maas: | |
milestone: | 2.0.1 → 2.1.0 |
importance: | Medium → Wishlist |
Changed in maas: | |
milestone: | 2.1.0 → 2.1.1 |
Changed in maas: | |
milestone: | 2.1.1 → 2.1.2 |
Changed in maas: | |
milestone: | 2.1.2 → 2.1.3 |
To post a comment you must log in.
The first and most obvious thing to do, I think, is to add a generic "count" endpoint to just about any object:
ubuntu@maas:~$ maas admin rack-controllers count | jq
1
ubuntu@maas:~$ maas admin region-controllers count | jq
1
ubuntu@maas:~$ maas admin devices count | jq
0
ubuntu@maas:~$ maas admin machines count | jq
8
ubuntu@maas:~$ maas admin nodes count | jq
9
The above could be generically useful across the entire API.
The second thing is the more specific thing that you asked for. We could start with something like the following:
ubuntu@maas:~$ maas admin nodes statistics count": 8,
Success.
Machine-readable output follows:
{
"machine_
"node_count": 9,
"rack_count": 1,
"region_count": 1,
"device_count": 0
}
And with that, I think the easy part is done. The last three things you asked for shouldn't be hard either, it's just a question of how to format them nicely.
Also, to keep scope down, I think these should all be admin-only for now.