Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple paths in http module - metricbeats

I am using http module of metricbeats to monitor jmx. I am using http module instead of the jolokia module because it lacks wildcard support at this point. The example configuration in the documents is as follows.

- module: http
  metricsets: ["json"]
  period: 10s
  hosts: ["localhost:80"]
  namespace: "json_namespace"
  path: "/jolokia/"
  body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "count"}'
  method: "POST"

This works fine and I am able to get data to kibana. I see errors when I configure it as follows to call multiple paths.

- module: http
      metricsets: ["json"]
      enabled: true
      period: 10s
      hosts: ["localhost:80"]
      namespace: "metrics"
      method: POST
      paths:
        - path: "/jolokia/"
          body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "bytes-consumed-rate"}'
        - path: "/jolokia/"
          body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "commit-latency-avg"}'

This does not seem to be the right config and I see that the http events have had failures.

2018/02/26 19:53:18.315740 metrics.go:39: INFO Non-zero metrics in the last 30s: beat.info.uptime.ms=30000 beat.memstats.gc_next=4767600 beat.memstats.memory_alloc=4016168 beat.memstats.memory_total=47474256 libbeat.config.module.running=3 libbeat.output.read.bytes=4186 libbeat.output.write.bytes=16907 libbeat.pipeline.clients=7 libbeat.pipeline.events.active=0 libbeat.pipeline.events.published=18 libbeat.pipeline.events.total=18 libbeat.pipeline.queue.acked=18 metricbeat.http.json.events=3 metricbeat.http.json.failures=3

Documentation on how to setup http module: Example configuration

like image 959
Kumaran Senapathy Avatar asked Aug 02 '26 02:08

Kumaran Senapathy


1 Answers

I had to query multiple URL's of my REST API and I could achieve that by having multiple modules of "http" with different host URL's following is the example:

- module: http
  metricsets: ["json"]
  period: 3600s
  hosts: ["http://localhost/Projects/method1/"]
  namespace: "testmethods"
  method: "GET"
  enabled: true
- module: http
  metricsets: ["json"]
  period: 3600s
  hosts: ["http://localhost/Projects/method2/"]
  namespace: "testmethods"
  method: "GET"
  enabled: true

This made me achieve have multiple paths for the same module

like image 62
Poonam Avatar answered Aug 03 '26 22:08

Poonam