Skip to content

Commit

Permalink
[Fleet] Pass policy namespace to agent monitoring settings (elastic#1…
Browse files Browse the repository at this point in the history
…00500)

* Pass agent policy namespace to agent monitoring settings

* Adjust copy
  • Loading branch information
jen-huang authored and ecezalp committed May 26, 2021
1 parent 30fa586 commit 6fa4d6f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
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

0 comments on commit 6fa4d6f

Please sign in to comment.