使用http module-metricbeat传输httpenpoinds指标

时间:2018-09-20 10:51:46

标签: elasticsearch yaml kibana httpmodule metricbeat

为了发布我的spring-boot应用程序的度量标准端点(/ metric),我在metricbeat中使用了http模块,我遵循elastic.io网站上的官方文档来安装和配置metricbeat,但毫无疑问,尽管已建立连接,但指标的传输不正确。 我更改了fields.yml文件,以仅为http模块创建一个特定模板

fields.yml

- key: http
  title: "HTTP"
  description: >
    HTTP module
  release: beta
  settings: ["ssl"]
  fields:
    - name: http
      type: group
      description: >
      fields:
        - name: request
          type: group
          description: >
              HTTP request information
          fields:
            - name: header
              type: object
              description: >
                The HTTP headers sent
            - name: method
              type: keyword
              description: >
                The HTTP method used
            - name: body
              type: keyword
              description: >
                The HTTP payload sent
        - name: response
          type: group
          description: >
              HTTP response information
          fields:
            - name: header
              type: object
              description: >
                The HTTP headers received
            - name: code
              type: keyword
              description: >
                The HTTP status code
              example: 404
            - name: phrase
              type: keyword
              example: Not found
              description: >
                The HTTP status phrase
            - name: body
              type: keyword
              description: >
                The HTTP payload received
        - name: json
          type: group
          description: >
            json metricset
          release: beta
          fields:

        - name: server
          type: group
          description: >
            server
          release: experimental
          fields:

metricbeat.yml

    metricbeat.config.modules:
      # Glob pattern for configuration loading
      path: ${path.config}/modules.d/*.yml
      # Set to true to enable config reloading
      reload.enabled: false
metricbeat.modules:

    #------------------------------- HTTP Module -------------------------------
    - module: http
      metricsets: ["json"]
      period: 10s
      hosts: ["http://localhost:8080/metrics"]
      namespace: "test_metrics"
      method: "GET" 
      enabled: true
      setup.template.overwrite: true
      output.elasticsearch:
         hosts: ["localhost:9200"]

我的应用指标显示:( http://localhost:8080/metrics

    {
  "mem": 199405,
  "mem.free": 74297,
  "processors": 4,
  "instance.uptime": 45240231,
  "uptime": 45254636,
  "systemload.average": -1,
  "heap.committed": 154624,
  "heap.init": 131072,
  "heap.used": 80326,
  "heap": 1842688,
  "nonheap.committed": 45888,
  "nonheap.init": 2496,
  "nonheap.used": 44781,
  "nonheap": 0,
  "threads.peak": 31,
  "threads.daemon": 25,
  "threads.totalStarted": 35,
  "threads": 27,
  "classes": 6659,
  "classes.loaded": 6659,
  "classes.unloaded": 0,
  "gc.ps_scavenge.count": 24,
  "gc.ps_scavenge.time": 999,
  "gc.ps_marksweep.count": 1,
  "gc.ps_marksweep.time": 71,
  "httpsessions.max": -1,
  "httpsessions.active": 0,
  "gauge.response.metrics": 20,
  "gauge.response.unmapped": 6005,
  "gauge.response.login": 1,
  "gauge.response.star-star.favicon.ico": 1878,
  "counter.status.200.star-star.favicon.ico": 1,
  "counter.status.200.metrics": 30,
  "counter.status.302.unmapped": 3,
  "counter.status.200.login": 2
}

以前,我使用了 httpbeat ,一切都很棒,elasticsearch index中的字段名称是兼容的...,因为我已经使用了http模块,所以一切都已更改,我使用它来获取kibana中的预定义仪表板。

请帮忙吗?

0 个答案:

没有答案