@@ -50,6 +50,7 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
50
50
row := table.Row {"Resource" }
51
51
if ! options .HideAgentState {
52
52
row = append (row , "Status" )
53
+ row = append (row , "Health" )
53
54
row = append (row , "Version" )
54
55
}
55
56
if ! options .HideAccess {
@@ -81,6 +82,7 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
81
82
DefaultStyles .Bold .Render (resourceAddress ),
82
83
"" ,
83
84
"" ,
85
+ "" ,
84
86
})
85
87
// Display all agents associated with the resource.
86
88
for index , agent := range resource .Agents {
@@ -93,13 +95,13 @@ func WorkspaceResources(writer io.Writer, resources []codersdk.WorkspaceResource
93
95
fmt .Sprintf ("%s─ %s (%s, %s)" , pipe , agent .Name , agent .OperatingSystem , agent .Architecture ),
94
96
}
95
97
if ! options .HideAgentState {
96
- var agentStatus string
97
- var agentVersion string
98
+ var agentStatus , agentHealth , agentVersion string
98
99
if ! options .HideAgentState {
99
100
agentStatus = renderAgentStatus (agent )
101
+ agentHealth = renderAgentHealth (agent )
100
102
agentVersion = renderAgentVersion (agent .Version , options .ServerVersion )
101
103
}
102
- row = append (row , agentStatus , agentVersion )
104
+ row = append (row , agentStatus , agentHealth , agentVersion )
103
105
}
104
106
if ! options .HideAccess {
105
107
sshCommand := "coder ssh " + options .WorkspaceName
@@ -141,6 +143,13 @@ func renderAgentStatus(agent codersdk.WorkspaceAgent) string {
141
143
}
142
144
}
143
145
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
+
144
153
func renderAgentVersion (agentVersion , serverVersion string ) string {
145
154
if agentVersion == "" {
146
155
agentVersion = "(unknown)"
0 commit comments