Sha256: 11fe9560d90295832090ac9c08404ae0402a69434166d0e32fc33363966a4211

Contents?: true

Size: 1.99 KB

Versions: 1

Compression:

Stored size: 1.99 KB

Contents

fluent-plugin-mysql-query
===========================

Fluentd Input plugin to execute mysql query for stationary measurement.

## Installation

### native gem

`````
gem install fluent-plugin-mysql-query
`````

### td-agent gem
`````
/usr/lib64/fluent/ruby/bin/fluent-gem install fluent-plugin-mysql-query
`````

## Configuration

### Config Sample
`````
<source>
  type            mysql_query
  server          localhost           # Optional (default: localhost)
  port            3306                # Optional (default: 3306)
  username        nagios              # Optional (default: root)
  password        passw0rd            # Optional (default nopassword)
  interval        30s                 # Optional (default: 1m)
  tag             input.mysql         # Required
  query           SHOW VARIABLES LIKE 'Thread_%' # Required
  # inserting hostname into record.
  record_hostname yes                 # Optional (yes/no)
  # multi row results to be nested or separated record.
  nest_result     no                  # Optional (yes/no)
  nest_keyname    data                # Optional (default: result)
</source>

<match input.mysql>
  type stdout
</match>
`````

### Output Sample
record_hostname: yes, nest_result: no
`````
input.mysql: {"hostname":"myhost.example.com","Variable_name":"thread_cache_size","Value":"16"}
input.mysql: {"hostname":"myhost.example.com","Variable_name":"thread_stack","Value":"262144"}
`````
record_hostname: yes, nest_result: yes, nest_keyname: data
`````
input.mysql: {"hostname":"myhost.example.com","data":[{"Variable_name":"thread_cache_size","Value":"16"},{"Variable_name":"thread_stack","Value":"262144"}]}
`````

### Example Query
* SHOW VARIABLES LIKE 'Thread_%';
* SELECT MAX(id) AS max_foo_id FROM foo_table;
* SHOW FULL PROCESSLIST;
* INSERT INTO log (data, created_at) VALUES((SELECT MAX(id) FROM foo_table), NOW());

## TODO
patches welcome!
* support result_key_downcase option

## Copyright

Copyright © 2012- Kentaro Yoshida (@yoshi_ken)

## License

Apache License, Version 2.0

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-mysql-query-0.1.1 README.md