Project

General

Profile

Feature #35413

Add API call for system "health" status

Added by Ken Moore over 2 years ago. Updated about 2 years ago.

Status:
Done
Priority:
No priority
Assignee:
William Grzybowski
Category:
Middleware
Target version:
Estimated time:
Severity:
Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

Related projects 2 projects

Description

The TrueView project needs an API call to middlewared which will return the current state of the FreeNAS system.

In particular, the things we are looking for are:
  • Current CPU load (% total)
  • Current memory used (total % used as well as the breakdown in bytes of active/inactive/laundry/wired/free memory)
  • zpool status (ONLINE, DEGRADED, etc..)
  • update status (updates available/running, already up-to-date)
  • Dataset errors/warnings (if any)

The hard part with this request is that it needs to not cause significant load on the FreeNAS (so multiple requests can be run in a very short time frame from various clients/connections). I would recommend that some kind of background daemon should be used which actually polls/caches this information on a periodic basis and the API request(s) only return the cached information.

Associated revisions

Revision 30f0735c (diff)
Added by William Grzybowski over 2 years ago

feat(middlewared/system): add system.health event source Ticket: #35413

Revision 069bcb8a (diff)
Added by William Grzybowski about 2 years ago

feat(middlewared/system): add system.health event source Ticket: #35413

History

#1 Updated by Dru Lavigne over 2 years ago

  • Assignee changed from Release Council to William Grzybowski

#2 Updated by William Grzybowski over 2 years ago

  • Status changed from Unscreened to Not Started
  • Target version changed from Backlog to 11.2-RC2
  • Severity changed from New to Medium
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#3 Updated by William Grzybowski over 2 years ago

  • Status changed from Not Started to In Progress
  • Target version changed from 11.2-RC2 to 11.2-BETA2

#5 Updated by Dru Lavigne about 2 years ago

  • Subject changed from Middlewared: Need API call for system "health" status to Add API call for system "health" status

#6 Updated by William Grzybowski about 2 years ago

  • Status changed from In Progress to Ready for Testing

#7 Updated by Timothy Moore II about 2 years ago

William, do you have any recommendations for testing this?

#8 Updated by William Grzybowski about 2 years ago

Timothy Moore II wrote:

William, do you have any recommendations for testing this?

Sorry, I forgot to add:

midclt subscribe system.health
in freenas should output system stats every 10 seconds

#9 Updated by Timothy Moore II about 2 years ago

William Grzybowski wrote:

Timothy Moore II wrote:

William, do you have any recommendations for testing this?

Sorry, I forgot to add:

midclt subscribe system.health
in freenas should output system stats every 10 seconds

Thank you! Testing now.

#10 Updated by Timothy Moore II about 2 years ago

  • Status changed from Ready for Testing to Passed Testing
  • Needs QA changed from Yes to No

Testing with FreeNAS [Mini | system] updated to FreeNAS-11.2-MASTER-201807120858:

Go to Shell. Enter midclt subscribe system.health. Output:

{“msg”: “added”, “collection”: “system.health”, “fields”: {“cpu_percent”: 0.16, “memory”: {total”: 17086791680, “available”: 9415966720, “percent”: 44.9, “used”: 7230324736, “free”: 8864178176, “active”: 282894336, “inactive”: 551780352, “buffers”: 0, “cached”: 0, “shared”: 128311296, “wired”: 6947430400}, “pools”: {“tank”: {“status”: “ONLINE”}, “test-36163”: {“status”: “ONLINE”}}, “update”: “UNAVAILABLE”}} 

This is repeated every 10 seconds.

#11 Updated by Dru Lavigne about 2 years ago

  • Status changed from Passed Testing to Done

#12 Updated by Ken Moore about 2 years ago

@William
How would I go about subscribing to these events without using `midclt` and only using a Websocket connection?
Can you give me an API call I can send to the FreeNAS system to start receiving these events?

#13 Updated by William Grzybowski about 2 years ago

Ken Moore wrote:

@William
How would I go about subscribing to these events without using `midclt` and only using a Websocket connection?
Can you give me an API call I can send to the FreeNAS system to start receiving these events?

Sorry we dont have official docs for events yet and I forgot to give an API payload example, here is how you subscribe:

{"msg": "sub", "id": "someuniqueid", "name": "system.health"}

#14 Updated by Ken Moore about 2 years ago

Thanks!

Also available in: Atom PDF