@@ -50,6 +50,7 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
5050row := table.Row {"Resource" }
5151if ! options .HideAgentState {
5252row = append (row ,"Status" )
53+ row = append (row ,"Health" )
5354row = append (row ,"Version" )
5455}
5556if ! options .HideAccess {
@@ -81,6 +82,7 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
8182DefaultStyles .Bold .Render (resourceAddress ),
8283"" ,
8384"" ,
85+ "" ,
8486})
8587// Display all agents associated with the resource.
8688for index ,agent := range resource .Agents {
@@ -93,13 +95,13 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
9395fmt .Sprintf ("%s─ %s (%s, %s)" ,pipe ,agent .Name ,agent .OperatingSystem ,agent .Architecture ),
9496}
9597if ! options .HideAgentState {
96- var agentStatus string
97- var agentVersion string
98+ var agentStatus ,agentHealth ,agentVersion string
9899if ! options .HideAgentState {
99100agentStatus = renderAgentStatus (agent )
101+ agentHealth = renderAgentHealth (agent )
100102agentVersion = renderAgentVersion (agent .Version ,options .ServerVersion )
101103}
102- row = append (row ,agentStatus ,agentVersion )
104+ row = append (row ,agentStatus ,agentHealth , agentVersion )
103105}
104106if ! options .HideAccess {
105107sshCommand := "coder ssh " + options .WorkspaceName
@@ -141,6 +143,13 @@ func renderAgentStatus(agent codersdk.WorkspaceAgent) string {
141143}
142144}
143145
146+ func renderAgentHealth (agent codersdk.WorkspaceAgent )string {
147+ if agent .Health .Healthy {
148+ return DefaultStyles .Keyword .Render ("✔ healthy" )
149+ }
150+ return DefaultStyles .Error .Render ("✘ " + agent .Health .Reason )
151+ }
152+
144153func renderAgentVersion (agentVersion ,serverVersion string )string {
145154if agentVersion == "" {
146155agentVersion = "(unknown)"