17 Ağustos 2017 Perşembe

Etcdbeat : Elastic Beat for Etcd Statistics

What is the Etcdbeat

Etcdbeat is an Elastic Beat that reads stats from the Etcd v2 API and indexes them into Elasticsearch or Logstash.

Configuration Options

We have some settings. You need to adjust the etcdbeat.yml configuration file to your needs. Here is a sample configuration:
input:
  # Defines how often an event is sent to the output
  period: 30

  # Defines the http port serviced
  # Default to :2379
  port: :2379

  # Defines the http host serviced
  # Default to localhost
  host: localhost

  # Statistics to collect
  statistics:
    leader: false
    self: true
    store: true

  # Authentication
  authentication:
    #Default to enable: false
    enable: false
    username: test
    password: test1234

Options

period
How often events are sent to the elasticsearch.
period: 30
port and host
etcdbeat collect data from the etcd v2 API that predefined to localhost: 2379. You should be careful when you change these settings.
 port: :2379 ` 
 host: localhost
statistics
We have three different stats types of documents exported. They are leader stats, self stats and store stats. You can decide which statistics to collect.
statistics: 
  leader: false
  self: true 
  store: true
Leader option is false by default. If you have followers you need to change this true. if all settings are true, three different events are sent to the output.
authentication
Authentication setting is disabled by default. If you want to authenticate, you need to enable authentication in the etcd API and you have to set the username and password.
authentication:  
  enable: false  
  username: test  
  password: test1234 

Run EtcdBeat

First, setup Golang environment (if you don't have it already)
cd $GOPATH
mkdir -p src/github.com/gamegos
cd src/github.com/gamegos
git clone https://github.com/gamegos/etcdbeat.git
To run Etcdbeat with debugging output enabled, run:
./etcdbeat -c etcdbeat.yml -e -d "*"

Exported Fields

We have three different outputs.

Sample of Etcd leader statistics document:

{
  "_index": "etcdbeat-2017.08.17",
  "_type": "etcdbeat",
  "_id": "AV3wL_FkWRDJnTYSks1I",
  "_score": null,
  "_source": {
    "@timestamp": "2017-08-17T12:34:19.088Z",
    "beat": {
      "hostname": "kripton",
      "name": "kripton",
      "version": "5.1.3"
    },
    "leader": {
      "followers": {
        "6e3bd23ae5f1eae0": {
          "counts": {
            "fail": 0,
            "success": 745
          },
          "latency": {
            "average": 0.017039507382550306,
            "current": 0.000138,
            "maximum": 1.007649,
            "minimum": 0,
            "standardDeviation": 0.05289178277920594
          }
        },
        "a8266ecf031671f3": {
          "counts": {
            "fail": 0,
            "success": 735
          },
          "latency": {
            "average": 0.012124141496598642,
            "current": 0.000559,
            "maximum": 0.791547,
            "minimum": 0,
            "standardDeviation": 0.04187900156583733
          }
        }
      },
      "leader": "924e2e83e93f2560"
    },
    "type": "etcdbeat"
  },
  "fields": {
    "@timestamp": [
      1502973259088
    ]
  },
  "sort": [
    1502973259088
  ]
}

Sample of Etcd self statistics document:

{
  "_index": "etcdbeat-2017.08.16",
  "_type": "doc",
  "_id": "AV3rbDQyWRDJnTYSks0_",
  "_score": null,
  "_source": {
    "@timestamp": "2017-08-16T14:22:02.256Z",
    "beat": {
      "hostname": "kripton",
      "name": "kripton",
      "version": "5.5.1"
    },
    "self": {
      "id": "8e9e05c52164694d",
      "leaderInfo": {
        "leader": "8e9e05c52164694d",
        "startTime": "2017-08-16T17:16:00.239282723+03:00",
        "uptime": "6m2.017314336s"
      },
      "name": "default",
      "recvAppendRequestCnt": 0,
      "recvBandwidthRate": 0,
      "recvPkgRate": 0,
      "sendAppendRequestCnt": 0,
      "startTime": "2017-08-16T17:15:59.437631995+03:00",
      "state": "StateLeader"
    },
    "type": "etcdbeat"
  },
  "fields": {
    "@timestamp": [
      1502893322256
    ],
    "self.leaderInfo.startTime": [
      1502892960239
    ],
    "self.startTime": [
      1502892959437
    ]
  },
  "sort": [
    1502893322256
  ]
}

Sample of Etcd store statistics document:

{
  "_index": "etcdbeat-2017.08.16",
  "_type": "doc",
  "_id": "AV3rbDQyWRDJnTYSks1A",
  "_score": null,
  "_source": {
    "@timestamp": "2017-08-16T14:22:02.257Z",
    "beat": {
      "hostname": "kripton",
      "name": "kripton",
      "version": "5.5.1"
    },
    "store": {
      "compareAndDeleteFail": 0,
      "compareAndDeleteSuccess": 0,
      "compareAndSwapFail": 0,
      "compareAndSwapSuccess": 0,
      "createFail": 0,
      "createSuccess": 1,
      "deleteFail": 0,
      "deleteSuccess": 0,
      "expireCount": 0,
      "getsFail": 3,
      "getsSuccess": 0,
      "setsFail": 0,
      "setsSuccess": 6,
      "updateFail": 0,
      "updateSuccess": 0,
      "watchers": 0
    },
    "type": "etcdbeat"
  },
  "fields": {
    "@timestamp": [
      1502893322257
    ]
  },
  "sort": [
    1502893322257
  ]
}

I am working on it to make an upstream module.

Hiç yorum yok:

Yorum Gönder