0

I've created a docker-compose file with some configurations that deploy Elasticsearch, Kibana, Elastic Agent all version 8.7.0. where in the Kibana configuration files I define the police I needed under xpack.fleet.agentPolicies, with single command all my environment goes up and all component connect successfully. The only issue is there is one manual step, which is I had to go to Kibana -> Observability -> APM -> Add Elastic APM and then fill the Server configuration.

I want to automate this and manage this from the API/CMD/configuration file, I don't want to do it from the UI.

What is the way to do this? in which component? what is the path the configuration should be at?

I tried to look for APIs or command to do that, but with no luck. I'm expecting help with automating the remaning step.

#Update 1

I've tried to add it as below, but I still can't see the integration added.

    package_policies:
      - name: fleet_server-apm
        id: default-fleet-server
        package:
          name: fleet_server
        inputs:
          - type: apm
            enabled: true
            vars:
              - name: host
                value: "0.0.0.0:8200"
              - name: url
                value: "http://0.0.0.0:8200"
              - name: enable_rum
                value: true
                frozen: true
dpfdg dfsg
  • 19
  • 1
  • 5

2 Answers2

0

Tldr;

Yes, I believe there is a way to do it. But I am pretty sure this is poorly documented. You can find some idea in the repository of apm-server

Solution

In the kibana.yml file you can add some information related to fleet.

This section below is taken from the repository above and helped me set up apm automatically.

But if you have some specific settings you would like to see enable I am usure where you provide them.


xpack.fleet.packages:
  - name: fleet_server
    version: latest
xpack.fleet.agentPolicies:
  - name: Fleet Server (APM)
    id: fleet-server-apm
    is_default_fleet_server: true
    is_managed: false
    namespace: default
    package_policies:
      - name: fleet_server-apm
        id: default-fleet-server
        package:
          name: fleet_server

Paulo
  • 8,690
  • 5
  • 20
  • 34
  • I've tried to add it as below, but I still can't see the integration added. ``` package_policies: - name: fleet_server-apm id: default-fleet-server package: name: fleet_server inputs: - type: apm enabled: true vars: - name: host value: "0.0.0.0:8200" - name: url value: "http://0.0.0.0:8200" - name: enable_rum value: true frozen: true ``` – dpfdg dfsg Jan 30 '23 at 10:35
  • thanks, I've updated the post, but this still not working for me. – dpfdg dfsg Jan 30 '23 at 10:41
  • Have you manage to play with the repo linked ? did you succeed ? What are the errors if any ? logs maybe ? – Paulo Jan 30 '23 at 13:18
0

It is true that the kibana Fleet API is very poorly documented at this moment. I think your problem is that you are trying to add the variables to the fleet-server package insted of the apm package. Your yaml should look like this:

package_policies:
      - name: fleet_server-apm
        id: default-fleet-server
        package:
          name: fleet_server
      - name: apm-1
        package:
          name: apm
        inputs:
          - type: apm
            keep_enabled: true
            vars:
              - name: host
                value: 0.0.0.0:8200
                frozen: true
              - name: url
                value: "http://0.0.0.0:8200"
                frozen: true
              - name: enable_rum
                value: true
                frozen: true

Source

hz_bzz
  • 1