Problem with using APM in asp.net core application

I'm using asp.net core and docker and the goal is to use Elastic APM, here is my configuration:

Program.cs:

app.UseAllElasticApm(builder.Configuration);

appsettings.json:

"ElasticApm": {
    "ServiceName": "Appraisal360APMSerivce",
    "LogLevel": "verbose",
    "ServerUrl": "http://localhost:8200",
    "apm-server-secret-token": "",
    "TransactionSampleRate": 1.0
  }

docker-compose file:

version: '3.4'

services:

  apm-server:
    image: docker.elastic.co/apm/apm-server:7.15.2
    ports:
      - 8200:8200
      - 6060:6060
    volumes:
      - ./apm-server.yml:/usr/share/kibana/config/apm-server.yml
    environment:
      - output.elasticsearch.hosts=["http://elasticsearch:9200"]
    networks:
      - elastic
    command: >
      apm-server -e
        -E apm-server.rum.enabled=true
        -E apm-server.host=0.0.0.0:8200
        -E setup.kibana.host=kibana:5601
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    logging:
      driver: 'json-file'
      options:
          max-size: '200m'
          max-file: '50'

  elasticsearch:
    container_name: elasticsearch
    image: elasticsearch:8.5.0
    ports:
      - 9200:9200
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=true
  networks:
      - elastic

  kibana:
    container_name: kibana
    image: kibana:8.5.0
    volumes:
      - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    environment:
      - XPACK_MONITORING_ENABLED=true
      - XPACK_MONITORING_COLLECTION_ENABLED=true
      - XPACK_SECURITY_ENABLED=true
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
 ports:
      - 5601:5601
    networks:
      - elastic

  elastic-agent:
    image: docker.elastic.co/beats/elastic-agent:8.5.0
    container_name: elastic-agent
    restart: always
    user: root # note, synthetic browser monitors require this set to `elastic-agent`
    environment:
     - fleet-server-es=http://localhost:9200
     - fleet-server-service-token=*****
     - fleet-server-policy=fleet-server-policy

networks:
  elastic:
    driver: bridge

volumes:
  elasticsearch-data:

my container is up and running without error

now the problem is here that fleet server does not find any connection like what u see in the picture:

Hi @Hassan_jalali Welcome to the community!

So lets back up a bit...

If you want to run APM server standalone ... then you do not use Fleet but you still need to load the integration .... Interesting I just help someone solve this here

But you do not use Fleet + Standalone APM Server

It is important to realize ... That Fleet and APM Integration are just Special Policies / Integration inside and Agent ... APM Integration is the the new APM Server

If you want to use Fleet then do Follow These Documents but this will install fleet on the host not in docker... then install the APM Integrations

And Seems like you want to run fleet in a container so then you install as docker (which I think is a bit harder) ... you would need to follow these directions to install

Yes sorry / confusing... harder than it should be

Take a look at these and then come back...

that's for the time giving sir, gonna tell you the result

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.