├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .kitchen.yml ├── .travis.yml ├── CHANGELOG.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md ├── Vagrantfile ├── chefignore ├── defaults └── main.yml ├── handlers └── main.yml ├── hosts ├── meta └── main.yml ├── role.yml ├── spec ├── collectd_spec.rb ├── default_spec.rb └── spec_helper.rb ├── tasks ├── collectd.yml ├── install-debian.yml ├── install-download.yml └── main.yml ├── templates ├── conf.j2 ├── init.d.influxd.j2 ├── iptables.j2 └── upstart.j2 ├── test └── integration │ ├── collectd │ └── ansiblespec │ │ └── config.yml │ └── default │ └── ansiblespec │ ├── Gemfile │ └── config.yml └── vars └── main.yml /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Adding features or fixing bugs 4 | 5 | * Fork the repo 6 | * Check out a feature or bug branch 7 | * Add your changes 8 | * Update README when needed 9 | * Submit a pull request to upstream repo 10 | * Add description of your changes 11 | * Ensure tests are passing 12 | * Ensure branch is mergeable 13 | 14 | ## Testing 15 | 16 | * Please make sure the test playbook passes when making changes 17 | 18 | ## Package specific files/details 19 | 20 | * Don't update `CHANGELOG` in your feature branch 21 | * Don't change the package version in your feature branch 22 | 23 | ## Styling 24 | 25 | * Preferred Ansible variable interpolation uses spaces 26 | 27 | # Don't 28 | my_var: "{{foo_bar}}" 29 | 30 | # Prefer spaces 31 | my_var: "{{ foo_bar }}" 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Ansible Version: 2.x 2 | InfluxDB Version: 12.x 3 | 4 | ## Issue 5 | 6 | Describe the issue. 7 | 8 | ## Steps to reproduce 9 | 10 | Outline how to reproduce it. 11 | 12 | ## Expected behavior 13 | 14 | Add any clarification on how things should work. 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Changes 2 | 3 | Outline changes pull request is introducing 4 | 5 | ## Verify 6 | 7 | Add any steps on how to verify the changes work as intended 8 | 9 | --- 10 | 11 | Add any relevant `fixes` or `closes` to reference github issues 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .kitchen/ 2 | .kitchen.local.yml 3 | -------------------------------------------------------------------------------- /.kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | driver: 4 | name: docker 5 | 6 | platforms: 7 | - name: "ubuntu-14.04" 8 | 9 | verifier: 10 | name: shell 11 | command: rspec -c -f d -I serverspec spec/*_spec.rb 12 | 13 | suites: 14 | - name: default 15 | provisioner: 16 | name: ansible_playbook 17 | playbook: role.yml 18 | hosts: hosts 19 | ansible_extra_flags: "<%= ENV['ANSIBLE_EXTRA_FLAGS'] %>" 20 | additional_copy_path: 21 | - "." 22 | verifier: 23 | patterns: 24 | - "./spec/*_spec.rb" 25 | 26 | suites: 27 | - name: collectd 28 | provisioner: 29 | name: ansible_playbook 30 | playbook: role.yml 31 | hosts: hosts 32 | extra_vars: 33 | influxdb_install_method: "repository" 34 | influxdb_collectd_enabled: "true" 35 | influxdb_admin_enabled: "true" 36 | additional_copy_path: 37 | - "." 38 | verifier: 39 | patterns: 40 | - "./spec/*_spec.rb" 41 | 42 | - name: download 43 | provisioner: 44 | name: ansible_playbook 45 | playbook: role.yml 46 | hosts: hosts 47 | extra_vars: 48 | influxdb_install_method: "download" 49 | influxdb_collectd_enabled: "true" 50 | influxdb_admin_enabled: "true" 51 | additional_copy_path: 52 | - "." 53 | verifier: 54 | patterns: 55 | - "./spec/*_spec.rb" 56 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | language: ruby 4 | rvm: 5 | - 2.2.3 6 | before_install: 7 | - sudo apt-get update -qq 8 | - "curl -fsSL https://get.docker.com/ | sh" 9 | - sudo usermod -aG docker travis 10 | install: 11 | - bundle install --jobs=4 12 | script: 13 | - bundle exec kitchen test 14 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v6.0.0 - 2017-03-20 2 | 3 | * Major update of role to InfluxDB `1.2.0` - thanks to [popstas](https://github.com/popstas) 4 | 5 | # v5.0.0 - 2016-04-05 6 | 7 | * Test Kitchen setup and integration 8 | * Updates to role for open source role conventions 9 | * Collectd setup when enabled 10 | * UDP read buffer configurable 11 | * Update to InfluxDB 11.x and configuration >= 10.x (backwards incompatible changes) 12 | 13 | # v4.0.0 – 2016-01-02 14 | 15 | * Use `defaults/main.yml` for variables 16 | * Upgrade role for changes introduced in `0.9.5` with updated directories 17 | * Breaking changes for versions before `0.9.5` due to directory updates 18 | 19 | # v3.0.1 – 2015-11-11 20 | 21 | * Fix config merging 22 | * Default collectd variables 23 | 24 | # v3.0.1 – 2015-11-09 25 | 26 | * Create influxdb user and group 27 | * Create wal directory 28 | 29 | # v3.0 – 2015-11-07 30 | 31 | * Update influxdb to 0.9.4.2 32 | * Update config to be valid for versions >= 0.9.3 33 | 34 | # v2.1.0 – 2015-08-03 35 | 36 | * Bump influxdb version to 0.9.2 37 | 38 | # v2.0.4 – 2014-10-15 39 | 40 | * Fix iptables graphite to use dport not dports 41 | 42 | # v2.0.3 – 2014-10-02 43 | 44 | * Expose graphite port to iptables 45 | 46 | # v2.0 – 2014-10-01 47 | 48 | * Fix variable naming to be underscore delimited 49 | * Add wal variables 50 | 51 | # v1.0 – 2014-10-01 52 | 53 | * Initial implementation for version 0.8.3 54 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :test do 4 | gem 'kitchen-ansible' 5 | gem 'kitchen-docker' 6 | gem 'test-kitchen' 7 | gem 'serverspec' 8 | gem 'net-telnet' 9 | end 10 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | artifactory (2.3.2) 5 | diff-lcs (1.2.5) 6 | faraday (0.9.2) 7 | multipart-post (>= 1.2, < 3) 8 | highline (1.7.8) 9 | kitchen-ansible (0.40.1) 10 | librarian-ansible 11 | test-kitchen (~> 1.4) 12 | kitchen-docker (2.3.0) 13 | test-kitchen (>= 1.0.0) 14 | librarian (0.1.2) 15 | highline 16 | thor (~> 0.15) 17 | librarian-ansible (3.0.0) 18 | faraday 19 | librarian (~> 0.1.0) 20 | mixlib-install (1.0.2) 21 | artifactory (>= 2.3.0) 22 | mixlib-shellout (>= 2.2.6) 23 | mixlib-versioning (>= 1.1.0) 24 | mixlib-shellout (2.2.6) 25 | mixlib-versioning (1.1.0) 26 | multi_json (1.11.1) 27 | multipart-post (2.0.0) 28 | net-scp (1.2.1) 29 | net-ssh (>= 2.6.5) 30 | net-ssh (2.9.4) 31 | net-telnet (0.1.1) 32 | rspec (3.3.0) 33 | rspec-core (~> 3.3.0) 34 | rspec-expectations (~> 3.3.0) 35 | rspec-mocks (~> 3.3.0) 36 | rspec-core (3.3.2) 37 | rspec-support (~> 3.3.0) 38 | rspec-expectations (3.3.1) 39 | diff-lcs (>= 1.2.0, < 2.0) 40 | rspec-support (~> 3.3.0) 41 | rspec-its (1.2.0) 42 | rspec-core (>= 3.0.0) 43 | rspec-expectations (>= 3.0.0) 44 | rspec-mocks (3.3.2) 45 | diff-lcs (>= 1.2.0, < 2.0) 46 | rspec-support (~> 3.3.0) 47 | rspec-support (3.3.0) 48 | safe_yaml (1.0.4) 49 | serverspec (2.18.0) 50 | multi_json 51 | rspec (~> 3.0) 52 | rspec-its 53 | specinfra (~> 2.35) 54 | specinfra (2.36.6) 55 | net-scp 56 | net-ssh 57 | test-kitchen (1.7.1) 58 | mixlib-install (~> 1.0, >= 1.0.2) 59 | mixlib-shellout (>= 1.2, < 3.0) 60 | net-scp (~> 1.1) 61 | net-ssh (>= 2.9, < 4.0) 62 | safe_yaml (~> 1.0) 63 | thor (~> 0.18) 64 | thor (0.19.1) 65 | 66 | PLATFORMS 67 | ruby 68 | 69 | DEPENDENCIES 70 | kitchen-ansible 71 | kitchen-docker 72 | net-telnet 73 | serverspec 74 | test-kitchen 75 | 76 | BUNDLED WITH 77 | 1.14.5 78 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 mtchavez 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # InfluxDB 2 | [![Latest Version](http://img.shields.io/github/release/mtchavez/ansible-influxdb.svg?style=flat-square)](https://github.com/mtchavez/ansible-influxdb/releases) 3 | [![Build Status](https://travis-ci.org/mtchavez/ansible-influxdb.svg?branch=master)](https://travis-ci.org/mtchavez/ansible-influxdb) 4 | 5 | InfluxDB Ansible Galaxy role. Sets up a working InfluxDB server. 6 | This role is for versions of InfluxDB >= `1.2.0` and is currently defaulted to `1.2.0`. 7 | 8 | **Currenlty clustering is not taken into account for.** 9 | 10 | ## Requirements 11 | 12 | Ansible version `>= 1.9` 13 | 14 | ## Role Variables 15 | 16 | Variables are mostly what exists in the InfluxDB config file. Which you can see [here](https://raw.githubusercontent.com/influxdb/influxdb/master/etc/config.sample.toml) 17 | 18 | ``` 19 | influxdb_install_method: "repository" # or "download" 20 | 21 | influxdb_collectd_typesdb_url: "https://raw.githubusercontent.com/collectd/collectd/master/src/types.db" 22 | influxdb_collectd_typesdb_directory: "/usr/share/collectd" 23 | 24 | # 25 | # Config 26 | # 27 | influxdb_config_dir: "/etc/influxdb" 28 | influxdb_config_file: "{{ influxdb_config_dir }}/influxdb.conf" 29 | influxdb_generated_config: "{{ influxdb_config_dir }}/influxdb.generated.conf" 30 | influxdb_reporting_disabled: "false" 31 | 32 | # [meta] 33 | influxdb_meta_dir: "{{ influxdb_base_data_dir }}/meta" 34 | influxdb_retention_autocreate: "true" 35 | influxdb_meta_logging_enabled: "true" 36 | 37 | # [data] 38 | influxdb_data_dir: "{{ influxdb_base_data_dir }}/data" 39 | influxdb_wal_dir: "{{ influxdb_base_data_dir }}/wal" 40 | influxdb_data_trace_logging_enabled: "false" 41 | influxdb_data_query_log_enabled: "true" 42 | influxdb_data_cache_max_memory_size: 1048576000 43 | influxdb_data_cache_snapshot_memory_size: 26214400 44 | influxdb_data_cache_snapshot_write_cold_duration: "10m" 45 | influxdb_data_compact_full_write_cold_duration: "4h" 46 | influxdb_data_max_series_per_database: 1000000 47 | influxdb_data_max_values_per_tag: 100000 48 | 49 | # [coordinator] 50 | influxdb_coordinator_write_timeout: "10s" 51 | influxdb_coordinator_max_concurrent_queries: 0 52 | influxdb_coordinator_query_timeout: "0s" 53 | influxdb_coordinator_log_queries_after: "0s" 54 | influxdb_coordinator_max_select_point: 0 55 | influxdb_coordinator_max_select_series: 0 56 | influxdb_coordinator_max_select_buckets: 0 57 | 58 | # [retention] 59 | influxdb_retention_enabled: "true" 60 | influxdb_retention_check_interval: "30m" 61 | 62 | # [shard-precreation] 63 | influxdb_shard_creation_enabled: "true" 64 | influxdb_shard_creation_check_interval: "10m" 65 | influxdb_shard_creation_advance_period: "30m" 66 | 67 | # [monitor] 68 | influxdb_monitor_store_enabled: "true" 69 | influxdb_monitor_store_database: "_internal" 70 | influxdb_monitor_store_interval: "10s" 71 | 72 | # [admin] 73 | influxdb_admin_enabled: "false" 74 | influxdb_admin_bind_address: ":8083" 75 | influxdb_admin_https_enabled: "false" 76 | influxdb_admin_https_certificate: "/etc/ssl/influxdb.pem" 77 | 78 | # [http] 79 | influxdb_http_enabled: "true" 80 | influxdb_http_bind_address: ":8086" 81 | influxdb_http_auth_enabled: "false" 82 | influxdb_http_realm: "InfluxDB" 83 | influxdb_http_log_enabled: "true" 84 | influxdb_http_write_tracing: "false" 85 | influxdb_http_pprof_enabled: "true" 86 | influxdb_http_https_enabled: "false" 87 | influxdb_http_https_certificate: "/etc/ssl/influxdb.pem" 88 | influxdb_http_https_private_key: "" 89 | influxdb_http_shared_sercret: "" 90 | influxdb_http_max_row_limit: 10000 91 | influxdb_http_max_connection_limit: 0 92 | influxdb_http_unix_socket_enabled: "false" 93 | influxdb_http_bind_socket: "/var/run/influxdb.sock" 94 | 95 | # [subscriber] 96 | influxdb_subscriber_enabled: "true" 97 | influxdb_subscriber_http_timeout: "30s" 98 | influxdb_subscriber_insecure_skip_verify: "false" 99 | influxdb_subscriber_ca_certs: "" 100 | influxdb_subscriber_write_concurrency: 40 101 | influxdb_subscriber_write_buffer_size: 1000 102 | 103 | # [[graphite]] 104 | influxdb_graphite_enabled: "false" 105 | influxdb_graphite_database: "graphite" 106 | influxdb_graphite_retention_policy: "" 107 | influxdb_graphite_bind_address: ":2003" 108 | influxdb_graphite_protocol: "tcp" 109 | influxdb_graphite_consistency_level: "one" 110 | influxdb_graphite_batch_size: 5000 111 | influxdb_graphite_batch_pending: 5 112 | influxdb_graphite_batch_timeout: "1s" 113 | influxdb_graphite_udp_read_buffer: 0 114 | influxdb_graphite_separator: "." 115 | #influxdb_graphite_tags: [ "region=us-east", "zone=1c" ] 116 | influxdb_graphite_templates: 117 | - "type.host.measurement.device" 118 | 119 | # [[collectd]] 120 | influxdb_collectd_enabled: "false" 121 | influxdb_collectd_bind_address: ":25826" 122 | influxdb_collectd_database: "collectd" 123 | influxdb_collectd_retention_policy: "" 124 | influxdb_collectd_typesdb: "/usr/share/collectd/types.db" 125 | influxdb_collectd_security_level: "none" 126 | influxdb_collectd_auth_file: "/etc/collectd/auth_file" 127 | influxdb_collectd_batch_size: 5000 128 | influxdb_collectd_batch_pending: 10 129 | influxdb_collectd_batch_timeout: "10s" 130 | influxdb_collectd_read_buffer: 0 131 | 132 | # [[opentsdb]] 133 | influxdb_tsb_enabled: "false" 134 | influxdb_tsb_bind_address: ":4242" 135 | influxdb_tsb_database: "opentsdb" 136 | influxdb_tsb_retention_policy: "" 137 | influxdb_tsb_consistency_level: "one" 138 | influxdb_tsb_tls_enabled: "false" 139 | influxdb_tsb_certificate: "/etc/ssl/influxdb.pem" 140 | influxdb_tsb_log_point_errors: "true" 141 | influxdb_tsb_batch_size: 1000 142 | influxdb_tsb_batch_pending: 5 143 | influxdb_tsb_batch_timeout: "1s" 144 | 145 | # [[udp]] 146 | influxdb_udp_enabled: "false" 147 | influxdb_udp_bind_address: ":8089" 148 | influxdb_udp_database: "udp" 149 | influxdb_udp_retention_policy: "" 150 | influxdb_udp_batch_size: 5000 151 | influxdb_udp_batch_pending: 10 152 | influxdb_udp_batch_timeout: "1s" 153 | influxdb_udp_read_buffer: 0 154 | 155 | # [continuous_queries] 156 | influxdb_cqueries_enabled: "true" 157 | influxdb_cqueries_log_enabled: "true" 158 | influxdb_cqueries_run_interval: "1s" 159 | ``` 160 | 161 | ## Dependencies 162 | 163 | No current dependencies on other Galaxy roles. 164 | 165 | ## Example Playbook 166 | 167 | Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: 168 | 169 | - hosts: servers 170 | roles: 171 | - influxdb 172 | ## License 173 | 174 | BSD 175 | 176 | ## Author Information 177 | 178 | El Chavo - mtchavez - 2014 179 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 | # configures the configuration version (we support older styles for 6 | # backwards compatibility). Please don't change it unless you know what 7 | # you're doing. 8 | Vagrant.configure(2) do |config| 9 | # The most common configuration options are documented and commented below. 10 | # For a complete reference, please see the online documentation at 11 | # https://docs.vagrantup.com. 12 | 13 | # Every Vagrant development environment requires a box. You can search for 14 | # boxes at https://atlas.hashicorp.com/search. 15 | config.vm.box = "ubuntu/trusty64" 16 | 17 | config.vm.define :node1 do |node1| 18 | # 19 | # Networking 20 | # 21 | node1.vm.network 'private_network', ip: '192.168.33.10' 22 | # 23 | # VM Setup 24 | # 25 | # Set the hostname to something useful 26 | node1.vm.hostname = 'influxdb-node1' 27 | node1.vm.define :influxdb_node1, {} 28 | 29 | node1.vm.provision 'ansible' do |ansible| 30 | ansible.playbook = 'role.yml' 31 | ansible.tags = ENV['ANSIBLE_TAGS'] unless ENV['ANSIBLE_TAGS'].to_s.empty? 32 | ansible.sudo = true 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | .kitchen 2 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # defaults file for influxdb 3 | influxdb_ver: "1.2.0" 4 | influxdb_md5_checksum: "f79959802930c7e9d6e81ffd366c0629" 5 | influxdb_arch: "amd64" 6 | influxdb_dl_url: "https://dl.influxdata.com/influxdb/releases/influxdb_{{ influxdb_ver }}_{{ influxdb_arch }}.deb" 7 | influxdb_pkg: "/usr/local/src/influxdb_{{ influxdb_ver }}_{{ influxdb_arch }}.deb" 8 | 9 | # Set influxdb_install_method to "repository" to install influxdb from influxdata's repository 10 | influxdb_install_method: "repository" # or "download" 11 | influxdb_repository_channel: "stable" 12 | 13 | influxdb_maxprocs: "{{ ansible_processor_vcpus }}" 14 | influxdb_hostname: "{{ ansible_nodename }}" 15 | influxdb_keep_initd: false 16 | influxdb_user: "influxdb" 17 | influxdb_group: "influxdb" 18 | influxdb_base_data_dir: "/var/lib/influxdb" 19 | influxdb_influxd_bin: "/usr/bin/influxd" 20 | influxdb_influxd_opts: "" 21 | influxdb_collectd_typesdb_url: "https://raw.githubusercontent.com/collectd/collectd/master/src/types.db" 22 | influxdb_collectd_typesdb_directory: "/usr/share/collectd" 23 | 24 | # 25 | # Config 26 | # 27 | influxdb_config_dir: "/etc/influxdb" 28 | influxdb_config_file: "{{ influxdb_config_dir }}/influxdb.conf" 29 | influxdb_generated_config: "{{ influxdb_config_dir }}/influxdb.generated.conf" 30 | influxdb_reporting_disabled: "false" 31 | 32 | # [meta] 33 | influxdb_meta_dir: "{{ influxdb_base_data_dir }}/meta" 34 | influxdb_retention_autocreate: "true" 35 | influxdb_meta_logging_enabled: "true" 36 | 37 | # [data] 38 | influxdb_data_dir: "{{ influxdb_base_data_dir }}/data" 39 | influxdb_wal_dir: "{{ influxdb_base_data_dir }}/wal" 40 | influxdb_data_trace_logging_enabled: "false" 41 | influxdb_data_query_log_enabled: "true" 42 | influxdb_data_cache_max_memory_size: 1048576000 43 | influxdb_data_cache_snapshot_memory_size: 26214400 44 | influxdb_data_cache_snapshot_write_cold_duration: "10m" 45 | influxdb_data_compact_full_write_cold_duration: "4h" 46 | influxdb_data_max_series_per_database: 1000000 47 | influxdb_data_max_values_per_tag: 100000 48 | 49 | # [coordinator] 50 | influxdb_coordinator_write_timeout: "10s" 51 | influxdb_coordinator_max_concurrent_queries: 0 52 | influxdb_coordinator_query_timeout: "0s" 53 | influxdb_coordinator_log_queries_after: "0s" 54 | influxdb_coordinator_max_select_point: 0 55 | influxdb_coordinator_max_select_series: 0 56 | influxdb_coordinator_max_select_buckets: 0 57 | 58 | # [retention] 59 | influxdb_retention_enabled: "true" 60 | influxdb_retention_check_interval: "30m" 61 | 62 | # [shard-precreation] 63 | influxdb_shard_creation_enabled: "true" 64 | influxdb_shard_creation_check_interval: "10m" 65 | influxdb_shard_creation_advance_period: "30m" 66 | 67 | # [monitor] 68 | influxdb_monitor_store_enabled: "true" 69 | influxdb_monitor_store_database: "_internal" 70 | influxdb_monitor_store_interval: "10s" 71 | 72 | # [admin] 73 | influxdb_admin_enabled: "false" 74 | influxdb_admin_bind_address: ":8083" 75 | influxdb_admin_https_enabled: "false" 76 | influxdb_admin_https_certificate: "/etc/ssl/influxdb.pem" 77 | 78 | # [http] 79 | influxdb_http_enabled: "true" 80 | influxdb_http_bind_address: ":8086" 81 | influxdb_http_auth_enabled: "false" 82 | influxdb_http_realm: "InfluxDB" 83 | influxdb_http_log_enabled: "true" 84 | influxdb_http_write_tracing: "false" 85 | influxdb_http_pprof_enabled: "true" 86 | influxdb_http_https_enabled: "false" 87 | influxdb_http_https_certificate: "/etc/ssl/influxdb.pem" 88 | influxdb_http_https_private_key: "" 89 | influxdb_http_shared_sercret: "" 90 | influxdb_http_max_row_limit: 10000 91 | influxdb_http_max_connection_limit: 0 92 | influxdb_http_unix_socket_enabled: "false" 93 | influxdb_http_bind_socket: "/var/run/influxdb.sock" 94 | 95 | # [subscriber] 96 | influxdb_subscriber_enabled: "true" 97 | influxdb_subscriber_http_timeout: "30s" 98 | influxdb_subscriber_insecure_skip_verify: "false" 99 | influxdb_subscriber_ca_certs: "" 100 | influxdb_subscriber_write_concurrency: 40 101 | influxdb_subscriber_write_buffer_size: 1000 102 | 103 | # [[graphite]] 104 | influxdb_graphite_enabled: "false" 105 | influxdb_graphite_database: "graphite" 106 | influxdb_graphite_retention_policy: "" 107 | influxdb_graphite_bind_address: ":2003" 108 | influxdb_graphite_protocol: "tcp" 109 | influxdb_graphite_consistency_level: "one" 110 | influxdb_graphite_batch_size: 5000 111 | influxdb_graphite_batch_pending: 5 112 | influxdb_graphite_batch_timeout: "1s" 113 | influxdb_graphite_udp_read_buffer: 0 114 | influxdb_graphite_separator: "." 115 | #influxdb_graphite_tags: [ "region=us-east", "zone=1c" ] 116 | influxdb_graphite_templates: 117 | - "type.host.measurement.device" 118 | 119 | # [[collectd]] 120 | influxdb_collectd_enabled: "false" 121 | influxdb_collectd_bind_address: ":25826" 122 | influxdb_collectd_database: "collectd" 123 | influxdb_collectd_retention_policy: "" 124 | influxdb_collectd_typesdb: "/usr/share/collectd/types.db" 125 | influxdb_collectd_security_level: "none" 126 | influxdb_collectd_auth_file: "/etc/collectd/auth_file" 127 | influxdb_collectd_batch_size: 5000 128 | influxdb_collectd_batch_pending: 10 129 | influxdb_collectd_batch_timeout: "10s" 130 | influxdb_collectd_read_buffer: 0 131 | 132 | # [[opentsdb]] 133 | influxdb_tsb_enabled: "false" 134 | influxdb_tsb_bind_address: ":4242" 135 | influxdb_tsb_database: "opentsdb" 136 | influxdb_tsb_retention_policy: "" 137 | influxdb_tsb_consistency_level: "one" 138 | influxdb_tsb_tls_enabled: "false" 139 | influxdb_tsb_certificate: "/etc/ssl/influxdb.pem" 140 | influxdb_tsb_log_point_errors: "true" 141 | influxdb_tsb_batch_size: 1000 142 | influxdb_tsb_batch_pending: 5 143 | influxdb_tsb_batch_timeout: "1s" 144 | 145 | # [[udp]] 146 | influxdb_udp_enabled: "false" 147 | influxdb_udp_bind_address: ":8089" 148 | influxdb_udp_database: "udp" 149 | influxdb_udp_retention_policy: "" 150 | influxdb_udp_batch_size: 5000 151 | influxdb_udp_batch_pending: 10 152 | influxdb_udp_batch_timeout: "1s" 153 | influxdb_udp_read_buffer: 0 154 | 155 | # [continuous_queries] 156 | influxdb_cqueries_enabled: "true" 157 | influxdb_cqueries_log_enabled: "true" 158 | influxdb_cqueries_run_interval: "1s" 159 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: restart influxdb 4 | service: name=influxd state=restarted 5 | -------------------------------------------------------------------------------- /hosts: -------------------------------------------------------------------------------- 1 | [localhost] 2 | 127.0.0.1 3 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | galaxy_info: 3 | author: mtchavez 4 | description: InfluxDB 5 | license: MIT 6 | min_ansible_version: 1.9 7 | platforms: 8 | - name: Ubuntu 9 | versions: 10 | - precise 11 | - quantal 12 | - raring 13 | - saucy 14 | - trusty 15 | - xenial 16 | - name: Debian 17 | versions: 18 | - all 19 | - etch 20 | - lenny 21 | - squeeze 22 | - wheezy 23 | categories: 24 | - cloud 25 | - cloud:ec2 26 | - database 27 | - database:nosql 28 | - monitoring 29 | 30 | dependencies: [] 31 | -------------------------------------------------------------------------------- /role.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Test influxdb 4 | hosts: all 5 | sudo: yes 6 | roles: 7 | - "" 8 | vars_files: 9 | - "defaults/main.yml" 10 | - "vars/main.yml" 11 | tasks: 12 | - include: "tasks/main.yml" 13 | handlers: 14 | - include: "handlers/main.yml" 15 | -------------------------------------------------------------------------------- /spec/collectd_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative './spec_helper.rb' 2 | 3 | describe 'ubuntu collectd', if: %w[debian ubuntu].include?(os[:family]) do 4 | describe file('/usr/share/collectd/types.db') do 5 | it { should be_file } 6 | end 7 | 8 | describe port(25826) do 9 | it { should be_listening } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/default_spec.rb: -------------------------------------------------------------------------------- 1 | require_relative './spec_helper.rb' 2 | 3 | # Wait for the converge to be complete before verification 4 | sleep(3) 5 | 6 | describe 'ubuntu', if: %w[debian ubuntu].include?(os[:family]) do 7 | describe group('influxdb') do 8 | it { should exist } 9 | end 10 | 11 | describe user('influxdb') do 12 | it { should exist } 13 | end 14 | 15 | describe package('influxdb') do 16 | it { should be_installed } 17 | end 18 | 19 | %w[data meta wal].each do |dir| 20 | describe file("/var/lib/influxdb/#{dir}") do 21 | it { should be_directory } 22 | end 23 | end 24 | 25 | describe file('/etc/influxdb/influxdb.conf') do 26 | it { should be_file } 27 | end 28 | 29 | describe port(8088) do 30 | it { should be_listening } 31 | end 32 | 33 | describe port(8083) do 34 | it { should be_listening } 35 | end 36 | 37 | describe process('influxd') do 38 | it { should be_running } 39 | end 40 | 41 | describe command('curl -o /dev/null http://localhost:8083') do 42 | its(:exit_status) { should be_zero } 43 | end 44 | 45 | describe command('curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE testdb"') do 46 | its(:exit_status) { should be_zero } 47 | end 48 | 49 | describe command('curl -i -XPOST "http://localhost:8086/write?db=testdb" --data-binary "cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000"') do 50 | its(:exit_status) { should be_zero } 51 | end 52 | 53 | describe command('curl -G "http://localhost:8086/query?pretty=true" --data-urlencode "db=testdb" --data-urlencode "q=SELECT value FROM cpu_load_short WHERE region=\'us-west\'"') do 54 | its(:exit_status) { should be_zero } 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'serverspec' 2 | 3 | set :backend, :ssh 4 | 5 | options = Net::SSH::Config.for(host) 6 | options[:host_name] = ENV['KITCHEN_HOSTNAME'] 7 | options[:user] = ENV['KITCHEN_USERNAME'] 8 | options[:port] = ENV['KITCHEN_PORT'] 9 | options[:keys] = ENV['KITCHEN_SSH_KEY'] 10 | 11 | set :host, options[:host_name] 12 | set :ssh_options, options 13 | set :env, LANG: 'C', LC_ALL: 'C' 14 | set :request_pty, true 15 | -------------------------------------------------------------------------------- /tasks/collectd.yml: -------------------------------------------------------------------------------- 1 | - name: Create collectd typesdb if needed 2 | file: 3 | path: "{{ influxdb_collectd_typesdb_directory }}" 4 | state: directory 5 | tags: 6 | - influxdb 7 | 8 | - name: Check collectd types.db existence 9 | stat: 10 | path: "{{ influxdb_collectd_typesdb_directory }}/types.db" 11 | register: influxdb_collectd_typesdb 12 | tags: 13 | - influxdb 14 | 15 | - name: Get collectd types.db from github 16 | get_url: 17 | url: "{{ influxdb_collectd_typesdb_url }}" 18 | dest: "{{ influxdb_collectd_typesdb_directory }}/types.db" 19 | when: not influxdb_collectd_typesdb.stat.exists 20 | tags: 21 | - influxdb 22 | -------------------------------------------------------------------------------- /tasks/install-debian.yml: -------------------------------------------------------------------------------- 1 | - name: Install any necessary dependency 2 | apt: 3 | name: "apt-transport-https" 4 | state: present 5 | update_cache: yes 6 | cache_valid_time: 3600 7 | 8 | - name: Import InfluxData GPG signing key 9 | apt_key: 10 | url: https://repos.influxdata.com/influxdb.key 11 | state: present 12 | id: "0x2582E0C5" 13 | 14 | - name: Add InfluxData repository 15 | apt_repository: 16 | repo: deb https://repos.influxdata.com/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ influxdb_repository_channel }} 17 | state: present 18 | 19 | - name: Install InfluxDB package 20 | apt: 21 | name: influxdb 22 | state: present 23 | update_cache: yes 24 | cache_valid_time: 3600 25 | -------------------------------------------------------------------------------- /tasks/install-download.yml: -------------------------------------------------------------------------------- 1 | --- 2 | - name: Install ca-certificates 3 | apt: 4 | name: ca-certificates 5 | state: present 6 | tags: 7 | - influxdb 8 | 9 | - name: Download version when python >= 2.7.9 10 | get_url: 11 | url: "{{ influxdb_dl_url }}" 12 | dest: "{{ influxdb_pkg }}" 13 | checksum: "md5:{{ influxdb_md5_checksum }}" 14 | when: ansible_python_version|version_compare('2.7.9', '>=') 15 | tags: 16 | - influxdb 17 | 18 | - name: Install curl when python < 2.7.9 19 | apt: 20 | name: curl 21 | state: present 22 | when: ansible_python_version|version_compare('2.7.9', '<') 23 | tags: 24 | - influxdb 25 | 26 | - name: Download version when python < 2.7.9 27 | command: curl -o "{{ influxdb_pkg }}" "{{ influxdb_dl_url }}" 28 | args: 29 | creates: "{{ influxdb_pkg }}" 30 | when: ansible_python_version|version_compare('2.7.9', '<') 31 | tags: 32 | - influxdb 33 | - skip_ansible_lint 34 | 35 | - name: Install package 36 | command: "dpkg --skip-same-version -i {{ influxdb_pkg }}" 37 | register: dpkg_result 38 | changed_when: "dpkg_result.stdout.startswith('Selecting')" 39 | when: ansible_distribution in ['Ubuntu', 'Debian'] 40 | tags: 41 | - influxdb 42 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: Create influxdb group 4 | group: 5 | name: "{{ influxdb_group }}" 6 | state: present 7 | tags: 8 | - influxdb 9 | 10 | - name: Create influxdb user 11 | user: 12 | name: "{{ influxdb_user }}" 13 | group: "{{ influxdb_group }}" 14 | state: present 15 | tags: 16 | - influxdb 17 | 18 | - name: Configure collectd 19 | include: collectd.yml 20 | when: influxdb_collectd_enabled == "true" 21 | 22 | - include: install-download.yml 23 | when: influxdb_install_method == "download" 24 | tags: 25 | - influxdb 26 | 27 | - include: install-debian.yml 28 | when: influxdb_install_method == "repository" and ansible_distribution in ["Debian", "Ubuntu"] 29 | tags: 30 | - influxdb 31 | 32 | - name: Create data and config directories 33 | file: 34 | path: "{{ item }}" 35 | state: directory 36 | group: "{{ influxdb_group }}" 37 | owner: "{{ influxdb_user }}" 38 | with_items: 39 | - "{{ influxdb_data_dir }}" 40 | - "{{ influxdb_meta_dir }}" 41 | - "{{ influxdb_wal_dir }}" 42 | - "{{ influxdb_config_dir }}" 43 | tags: 44 | - influxdb 45 | 46 | - name: Write config 47 | template: 48 | src: conf.j2 49 | dest: "{{ influxdb_generated_config }}" 50 | group: "{{ influxdb_group }}" 51 | owner: "{{ influxdb_user }}" 52 | register: write_config 53 | notify: 54 | - restart influxdb 55 | tags: 56 | - influxdb 57 | 58 | - name: Run config update 59 | command: "{{ influxdb_influxd_bin }} config -config {{ influxdb_generated_config }}" 60 | register: influxdb_merged_config 61 | become: yes 62 | when: write_config | changed 63 | tags: 64 | - influxdb 65 | 66 | - name: Write merged config 67 | copy: 68 | content: "{{ influxdb_merged_config.stdout }}" 69 | dest: "{{ influxdb_config_file }}" 70 | group: "{{ influxdb_group }}" 71 | owner: "{{ influxdb_user }}" 72 | when: influxdb_merged_config | changed 73 | tags: 74 | - influxdb 75 | 76 | - name: Ensure directories have correct permissions 77 | file: 78 | path: "{{ item }}" 79 | owner: "{{ influxdb_user }}" 80 | group: "{{ influxdb_group }}" 81 | recurse: yes 82 | with_items: 83 | - "{{ influxdb_meta_dir }}" 84 | - "{{ influxdb_data_dir }}" 85 | - "{{ influxdb_wal_dir }}" 86 | tags: 87 | - influxdb 88 | 89 | - name: Write init.d script 90 | template: 91 | src: init.d.influxd.j2 92 | dest: "/etc/init.d/influxd" 93 | mode: 0755 94 | tags: 95 | - influxdb 96 | 97 | - name: Start influxdb service 98 | service: 99 | name: influxd 100 | state: started 101 | tags: 102 | - influxdb 103 | -------------------------------------------------------------------------------- /templates/conf.j2: -------------------------------------------------------------------------------- 1 | # 2 | # GENERATED BY ANSIBLE 3 | # 4 | 5 | # The values in this file override the default values used by the system if 6 | # a config option is not specified. The commented out lines are the the configuration 7 | # field and the default value used. Uncommentting a line and changing the value 8 | # will change the value used at runtime when the process is restarted. 9 | 10 | # Once every 24 hours InfluxDB will report usage data to usage.influxdata.com 11 | # The data includes a random ID, os, arch, version, the number of series and other 12 | # usage data. No data from user databases is ever transmitted. 13 | # Change this option to true to disable reporting. 14 | # reporting-disabled = false 15 | reporting-disabled = {{ influxdb_reporting_disabled }} 16 | 17 | # we'll try to get the hostname automatically, but if it the os returns something 18 | # that isn't resolvable by other servers in the cluster, use this option to 19 | # manually set the hostname 20 | # hostname = "localhost" 21 | hostname = "{{ influxdb_hostname }}" 22 | 23 | ### 24 | ### [meta] 25 | ### 26 | ### Controls the parameters for the Raft consensus group that stores metadata 27 | ### about the InfluxDB cluster. 28 | ### 29 | 30 | [meta] 31 | # Where the metadata/raft database is stored 32 | dir = "{{ influxdb_meta_dir }}" 33 | 34 | # Automatically create a default retention policy when creating a database. 35 | # retention-autocreate = true 36 | retention-autocreate = {{ influxdb_retention_autocreate }} 37 | 38 | # If log messages are printed for the meta service 39 | # logging-enabled = true 40 | logging-enabled = {{ influxdb_meta_logging_enabled }} 41 | 42 | ### 43 | ### [data] 44 | ### 45 | ### Controls where the actual shard data for InfluxDB lives and how it is 46 | ### flushed from the WAL. "dir" may need to be changed to a suitable place 47 | ### for your system, but the WAL settings are an advanced configuration. The 48 | ### defaults should work for most systems. 49 | ### 50 | 51 | [data] 52 | # The directory where the TSM storage engine stores TSM files. 53 | dir = "{{ influxdb_data_dir }}" 54 | 55 | # The directory where the TSM storage engine stores WAL files. 56 | wal-dir = "{{ influxdb_wal_dir }}" 57 | 58 | # Trace logging provides more verbose output around the tsm engine. Turning 59 | # this on can provide more useful output for debugging tsm engine issues. 60 | # trace-logging-enabled = false 61 | trace-logging-enabled = {{ influxdb_data_trace_logging_enabled }} 62 | 63 | # Whether queries should be logged before execution. Very useful for troubleshooting, but will 64 | # log any sensitive data contained within a query. 65 | # query-log-enabled = true 66 | query-log-enabled = {{ influxdb_data_query_log_enabled }} 67 | 68 | # Settings for the TSM engine 69 | 70 | # CacheMaxMemorySize is the maximum size a shard's cache can 71 | # reach before it starts rejecting writes. 72 | # cache-max-memory-size = 1048576000 73 | cache-max-memory-size = {{ influxdb_data_cache_max_memory_size }} 74 | 75 | # CacheSnapshotMemorySize is the size at which the engine will 76 | # snapshot the cache and write it to a TSM file, freeing up memory 77 | # cache-snapshot-memory-size = 26214400 78 | cache-snapshot-memory-size = {{ influxdb_data_cache_snapshot_memory_size }} 79 | 80 | # CacheSnapshotWriteColdDuration is the length of time at 81 | # which the engine will snapshot the cache and write it to 82 | # a new TSM file if the shard hasn't received writes or deletes 83 | # cache-snapshot-write-cold-duration = "10m" 84 | cache-snapshot-write-cold-duration = "{{ influxdb_data_cache_snapshot_write_cold_duration }}" 85 | 86 | # CompactFullWriteColdDuration is the duration at which the engine 87 | # will compact all TSM files in a shard if it hasn't received a 88 | # write or delete 89 | # compact-full-write-cold-duration = "4h" 90 | compact-full-write-cold-duration = "{{ influxdb_data_compact_full_write_cold_duration }}" 91 | 92 | # The maximum series allowed per database before writes are dropped. This limit can prevent 93 | # high cardinality issues at the database level. This limit can be disabled by setting it to 94 | # 0. 95 | # max-series-per-database = 1000000 96 | max-series-per-database = {{ influxdb_data_max_series_per_database }} 97 | 98 | # The maximum number of tag values per tag that are allowed before writes are dropped. This limit 99 | # can prevent high cardinality tag values from being written to a measurement. This limit can be 100 | # disabled by setting it to 0. 101 | # max-values-per-tag = 100000 102 | max-values-per-tag = {{ influxdb_data_max_values_per_tag }} 103 | 104 | ### 105 | ### [coordinator] 106 | ### 107 | ### Controls the clustering service configuration. 108 | ### 109 | 110 | [coordinator] 111 | # The default time a write request will wait until a "timeout" error is returned to the caller. 112 | # write-timeout = "10s" 113 | write-timeout = "{{ influxdb_coordinator_write_timeout }}" 114 | 115 | # The maximum number of concurrent queries allowed to be executing at one time. If a query is 116 | # executed and exceeds this limit, an error is returned to the caller. This limit can be disabled 117 | # by setting it to 0. 118 | # max-concurrent-queries = 0 119 | max-concurrent-queries = {{ influxdb_coordinator_max_concurrent_queries }} 120 | 121 | # The maximum time a query will is allowed to execute before being killed by the system. This limit 122 | # can help prevent run away queries. Setting the value to 0 disables the limit. 123 | # query-timeout = "0s" 124 | query-timeout = "{{ influxdb_coordinator_query_timeout }}" 125 | 126 | # The the time threshold when a query will be logged as a slow query. This limit can be set to help 127 | # discover slow or resource intensive queries. Setting the value to 0 disables the slow query logging. 128 | # log-queries-after = "0s" 129 | log-queries-after = "{{ influxdb_coordinator_log_queries_after }}" 130 | 131 | # The maximum number of points a SELECT can process. A value of 0 will make the maximum 132 | # point count unlimited. 133 | # max-select-point = 0 134 | max-select-point = {{ influxdb_coordinator_max_select_point }} 135 | 136 | # The maximum number of series a SELECT can run. A value of 0 will make the maximum series 137 | # count unlimited. 138 | 139 | # The maximum number of series a SELECT can run. A value of zero will make the maximum series 140 | # count unlimited. 141 | # max-select-series = 0 142 | max-select-series = {{ influxdb_coordinator_max_select_series }} 143 | 144 | # The maxium number of group by time bucket a SELECt can create. A value of zero will max the maximum 145 | # number of buckets unlimited. 146 | # max-select-buckets = 0 147 | max-select-buckets = {{ influxdb_coordinator_max_select_buckets }} 148 | 149 | ### 150 | ### [retention] 151 | ### 152 | ### Controls the enforcement of retention policies for evicting old data. 153 | ### 154 | 155 | [retention] 156 | # Determines whether retention policy enforcment enabled. 157 | # enabled = true 158 | enabled = {{ influxdb_retention_enabled }} 159 | 160 | # The interval of time when retention policy enforcement checks run. 161 | # check-interval = "30m" 162 | check-interval = "{{ influxdb_retention_check_interval }}" 163 | 164 | ### 165 | ### [shard-precreation] 166 | ### 167 | ### Controls the precreation of shards, so they are available before data arrives. 168 | ### Only shards that, after creation, will have both a start- and end-time in the 169 | ### future, will ever be created. Shards are never precreated that would be wholly 170 | ### or partially in the past. 171 | 172 | [shard-precreation] 173 | # Determines whether shard pre-creation service is enabled. 174 | # enabled = true 175 | enabled = {{ influxdb_shard_creation_enabled }} 176 | 177 | # The interval of time when the check to pre-create new shards runs. 178 | # check-interval = "10m" 179 | check-interval = "{{ influxdb_shard_creation_check_interval }}" 180 | 181 | # The default period ahead of the endtime of a shard group that its successor 182 | # group is created. 183 | # advance-period = "30m" 184 | advance-period = "{{ influxdb_shard_creation_advance_period }}" 185 | 186 | ### 187 | ### Controls the system self-monitoring, statistics and diagnostics. 188 | ### 189 | ### The internal database for monitoring data is created automatically if 190 | ### if it does not already exist. The target retention within this database 191 | ### is called 'monitor' and is also created with a retention period of 7 days 192 | ### and a replication factor of 1, if it does not exist. In all cases the 193 | ### this retention policy is configured as the default for the database. 194 | 195 | [monitor] 196 | # Whether to record statistics internally. 197 | # store-enabled = true 198 | store-enabled = {{ influxdb_monitor_store_enabled }} 199 | 200 | # The destination database for recorded statistics 201 | # store-database = "_internal" 202 | store-database = "{{ influxdb_monitor_store_database }}" 203 | 204 | # The interval at which to record statistics 205 | # store-interval = "10s" 206 | store-interval = "{{ influxdb_monitor_store_interval }}" 207 | 208 | ### 209 | ### [admin] 210 | ### 211 | ### Controls the availability of the built-in, web-based admin interface. If HTTPS is 212 | ### enabled for the admin interface, HTTPS must also be enabled on the [http] service. 213 | ### 214 | ### NOTE: This interface is deprecated as of 1.1.0 and will be removed in a future release. 215 | 216 | [admin] 217 | # Determines whether the admin service is enabled. 218 | # enabled = false 219 | enabled = {{ influxdb_admin_enabled }} 220 | 221 | # The default bind address used by the admin service. 222 | # bind-address = ":8083" 223 | bind-address = "{{ influxdb_admin_bind_address }}" 224 | 225 | # Whether the admin service should use HTTPS. 226 | # https-enabled = false 227 | https-enabled = {{ influxdb_admin_https_enabled }} 228 | 229 | # The SSL certificate used when HTTPS is enabled. 230 | # https-certificate = "/etc/ssl/influxdb.pem" 231 | https-certificate = "{{ influxdb_admin_https_certificate }}" 232 | 233 | ### 234 | ### [http] 235 | ### 236 | ### Controls how the HTTP endpoints are configured. These are the primary 237 | ### mechanism for getting data into and out of InfluxDB. 238 | ### 239 | 240 | [http] 241 | # Determines whether HTTP endpoint is enabled. 242 | # enabled = true 243 | enabled = {{ influxdb_http_enabled }} 244 | 245 | # The bind address used by the HTTP service. 246 | # bind-address = ":8086" 247 | bind-address = "{{ influxdb_http_bind_address }}" 248 | 249 | # Determines whether HTTP authentication is enabled. 250 | # auth-enabled = false 251 | auth-enabled = {{ influxdb_http_auth_enabled }} 252 | 253 | # The default realm sent back when issuing a basic auth challenge. 254 | # realm = "InfluxDB" 255 | realm = "{{ influxdb_http_realm }}" 256 | 257 | # Determines whether HTTP request logging is enable.d 258 | # log-enabled = true 259 | log-enabled = {{ influxdb_http_log_enabled }} 260 | 261 | # Determines whether detailed write logging is enabled. 262 | # write-tracing = false 263 | write-tracing = {{ influxdb_http_write_tracing }} 264 | 265 | # Determines whether the pprof endpoint is enabled. This endpoint is used for 266 | # troubleshooting and monitoring. 267 | # pprof-enabled = true 268 | pprof-enabled = {{ influxdb_http_pprof_enabled }} 269 | 270 | # Determines whether HTTPS is enabled. 271 | # https-enabled = false 272 | https-enabled = {{ influxdb_http_https_enabled }} 273 | 274 | # The SSL certificate to use when HTTPS is enabled. 275 | # https-certificate = "/etc/ssl/influxdb.pem" 276 | https-certificate = "{{ influxdb_http_https_certificate }}" 277 | 278 | # Use a separate private key location. 279 | # https-private-key = "" 280 | https_private_key = "{{ influxdb_http_https_private_key }}" 281 | 282 | # The JWT auth shared secret to validate requests using JSON web tokens. 283 | # shared-sercret = "" 284 | shared_sercret = "{{ influxdb_http_shared_sercret }}" 285 | 286 | # The default chunk size for result sets that should be chunked. 287 | # max-row-limit = 10000 288 | max_row_limit = {{ influxdb_http_max_row_limit }} 289 | 290 | # The maximum number of HTTP connections that may be open at once. New connections that 291 | # would exceed this limit are dropped. Setting this value to 0 disables the limit. 292 | # max-connection-limit = 0 293 | max_connection_limit = {{ influxdb_http_max_connection_limit }} 294 | 295 | # Enable http service over unix domain socket 296 | # unix-socket-enabled = false 297 | unix_socket_enabled = {{ influxdb_http_unix_socket_enabled }} 298 | 299 | # The path of the unix domain socket. 300 | # bind-socket = "/var/run/influxdb.sock" 301 | bind_socket = "{{ influxdb_http_bind_socket }}" 302 | 303 | ### 304 | ### [subscriber] 305 | ### 306 | ### Controls the subscriptions, which can be used to fork a copy of all data 307 | ### received by the InfluxDB host. 308 | ### 309 | 310 | [subscriber] 311 | # Determines whether the subscriber service is enabled. 312 | # enabled = true 313 | enabled = {{ influxdb_subscriber_enabled }} 314 | 315 | # The default timeout for HTTP writes to subscribers. 316 | # http-timeout = "30s" 317 | http-timeout = "{{ influxdb_subscriber_http_timeout }}" 318 | 319 | # Allows insecure HTTPS connections to subscribers. This is useful when testing with self- 320 | # signed certificates. 321 | # insecure-skip-verify = false 322 | insecure-skip-verify = {{ influxdb_subscriber_insecure_skip_verify }} 323 | 324 | # The path to the PEM encoded CA certs file. If the empty string, the default system certs will be used 325 | # ca-certs = "" 326 | ca-certs = "{{ influxdb_subscriber_ca_certs }}" 327 | 328 | # The number of writer goroutines processing the write channel. 329 | # write-concurrency = 40 330 | write-concurrency = {{ influxdb_subscriber_write_concurrency }} 331 | 332 | # The number of in-flight writes buffered in the write channel. 333 | # write-buffer-size = 1000 334 | write-buffer-size = {{ influxdb_subscriber_write_buffer_size }} 335 | 336 | ### 337 | ### [[graphite]] 338 | ### 339 | ### Controls one or many listeners for Graphite data. 340 | ### 341 | 342 | [[graphite]] 343 | # Determines whether the graphite endpoint is enabled. 344 | # enabled = false 345 | enabled = {{ influxdb_graphite_enabled }} 346 | {% if influxdb_graphite_enabled == "true" %} 347 | # database = "graphite" 348 | database = "{{ influxdb_graphite_database }}" 349 | # retention-policy = "" 350 | retention-policy = "{{ influxdb_graphite_retention_policy }}" 351 | # bind-address = ":2003" 352 | bind-address = "{{ influxdb_graphite_bind_address }}" 353 | # protocol = "tcp" 354 | protocol = "{{ influxdb_graphite_protocol }}" 355 | # consistency-level = "one" 356 | consistency-level = "{{ influxdb_graphite_consistency_level }}" 357 | 358 | # These next lines control how batching works. You should have this enabled 359 | # otherwise you could get dropped metrics or poor performance. Batching 360 | # will buffer points in memory if you have many coming in. 361 | 362 | # Flush if this many points get buffered 363 | batch-size = {{ influxdb_graphite_batch_size }} 364 | # batch-size = 5000 365 | 366 | # number of batches that may be pending in memory 367 | # batch-pending = 10 368 | batch-pending = {{ influxdb_graphite_batch_pending }} 369 | 370 | # Flush at least this often even if we haven't hit buffer limit 371 | # batch-timeout = "1s" 372 | batch-timeout = "{{ influxdb_graphite_batch_timeout }}" 373 | 374 | # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. 375 | # udp-read-buffer = 0 376 | udp-read-buffer = {{ influxdb_graphite_udp_read_buffer }} 377 | 378 | ### This string joins multiple matching 'measurement' values providing more control over the final measurement name. 379 | # separator = "." 380 | separator = "{{ influxdb_graphite_separator }}" 381 | 382 | ### Default tags that will be added to all metrics. These can be overridden at the template level 383 | ### or by tags extracted from metric 384 | # tags = ["region=us-east", "zone=1c"] 385 | {% if influxdb_graphite_tags is defined %} 386 | tags = [{{ influxdb_graphite_tags | join(",") }}] 387 | {% endif %} 388 | 389 | ### Each template line requires a template pattern. It can have an optional 390 | ### filter before the template and separated by spaces. It can also have optional extra 391 | ### tags following the template. Multiple tags should be separated by commas and no spaces 392 | ### similar to the line protocol format. There can be only one default template. 393 | # templates = [ 394 | # "*.app env.service.resource.measurement", 395 | # # Default template 396 | # "server.*", 397 | # ] 398 | templates = [{{ influxdb_graphite_templates | join(",") }}] 399 | {% endif %} 400 | 401 | ### 402 | ### [[collectd]] 403 | ### 404 | ### Controls one or many listeners for collectd data. 405 | ### 406 | 407 | [[collectd]] 408 | # enabled = false 409 | enabled = {{ influxdb_collectd_enabled }} 410 | {% if influxdb_collectd_enabled == "true" %} 411 | # bind-address = ":25826" 412 | bind-address = "{{ influxdb_collectd_bind_address }}" 413 | # database = "collectd" 414 | database = "{{ influxdb_collectd_database }}" 415 | # retention-policy = "" 416 | retention-policy = "{{ influxdb_collectd_retention_policy }}" 417 | # 418 | # The collectd service supports either scanning a directory for multiple types 419 | # db files, or specifying a single db file. 420 | # typesdb = "/usr/local/share/collectd" 421 | typesdb = "{{ influxdb_collectd_typesdb_directory }}/types.db" 422 | # 423 | # security-level = "none" 424 | security-level = "{{ influxdb_collectd_security_level }}" 425 | # auth-file = "/etc/collectd/auth_file" 426 | auth-file = "{{ influxdb_collectd_auth_file }}" 427 | 428 | # These next lines control how batching works. You should have this enabled 429 | # otherwise you could get dropped metrics or poor performance. Batching 430 | # will buffer points in memory if you have many coming in. 431 | 432 | # Flush if this many points get buffered 433 | # batch-size = 5000 434 | batch-size = {{ influxdb_collectd_batch_size }} # will flush if this many points get buffered 435 | 436 | # Number of batches that may be pending in memory 437 | # batch-pending = 10 438 | batch-pending = {{ influxdb_collectd_batch_pending }} # number of batches that may be pending in memory 439 | 440 | # Flush at least this often even if we haven't hit buffer limit 441 | # batch-timeout = "10s" 442 | batch-timeout = "{{ influxdb_collectd_batch_timeout }}" # will flush at least this often even if we haven't hit buffer limit 443 | 444 | # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. 445 | # read-buffer = 0 446 | read-buffer = {{ influxdb_collectd_read_buffer }} 447 | {% endif %} 448 | 449 | ### 450 | ### [[opentsdb]] 451 | ### 452 | ### Controls one or many listeners for OpenTSDB data. 453 | ### 454 | 455 | [[opentsdb]] 456 | # enabled = false 457 | enabled = {{ influxdb_tsb_enabled }} 458 | {% if influxdb_tsb_enabled == "true" %} 459 | # bind-address = ":4242" 460 | bind-address = "{{ influxdb_tsb_bind_address }}" 461 | # database = "opentsdb" 462 | database = "{{ influxdb_tsb_database }}" 463 | # retention-policy = "" 464 | retention-policy = "{{ influxdb_tsb_retention_policy }}" 465 | # consistency-level = "one" 466 | consistency-level = "{{ influxdb_tsb_consistency_level }}" 467 | # tls-enabled = false 468 | tls-enabled = {{ influxdb_tsb_tls_enabled }} 469 | # certificate= "/etc/ssl/influxdb.pem" 470 | certificate = "{{ influxdb_tsb_certificate }}" 471 | 472 | # Log an error for every malformed point. 473 | # log-point-errors = true 474 | log-point-errors = {{ influxdb_tsb_log_point_errors }} # Log an error for every malformed point. 475 | 476 | # These next lines control how batching works. You should have this enabled 477 | # otherwise you could get dropped metrics or poor performance. Only points 478 | # metrics received over the telnet protocol undergo batching. 479 | 480 | # Flush if this many points get buffered 481 | # batch-size = 1000 482 | batch-size = {{ influxdb_tsb_batch_size }} # will flush if this many points get buffered 483 | 484 | # Number of batches that may be pending in memory 485 | # batch-pending = 5 486 | batch-pending = {{ influxdb_tsb_batch_pending }} # number of batches that may be pending in memory 487 | 488 | # Flush at least this often even if we haven't hit buffer limit 489 | # batch-timeout = "1s" 490 | batch-timeout = "{{ influxdb_tsb_batch_timeout }}" # will flush at least this often even if we haven't hit buffer limit 491 | {% endif %} 492 | 493 | ### 494 | ### [[udp]] 495 | ### 496 | ### Controls the listeners for InfluxDB line protocol data via UDP. 497 | ### 498 | 499 | [[udp]] 500 | # enabled = false 501 | enabled = {{ influxdb_udp_enabled }} 502 | {% if influxdb_udp_enabled == "true" %} 503 | # bind-address = ":8089" 504 | bind-address = "{{ influxdb_udp_bind_address }}" 505 | # database = "udp" 506 | database = "{{ influxdb_udp_database }}" 507 | # retention-policy = "" 508 | retention-policy = "{{ influxdb_udp_retention_policy }}" 509 | 510 | # These next lines control how batching works. You should have this enabled 511 | # otherwise you could get dropped metrics or poor performance. Batching 512 | # will buffer points in memory if you have many coming in. 513 | 514 | # Flush if this many points get buffered 515 | # batch-size = 5000 516 | batch-size = {{ influxdb_udp_batch_size }} # will flush if this many points get buffered 517 | 518 | # Number of batches that may be pending in memory 519 | # batch-pending = 10 520 | batch-pending = {{ influxdb_udp_batch_pending }} # number of batches that may be pending in memory 521 | 522 | # Will flush at least this often even if we haven't hit buffer limit 523 | # batch-timeout = "1s" 524 | batch-timeout = "{{ influxdb_udp_batch_timeout }}" # will flush at least this often even if we haven't hit buffer limit 525 | 526 | # UDP Read buffer size, 0 means OS default. UDP listener will fail if set above OS max. 527 | # read-buffer = 0 528 | read-buffer = {{influxdb_udp_read_buffer}} 529 | {% endif %} 530 | 531 | ### 532 | ### [continuous_queries] 533 | ### 534 | ### Controls how continuous queries are run within InfluxDB. 535 | ### 536 | 537 | [continuous_queries] 538 | # Determiens whether the continuous query service is enabled. 539 | # enabled = true 540 | enabled = {{ influxdb_cqueries_enabled }} 541 | 542 | # Controls whether queries are logged when executed by the CQ service. 543 | # log-enabled = true 544 | log-enabled = {{ influxdb_cqueries_log_enabled }} 545 | 546 | # interval for how often continuous queries will be checked if they need to run 547 | # run-interval = "1s" 548 | run-interval = "{{ influxdb_cqueries_run_interval }}" 549 | -------------------------------------------------------------------------------- /templates/init.d.influxd.j2: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | ### BEGIN INIT INFO 4 | # Provides: influxd 5 | # Required-Start: $all 6 | # Required-Stop: $remote_fs $syslog 7 | # Default-Start: 2 3 4 5 8 | # Default-Stop: 0 1 6 9 | # Short-Description: Start influxd at boot time 10 | ### END INIT INFO 11 | 12 | # If you modify this, please make sure to also edit influxdb.service 13 | # this init script supports three different variations: 14 | # 1. New lsb that define start-stop-daemon 15 | # 2. Old lsb that don't have start-stop-daemon but define, log, pidofproc and killproc 16 | # 3. Centos installations without lsb-core installed 17 | # 18 | # In the third case we have to define our own functions which are very dumb 19 | # and expect the args to be positioned correctly. 20 | 21 | # Command-line options that can be set in /etc/default/influxdb. These will override 22 | # any config file values. Example: "-join http://1.2.3.4:8086" 23 | DEFAULT=/etc/default/influxdb 24 | 25 | # Daemon options 26 | INFLUXD_OPTS="{{ influxdb_influxd_opts }}" 27 | 28 | # Process name ( For display ) 29 | NAME=influxdb 30 | 31 | # User and group 32 | USER={{ influxdb_user }} 33 | GROUP={{ influxdb_group }} 34 | 35 | # Daemon name, where is the actual executable 36 | # If the daemon is not there, then exit. 37 | DAEMON={{ influxdb_influxd_bin }} 38 | [ -x $DAEMON ] || exit 5 39 | 40 | # Configuration file 41 | CONFIG={{ influxdb_config_file }} 42 | 43 | # PID file for the daemon 44 | PIDFILE=/var/run/influxdb/influxd.pid 45 | PIDDIR=`dirname $PIDFILE` 46 | if [ ! -d "$PIDDIR" ]; then 47 | mkdir -p $PIDDIR 48 | chown $USER:$GROUP $PIDDIR 49 | fi 50 | 51 | # Max open files 52 | OPEN_FILE_LIMIT=65536 53 | 54 | if [ -r /lib/lsb/init-functions ]; then 55 | source /lib/lsb/init-functions 56 | fi 57 | 58 | # Logging 59 | if [ -z "$STDOUT" ]; then 60 | STDOUT=/dev/null 61 | fi 62 | 63 | if [ ! -f "$STDOUT" ]; then 64 | mkdir -p $(dirname $STDOUT) 65 | fi 66 | 67 | if [ -z "$STDERR" ]; then 68 | STDERR=/var/log/influxdb/influxd.log 69 | fi 70 | 71 | if [ ! -f "$STDERR" ]; then 72 | mkdir -p $(dirname $STDERR) 73 | fi 74 | 75 | # Overwrite init script variables with /etc/default/influxdb values 76 | if [ -r $DEFAULT ]; then 77 | source $DEFAULT 78 | fi 79 | 80 | function pidofproc() { 81 | if [ $# -ne 3 ]; then 82 | echo "Expected three arguments, e.g. $0 -p pidfile daemon-name" 83 | fi 84 | 85 | PID=`pgrep -f $3` 86 | local PIDFILE=`cat $2` 87 | 88 | if [ "x$PIDFILE" == "x" ]; then 89 | return 1 90 | fi 91 | 92 | if [ "x$PID" != "x" -a "$PIDFILE" == "$PID" ]; then 93 | return 0 94 | fi 95 | 96 | return 1 97 | } 98 | 99 | function killproc() { 100 | if [ $# -ne 3 ]; then 101 | echo "Expected three arguments, e.g. $0 -p pidfile signal" 102 | fi 103 | 104 | PID=`cat $2` 105 | 106 | /bin/kill -s $3 $PID 107 | while true; do 108 | pidof `basename $DAEMON` >/dev/null 109 | if [ $? -ne 0 ]; then 110 | return 0 111 | fi 112 | 113 | sleep 1 114 | n=$(expr $n + 1) 115 | if [ $n -eq 30 ]; then 116 | /bin/kill -s SIGKILL $PID 117 | return 0 118 | fi 119 | done 120 | } 121 | 122 | function log_failure_msg() { 123 | echo "$@" "[ FAILED ]" 124 | } 125 | 126 | function log_success_msg() { 127 | echo "$@" "[ OK ]" 128 | } 129 | 130 | case $1 in 131 | start) 132 | # Check if config file exist 133 | if [ ! -r $CONFIG ]; then 134 | log_failure_msg "config file doesn't exist (or you don't have permission to view)" 135 | exit 4 136 | fi 137 | 138 | # Checked the PID file exists and check the actual status of process 139 | if [ -e $PIDFILE ]; then 140 | PID="$(pgrep -f $PIDFILE)" 141 | if test ! -z $PID && kill -0 "$PID" &>/dev/null; then 142 | # If the status is SUCCESS then don't need to start again. 143 | log_failure_msg "$NAME process is running" 144 | exit 0 # Exit 145 | fi 146 | # if PID file does not exist, check if writable 147 | else 148 | su -s /bin/sh -c "touch $PIDFILE" $USER > /dev/null 2>&1 149 | if [ $? -ne 0 ]; then 150 | log_failure_msg "$PIDFILE not writable, check permissions" 151 | exit 5 152 | fi 153 | fi 154 | 155 | # Bump the file limits, before launching the daemon. These will carry over to 156 | # launched processes. 157 | ulimit -n $OPEN_FILE_LIMIT 158 | if [ $? -ne 0 ]; then 159 | log_failure_msg "set open file limit to $OPEN_FILE_LIMIT" 160 | exit 1 161 | fi 162 | 163 | log_success_msg "Starting the process" "$NAME" 164 | if which start-stop-daemon > /dev/null 2>&1; then 165 | start-stop-daemon --chuid $GROUP:$USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- -pidfile $PIDFILE -config $CONFIG $INFLUXD_OPTS >>$STDOUT 2>>$STDERR & 166 | else 167 | su -s /bin/sh -c "nohup $DAEMON -pidfile $PIDFILE -config $CONFIG $INFLUXD_OPTS >>$STDOUT 2>>$STDERR &" $USER 168 | fi 169 | log_success_msg "$NAME process was started" 170 | ;; 171 | 172 | stop) 173 | # Stop the daemon. 174 | if [ -e $PIDFILE ]; then 175 | PID="$(pgrep -f $PIDFILE)" 176 | if test ! -z $PID && kill -0 "$PID" &>/dev/null; then 177 | if killproc -p $PIDFILE SIGTERM && /bin/rm -rf $PIDFILE; then 178 | log_success_msg "$NAME process was stopped" 179 | else 180 | log_failure_msg "$NAME failed to stop service" 181 | fi 182 | fi 183 | else 184 | log_failure_msg "$NAME process is not running" 185 | fi 186 | ;; 187 | 188 | restart) 189 | # Restart the daemon. 190 | $0 stop && sleep 2 && $0 start 191 | ;; 192 | 193 | status) 194 | # Check the status of the process. 195 | if [ -e $PIDFILE ]; then 196 | PID="$(pgrep -f $PIDFILE)" 197 | if test ! -z $PID && test -d "/proc/$PID" &>/dev/null; then 198 | log_success_msg "$NAME Process is running" 199 | exit 0 200 | else 201 | log_failure_msg "$NAME Process is not running" 202 | exit 1 203 | fi 204 | else 205 | log_failure_msg "$NAME Process is not running" 206 | exit 3 207 | fi 208 | ;; 209 | 210 | version) 211 | $DAEMON version 212 | ;; 213 | 214 | *) 215 | # For invalid arguments, print the usage message. 216 | echo "Usage: $0 {start|stop|restart|status|version}" 217 | exit 2 218 | ;; 219 | esac 220 | -------------------------------------------------------------------------------- /templates/iptables.j2: -------------------------------------------------------------------------------- 1 | 2 | # InfluxDB 3 | -A INPUT -p tcp -m multiport --dports {{ influxdb_admin_port }},{{ influxdb_api_port }},{{ influxdb_proto_port }} -j ACCEPT 4 | -A INPUT -p udp -m multiport --dports {{ influxdb_admin_port }},{{ influxdb_api_port }},{{ influxdb_proto_port }} -j ACCEPT 5 | 6 | # InfluxDB Graphite Port 7 | {% if influxdb_graphite_plugin_enabled == "true" %} 8 | -A INPUT -p tcp --dport {{ influxdb_graphite_plugin_port }} -j ACCEPT 9 | {% endif %} 10 | 11 | -------------------------------------------------------------------------------- /templates/upstart.j2: -------------------------------------------------------------------------------- 1 | description "Influxdb" 2 | 3 | start on runlevel [2345] 4 | stop on runlevel [!2345] 5 | 6 | respawn 7 | respawn limit 10 5 8 | 9 | limit nofile unlimited unlimited 10 | 11 | console log 12 | 13 | env GOMAXPROCS={{ influxdb_maxprocs }} 14 | 15 | exec sudo su -u {{ influxdb_user }} -c "usr/bin/influxdb -config={{ influxdb_config_file }}" 16 | -------------------------------------------------------------------------------- /test/integration/collectd/ansiblespec/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - 4 | playbook: role.yml 5 | inventory: hosts 6 | kitchen_path: "/tmp/kitchen" 7 | pattern: "spec" 8 | user: root 9 | -------------------------------------------------------------------------------- /test/integration/default/ansiblespec/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'rake' 4 | gem 'busser-ansiblespec' 5 | -------------------------------------------------------------------------------- /test/integration/default/ansiblespec/config.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - 4 | playbook: role.yml 5 | inventory: hosts 6 | kitchen_path: "/tmp/kitchen" 7 | pattern: "spec" 8 | user: root 9 | -------------------------------------------------------------------------------- /vars/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # vars for influxdb 3 | --------------------------------------------------------------------------------