Search code examples
influxdbgatling

How can I write in InfluxDB from Gatling?


My question was already asked but I didn't succeed to solve my issue.

I don't succeed to send my data from Gatling in real time to InfluxDB.

I'm on Windows 10. Gatling Version: 2.3.0 (the last one). InfluxDB version: 1.3.5 (the last is 1.3.6).

My gatling.conf:

data {
    writers = [console, file, graphite]      # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite, jdbc)
    console {
      #light = false                # When set to true, displays a light version without detailed request stats
    }
    file {
      #bufferSize = 8192            # FileDataWriter's internal data buffer size, in bytes
    }
    leak {
      #noActivityTimeout = 30  # Period, in seconds, for which Gatling may have no activity before considering a leak may be happening
    }
    graphite {
      #light = false              # only send the all* stats
      host = "127.0.0.1"         # The host where the Carbon server is located
      port = "2003"              # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
      protocol = "tcp"           # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
      rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
      #bufferSize = 8192          # GraphiteDataWriter's internal data buffer size, in bytes
      #writeInterval = 1          # GraphiteDataWriter's write interval, in seconds
    }
  }

My influxdb.conf:

[http]
  # Determines whether HTTP endpoint is enabled.
   enabled = true


  # The bind address used by the HTTP service.
   bind-address = "127.0.0.1:8086"


###
### [[graphite]]
###
### Controls one or many listeners for Graphite data.
###


[[graphite]]
  # Determines whether the graphite endpoint is enabled.
   enabled = true
   database = "gatlingdb"
  # retention-policy = ""
   bind-address = ":2003"
   protocol = "tcp"
  # consistency-level = "one"
   templates = [
       "gatling.*.*.*.*.measurement.simulation.request.status.field"
   ]

My gatlingdb database is created on InfluxDB, it stays empty.

When I try:

C:\InfluxDB-1.3.5-1>influx -host 127.0.0.1

I'm connected to InfluxDB

>USE gatlingdb

I'm connected to my database. Then:

>SHOW SERIES

and

>SELECT * FROM gatling

Don't return anything. It's empty.

Note: I put "FROM gatling" because I put that in my gatling.conf: rootPathPrefix = "gatling"

I didn't download Graphite but I saw that InfluxDB accept the graphite protocol. I assume I can send data from Gatling to InfluxDB. I certainly missed something.

I succeeded in connecting InfluxDB to Grafana and I display data from other databases. I just missed the connection between Gatling and InfluxDB.

Thanks in advance for your help, I definitely need it!

Anthony


Solution

  • I'm almost finished the article which shows all the steps required to create the whole monitoring infrastructure using the Gatling, Grafana and InfluxDB (btw, without Graphite installed separately) which worked very well for me. I think I'll publish it in my blog on the blazemeter.com just in few days! So stay tuned there! http://blazemeter.com/blog

    There you will even find the ready solution to spin up everything inside the Docker.

    But until this (if it is urgent for you), can share my InfluxDB config section:

    [[graphite]]
    enabled = true
    bind-address = ":2003"
    database = "graphite"
    retention-policy = ""
    protocol = "tcp"
    batch-size = 5000
    batch-pending = 10
    batch-timeout = "1s"
    consistency-level = "one"
    separator = "."
    udp-read-buffer = 0
    

    gatling.conf:

    graphite {
      light = false              # only send the all* stats
      host = "localhost"         # The host where the Carbon server is located
      port = 2003                # The port to which the Carbon server listens to (2003 is default for plaintext, 2004 is default for pickle)
      protocol = "tcp"           # The protocol used to send data to Carbon (currently supported : "tcp", "udp")
      rootPathPrefix = "gatling" # The common prefix of all metrics sent to Graphite
      bufferSize = 8192          # GraphiteDataWriter's internal data buffer size, in bytes
      writeInterval = 1          # GraphiteDataWriter's write interval, in seconds
    }
    

    The first thing you need to check is that InfluxDB actually accepts incoming metrics via graphite protocol. For example, during InfluxDB startup logs you should find this line:

    influxdb_1  | [I] 2018-01-26T13:40:37Z Listening on TCP: [::]:2003 service=graphite addr=:2003