-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial pass at agents list #47177
Initial pass at agents list #47177
Conversation
agent: any; | ||
} | ||
|
||
export const AgentHealth: React.SFC<Props> = ({ agent }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a simplified component for now as the information returned doesn't contain detailed status information, only active: (true|false)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is due to the events API being added secondary to this. Active has nothing to do with the status though. An unenrolled agent becomes active:false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The status needs to be derived from the (events of an agent) + (last checkin with the timeout of the last checkin based on the agent type, with ephemeral agents having not been seen in X time having no effect to the status , temporary showing in just an nuteral offline state if not seen in polling time from policy * 3 with the default polling time being 30sec, permanent is in a degraded status if not seen in 2x polling time, and an error status of offline if not seen in 4x)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we have events flowing in, just using the calculation of the last checkin time should be fine
import { EuiHealth } from '@elastic/eui'; | ||
|
||
interface Props { | ||
agent: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this type should be Agent
but the response doesn't return that type atm, so just using any
for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be Agent less access_token and enrollment_token... we prob need to adjust these types a bit / create a new type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I re adjusted the type for the agent detail page, I can create a PR with it later tonight
agent: any; | ||
} | ||
|
||
export const AgentHealth: React.SFC<Props> = ({ agent }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is due to the events API being added secondary to this. Active has nothing to do with the status though. An unenrolled agent becomes active:false
}; | ||
|
||
// Load agents | ||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should prob use a timer, and poll every X seconds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I will change this when I do the refactoring work to support manual pagination. with EuiInMemoryTable, refreshing data resets the table state!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah true I forgot it did that
agent: any; | ||
} | ||
|
||
export const AgentHealth: React.SFC<Props> = ({ agent }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The status needs to be derived from the (events of an agent) + (last checkin with the timeout of the last checkin based on the agent type, with ephemeral agents having not been seen in X time having no effect to the status , temporary showing in just an nuteral offline state if not seen in polling time from policy * 3 with the default polling time being 30sec, permanent is in a degraded status if not seen in 2x polling time, and an error status of offline if not seen in 4x)
agent: any; | ||
} | ||
|
||
export const AgentHealth: React.SFC<Props> = ({ agent }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until we have events flowing in, just using the calculation of the last checkin time should be fine
💚 Build Succeeded |
</EuiText> | ||
</EuiTitle> | ||
<EuiSpacer size="m" /> | ||
<EuiInMemoryTable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not really familiar with elastic components but it is ok to load all the agents?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this component has built in pagination but will likely run into performance problems once there are thousands of items. my intention is to refactor this into EuiBasicTable with manual pagination after this week since I see that we intend to support pagination in the API endpoints via page
query param (correct me if I'm wrong!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good on my side 👍 I suggest we create a separate issue to handle the agent status (both UI and API side).
I updated AgentHealth with with logic that uses Thanks for updating the return type btw @nchaulet 😄 |
Also I pulled agent type constants into |
💔 Build Failed |
💔 Build Failed |
💔 Build Failed |
Failing on unrelated tests; gonna merge for now and see if merging master into the feature branch helps. |
Relates to #45631
This PR contains registering a new section in Management called Data Ingestion and adds the Fleet app in it. More importantly it contains the initial pass at agents list table:
The current endpoint for retrieving list of agents does not contain all information needed for the table (at least the ones shown in prototype), so some table columns are commented out in the meantime.