This is a Chef cookbook to manage InfluxDB Telegraf.
For Production environment, always prefer the most recent release.
cookbook 'telegraf', '~> 0.0.2'
cookbook 'telegraf', github: 'vkhatri/chef-telegraf', tag: "v0.0.2"
https://github.com/vkhatri/chef-telegraf-ng
This cookbook was tested on Amazon & Ubuntu Linux and expected to work on other RHEL platforms.
None
- add ubuntu version pin support
-
telegraf::default
- default recipe (use it for run_list) -
telegraf::install
- install telegraf -
telegraf::config
- configure telegraf -
telegraf::inputs
- configure telegraf inputs using node attributenode['telegraf']['inputs']
-
telegraf::outputs
- configure telegraf outputs using node attributenode['telegraf']['outputs']
-
telegraf::service
- configure telegraf service -
telegraf::example
- examples recipe to configure default inputs/outputs using HWRP
HWRP telegraf_input
creates telegraf inputs configuration files under directory node['telegraf']['conf_d_dir']
with file name input-#{resource_name}.conf
.
HWRP example
telegraf_input 'cpu' do
config fielddrop: ['time_*']
end
HWRP Options
- action (optional) - default :create, options: :create, :delete
- config (optional, Hash) - telegraf input options
- name (optional, String) - telegraf input name
HWRP telegraf_output
creates telegraf outputs configuration files under directory node['telegraf']['conf_d_dir']
with file name output-#{resource_name}.conf
.
HWRP example
telegraf_output 'influxdb' do
config urls: ['http://localhost:8086'], database: 'telegraf', precision: 's'
end
HWRP Options
- action (optional) - default :create, options: :create, :delete
- config (optional, Hash) - telegraf output options
- name (optional, String) - telegraf output name
{
"default_attributes": {
"telegraf": {
"inputs": {
"cpu": {
"fielddrop": ["time_*"]
},
"disk": {
"ignore_fs": ["tmpfs", "devtmpfs"]
},
"diskio": {},
"kernel": {},
"mem": {},
"processes": {},
"net": {
"interfaces": ["eth0"]
},
"swap": {},
"system": {},
"ntpq": {},
"netstat": {},
"procstat": {
"pattern": "/usr/bin/telegraf"
}
}
}
}
}
{
"default_attributes": {
"telegraf": {
"outputs": {
"influxdb": {
"urls": ["http://localhost:8086"],
"database": "telegraf",
"precision": "s"
}
}
}
}
}
-
default['telegraf']['version']
(default:1.2.1
): telegraf version, applicable only torhel
platform -
default['telegraf']['ignore_version']
(default:false
): ignore telegraf version -
default['telegraf']['conf_dir']
(default:/etc/telegraf
): telegraf toml configuration file directory -
default['telegraf']['conf_d_dir']
(default:/etc/telegraf/telegraf.d
): telegraf inputs/outputs configuration files directory -
default['telegraf']['conf_file']
(default:/etc/telegraf/telegraf.conf
): telegraf configuration file -
default['telegraf']['notify_restart']
(default:true
): whether to restart telegraf service on configuration file change -
default['telegraf']['disable_service']
(default:false
): whether to stop and disable telegraf service -
default['telegraf']['user']
(default:telegraf
): telegraf user -
default['telegraf']['group']
(default:telegraf
): telegraf group
-
default['telegraf']['config']['tags']
(default:{}
): telegraf global tags -
default['telegraf']['config']['agent']['interval']
(default:10s
): telegraf agent configuration parameter -
default['telegraf']['config']['agent']['round_interval']
(default:true
): telegraf agent configuration parameter -
default['telegraf']['config']['agent']['flush_interval']
(default:10s
): telegraf agent configuration parameter -
default['telegraf']['config']['agent']['flush_jitter']
(default:5s
): telegraf agent configuration parameter
-
default['telegraf']['yum']['description']
(default: ``): telegraf yum reporitory attribute -
default['telegraf']['yum']['gpgcheck']
(default:true
): telegraf yum reporitory attribute -
default['telegraf']['yum']['enabled']
(default:true
): telegraf yum reporitory attribute -
default['telegraf']['yum']['baseurl']
(default:calculated
): telegraf yum reporitory attribute -
default['telegraf']['yum']['gpgkey']
(default:https://repos.influxdata.com/influxdb.key
): telegraf yum reporitory attribute -
default['telegraf']['yum']['action']
(default::create
): telegraf yum reporitory attribute -
default['telegraf']['apt']['description']
(default: ``): telegraf apt reporitory attribute -
default['telegraf']['apt']['components']
(default:['stable']
): telegraf apt reporitory attribute -
default['telegraf']['apt']['uri']
(default:https//repos.influxdata.com/debian
): telegraf apt reporitory attribute -
default['telegraf']['apt']['key']
(default:https//repos.influxdata.com/influxdb.key
): telegraf apt reporitory attribute -
default['telegraf']['apt']['action']
(default::add
): telegraf apt reporitory attribute
- Fork the repository on Github
- Create a named feature branch (like
add_component_x
) - Write your change
- Write tests for your change (if applicable)
- Run the tests (
rake & rake knife
), ensuring they all pass - Write new resource/attribute description to
README.md
- Write description about changes to PR
- Submit a Pull Request using Github
Authors:: Virender Khatri and Contributors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.