Skip to content
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

[Fleet] Pass policy namespace to agent monitoring settings #100500

Merged
merged 2 commits into from
May 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/common/types/models/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export interface FullAgentPolicy {
revision?: number;
agent?: {
monitoring: {
namespace?: string;
use_output?: string;
enabled: boolean;
metrics: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export const AgentPolicyForm: React.FunctionComponent<Props> = ({
description={
<FormattedMessage
id="xpack.fleet.agentPolicyForm.monitoringDescription"
defaultMessage="Collect data about your agents for debugging and tracking performance."
defaultMessage="Collect data about your agents for debugging and tracking performance. Monitoring data will be written to the default namespace specified above."
/>
}
>
Expand Down
4 changes: 4 additions & 0 deletions x-pack/plugins/fleet/server/services/agent_policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('agent policy', () => {

it('should return a policy with monitoring if monitoring is enabled for logs', async () => {
const soClient = getSavedObjectMock({
namespace: 'default',
revision: 1,
monitoring_enabled: ['logs'],
});
Expand All @@ -207,6 +208,7 @@ describe('agent policy', () => {
},
agent: {
monitoring: {
namespace: 'default',
use_output: 'default',
enabled: true,
logs: true,
Expand All @@ -218,6 +220,7 @@ describe('agent policy', () => {

it('should return a policy with monitoring if monitoring is enabled for metrics', async () => {
const soClient = getSavedObjectMock({
namespace: 'default',
revision: 1,
monitoring_enabled: ['metrics'],
});
Expand All @@ -240,6 +243,7 @@ describe('agent policy', () => {
},
agent: {
monitoring: {
namespace: 'default',
use_output: 'default',
enabled: true,
logs: false,
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/fleet/server/services/agent_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ class AgentPolicyService {
? {
agent: {
monitoring: {
namespace: agentPolicy.namespace,
use_output: defaultOutput.name,
enabled: true,
logs: agentPolicy.monitoring_enabled.includes(dataTypes.Logs),
Expand Down