dj-wasabi / ansible-telegraf Goto Github PK
View Code? Open in Web Editor NEWInstalling and configuring Telegraf via Ansible for RedHat/Debian/Ubuntu/Windows/Suse.
License: MIT License
Installing and configuring Telegraf via Ansible for RedHat/Debian/Ubuntu/Windows/Suse.
License: MIT License
Is your feature request related to a problem? Please describe.
When using inputs.logparser, I'd like to template applying grok filters - this requires a file which looks like
`
[[inputs.logparser]]
files = ["/var/log/apache/access.log"]
from_beginning = False
[inputs.logparser.grok]
patterns = ["%{COMBINED_LOG_FORMAT}"]
measurement = "apache_access_log"
`
I'm unsure if this is possible already with this role, but I couldn't figure it out.
Describe the solution you'd like
Modify the templates to allow custom 'subplugins' (I don't really know the Telegraf nomenclature) - with this, you could also remove the entries for tags, tagpass, tagdrop parts and pass them as subplugins
This seems to be working for me
`{% if item.value.subplugin is defined and item.value.subplugin is iterable %}
{% for subpluginname in item.value.subplugin %}
[inputs.{{ item.value.plugin | default(item.key) }}.{{ subpluginname }}]
{% for items in item.value.subplugin[subpluginname] %}
{{ items }}
{% endfor %}
{% endfor %}
{% endif %}
`
Additional context
eg group_vars file
logparser:
config:
- files = ["/var/log/apache/access.log"]
- from_beginning = False
subplugin:
grok:
- patterns = ["%{COMBINED_LOG_FORMAT}"]
- measurement = "apache_access_log"
Is it possible to achieve the following config using telegraf_plugin_extra
? All the jolokia2_agent.metric
inputs must stay together with the jolokia2_agent
input, in a single file to make it work.
[[inputs.jolokia2_agent]]
urls = ["http://localhost:19405/jolokia"]
[[inputs.jolokia2_agent.metric]]
name = "heap_memory_usage"
mbean = "java.lang:type=Memory"
paths = ["HeapMemoryUsage"]
[[inputs.jolokia2_agent.metric]]
name = "thread_count"
mbean = "java.lang:type=Threading"
paths = ["TotalStartedThreadCount","ThreadCount","DaemonThreadCount","PeakThreadCount"]
[[inputs.jolokia2_agent.metric]]
name = "garbage_collector"
mbean = "java.lang:type=GarbageCollector,name=*"
paths = ["CollectionCount","CollectionTime"]
tag_keys = ["name"]
[[inputs.jolokia2_agent.metric]]
name = "zookeeper_service"
mbean = "org.apache.ZooKeeperService:name0=ReplicatedServer_id1,name1=*"
Describe the bug
The deprecation of apt-key is causing this playbook to fail on Debian 11 hosts due to the warning message that is returned on stderr along with the expected output.
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
Installation method/version
Ansible Version
AWX 21.13.0
Targetted hosts
Concerns the following OS(es):
Expected behavior
The playbook should use the newer method of putting the keyfiles in the trusted.gpg.d directory for hosts on Debian 11 or Ubuntu 22.04, which are the first releases to start displaying the deprecation warning.
Additional context
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/apt_key_module.html#notes
TASK [dj-wasabi.telegraf : Debian | Download Telegraf apt key] *****************
FAILED - RETRYING: [***************]: Debian | Download Telegraf apt key (3 retries left).
FAILED - RETRYING: [***************]: Debian | Download Telegraf apt key (2 retries left).
FAILED - RETRYING: [***************]: Debian | Download Telegraf apt key (1 retries left).
fatal: [************]: FAILED! => {"attempts": 3, "changed": false, "cmd": "/usr/bin/apt-key adv --list-public-keys --keyid-format=long", "msg": "Unable to list public keys", "rc": 1, "stderr": "Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).\ngpg: key 684A14CF2582E0C5: \"InfluxDB Packaging Service <[email protected]>\" not changed\ngpg: key DDCAE044F796ECB0: \"NVIDIA CORPORATION (Open Source Projects) <[email protected]>\" not changed\ngpg: key 8B57C5C2836F4BEB: \"gLinux Rapture Automatic Signing Key (//depot/google3/production/borg/cloud-rapture/keys/cloud-rapture-pubkeys/cloud-rapture-signing-key-2020-12-03-16_08_05.pub) <[email protected]>\" not changed\ngpg: key FEEA9169307EA071: \"Rapture Automatic Signing Key (cloud-rapture-signing-key-2021-03-01-08_01_09.pub)\" not changed\ngpg: key 7C3D57159FC2F927: \"InfluxData Package Signing Key <[email protected]>\" not changed\ngpg: key 73A4F27B8DD47936: 5 signatures not checked due …
**Is your feature request related to a problem?
Hi, it possible add influxdb v2 to role?
in playbook can add:
telegraf_agent_output:
but the new influxdb2 need new configurations (bucket, token, organization and url)
https://github.com/influxdata/telegraf/blob/master/plugins/outputs/influxdb_v2/README.md
maybe one time influxdb2 and add the new inputs or detect (organization, token, etc)
Is your feature request related to a problem? Please describe.
I can't add the same plugin with different config. For example I want to monitor some services with procstat, multiple procstat configs overrides eachother.
Describe the solution you'd like
Ability to add many configurations of the same plugin
Additional context
Thank you!
Hello,
i use this role with multiple groups (postgres_database, rabbitmq)
For this, i use groups_vars files to specify extra_plugins (group_vars/postgres_database, group_vars/rabbitmq)
These files contains:
telegraf_plugins_extra:
- plugin: postgresql
config:
- address = "postgres://user:password@localhost/postgres"
telegraf_plugins_extra:
- plugin: rabbitmq
config:
- url = "http://localhost:15672"
If a server is one two roles (database and rabbitmq), the file /etc/telegraf/telegraf.d/extra-plugins.conf contain only the rabbitmq.
Do you know how i can aggregate this two have the postgresql and rabbitmq in this server ?
Best regards
Describe the bug
I defined the the output as outputs.prometheus_client and added the listener port;
however the telegraf service doesnt start; error 1067 the process terminated unexpectedly.
Installation method/version
Ansible Version
2.8
<!--- Paste output from "ansible --version" -->
fatal: [vm-xxxxx]: FAILED! => {"can_pause_and_continue": false, "changed": false, "depended_by": [], "dependencies": [], "description": "Collects data using a series of plugins and publishes it toanother series of plugins.", "desktop_interact": false, "display_name": "Telegraf Data Collector Service", "exists": true, "msg": "Failed to start service 'Telegraf Data Collector Service (telegraf)'.", "name": "telegraf", "path": "C:\Telegraf\telegraf\telegraf.exe --config C:\Telegraf\telegraf\telegraf.conf --config-directory C:\Telegraf\telegraf_agent.d --service-name telegraf", "start_mode": "auto", "state": "stopped", "username": "LocalSystem"}
Targetted hosts
Concerns the following OS(es):
Expected behavior
telegraf service to start after installing telegraf
Additional context
output changed from influx db to
[[outputs.prometheus_client]]
listen = ":9273"
also windows event viewer shows:
After PR #37, i cannot use multiple instances of same plugin.
Example:
telegraf_plugins_extra:
- plugin: ping
config:
- urls = [
"host1.int",
"host2.int"
]
- count = 4
- ping_interval = 1.0
- timeout = 1.0
- plugin: ping
config:
- urls = [
"host1",
"host2"
]
- count = 4
- ping_interval = 1.0
- timeout = 1.0
Role tries to write first instance, then second, creating always-changed state.
Hello,
Is your feature request related to a problem? Please describe.
I’m trying not to have any plugin in the telegraf.conf
file because I manage everything under telegraf.d
, but if I use telegraf_plugins_default: []
the playbook includes this code:
# No plugins configured, added a mem plugin so telegraf doesn't stop working.
[[inputs.mem]]
I can’t find a way to have nothing here.
Describe the solution you'd like
A variable of some sort to disable the behavior of adding inputs.mem
if there are no plugins.
The role provides no mechanism to install a specific verison of telegraf. The role does not provide a mechanism to upgrade out of date installs to the latest version
Describe the solution you'd like
By default, the role should continue to install with "state = present". We should be able to pass into the role a "TELEGRAF_VERSION" of either "latest" or to specific version
This is half bug report, half feature request:
Describe the bug
In some nodes I'm getting weird hostnames, mostly localhost.localdomain
. Those nodes show proper configuration in hostnamectl
. I've seen you're using 'ansible_fqdn' as default.
Seems like ansible_fqdn and ansible_hostname can give different results, and sometimes even very weird results, as it sometimes makes DNS calls (which is not under my control in that cases) to infer that names.
Fix proposal
In my playbook I've added this parameter:
telegraf_agent_hostname: "{{ ansible_nodename }}"
If you don't want to change the default on this role, for fear of breaking things, maybe it should be noted on the README that users might need or want to change it on their playbooks.
Installation method/version
Ansible Version
ansible 2.8.2
config file = /home/agonzalez/Documents/repos/monitoringdeployment/ansible.cfg
configured module search path = ['/home/agonzalez/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/agonzalez/Documents/repos/monitoringdeployment/venv/lib/python3.7/site-packages/ansible
executable location = /home/agonzalez/Documents/repos/monitoringdeployment/venv/bin/ansible
python version = 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0]
Targetted hosts
Concerns the following OS(es):
Describe the bug
When it comes to setting the variable telegraf_agent_package
Debian is behaving differently from any other distro.
The README states:
"telegraf_agent_package: The name of the Telegraf package to install. When telegraf_agent_package_method is set to online or offline, it needs to have the full path of the file. Example: telegraf_agent_package: /tmp/telegraf.rpm. Default: telegraf_agent_package: telegraf."
For method online
setting the full path does not work with Debian.
The culprit seems to be in these two lines, where the package path is built from two variables and telegraf_agent_package
is expected to be only the package name:
https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/Debian.yml#L75
https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/Debian.yml#L97
Compare to e.g. RedHat where only one variable is used which expects the full path:
https://github.com/dj-wasabi/ansible-telegraf/blob/master/tasks/RedHat.yml#L30
Installation method/version
Targeted hosts
Concerns the following OS(es):
Expected behavior
Set variables
telegraf_agent_package_method: online
telegraf_agent_package: /tmp/telegraf.rpm
(full package path)
Rollout works for all distros.
Current behavior
Set variables
telegraf_agent_package_method: online
telegraf_agent_package: /tmp/telegraf.rpm
(full package path)
-> Rollout fails for Debian. Rollout works for RedHat etc.
Set variables
telegraf_agent_package_method: online
telegraf_agent_package_path: /tmp
telegraf_agent_package: telegraf.rpm
-> Rollout works for Debian only.
Additional context
Because of this bug the variable telegraf_agent_package
cannot be configured to universally work with Debian AND the other distros.
You can work around the problem if you are only every using the role for either Debian OR RedHat/... based systems by setting the variables as stated above under "Current behavior". This however does not apply to our setup where we maintain servers running a mixture of those distros.
Module commit: 08b1c62
Telegraf version:
root@ip-10-10-37-179:/opt/ct/jenkins# telegraf --version
Telegraf 1.14.5 (git: HEAD e77ce3d1)
Configuration:
- role: dj-wasabi.telegraf
tags:
- register
vars:
telegraf_agent_docker: False
telegraf_agent_package_state: latest
telegraf_agent_interval: 60
telegraf_agent_aws_tags: "{{ True if ansible_system_vendor in ['Xen', 'Amazon EC2'] else False }}"
telegraf_global_tags:
- tag_name: type
tag_value: jenkins-node
- tag_name: host
tag_value: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
telegraf_plugins_default:
- plugin: cpu
config:
- percpu = true
- totalcpu = true
- plugin: disk
tagpass:
- fstype = [ "ext4", "xfs" ]
tagdrop:
- path = [ "/etc", "/etc/telegraf", "/etc/hostname", "/etc/hosts", "/etc/resolv.conf" ]
- plugin: io
- plugin: diskio
- plugin: mem
- plugin: system
- plugin: swap
- plugin: net
- plugin: netstat
- plugin: processes
- plugin: docker
config:
- endpoint = "unix:///var/run/docker.sock"
- timeout = "5s"
Error:
root@ip-10-10-37-179:/opt/ct/jenkins# telegraf --test
2020-07-10T12:10:18Z I! Starting Telegraf 1.14.5
2020-07-10T12:10:18Z I! Using config file: /etc/telegraf/telegraf.conf
2020-07-10T12:10:18Z E! [telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.conf, line 8: invalid TOML syntax
root@ip-10-10-37-179:/opt/ct/jenkins# cat /etc/telegraf/telegraf.conf
### MANAGED BY dj-wasabi.telegraf ANSIBLE ROLE ###
[global_tags]
type = "jenkins-node"
host = "10.10.37.179"
Name = "jenkins-node-packer-ami-1594382147"
aws:ec2:fleet-id = "fleet-a220eec6-fe8b-a982-8c30-23a2263d55ae"
aws:ec2launchtemplate:id = "lt-0fed73d26801b6895"
aws:ec2launchtemplate:version = "1"
# Configuration for telegraf agent
[agent]
interval = "60s"
debug = false
hostname = "ip-10-10-37-179.eu-west-1.compute.internal"
round_interval = true
flush_interval = "10s"
flush_jitter = "0s"
collection_jitter = "0s"
metric_batch_size = 1000
metric_buffer_limit = 10000
quiet = false
logfile = ""
omit_hostname = false
Describe the bug
FAILED - RETRYING: Debian | Install Telegraf package (1 retries left).
fatal: [sedge-01]: FAILED! => {"attempts": 3, "cache_update_time": 1588931069, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'telegraf=1.10.0-1'' failed: E: Version '1.10.0-1' for 'telegraf' was not found\n", "rc": 100, "stderr": "E: Version '1.10.0-1' for 'telegraf' was not found\n", "stderr_lines": ["E: Version '1.10.0-1' for 'telegraf' was not found"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}
Installation method/version
Ansible Galaxy / latest
Ansible Version
ansible 2.9.7
Targetted hosts
Concerns the following OS(es):
Describe the bug
The aws ec2 tag module does not support listing of tags anymore, use the desired amazon.aws.ec2_tag_info role instead.
Installation method/version
Ansible Version
ansible --version
ansible [core 2.15.4]
Targetted hosts
Expected behavior
Additional context
The module "ec2_tag_module" state option "list" has been deprecated since version 4.0.0 and moved to the module "amazon.aws.ec2_tag_info"
Source:
https://docs.ansible.com/ansible/latest/collections/amazon/aws/ec2_tag_module.html#parameter-state
Describe the bug
The initial commit that added SUSE support to this role hard-coded the respository URL to use the openSUSE Tumbleweed build. As Tumbleweed rolled on, new requirements for glibc came with it, and the builds stopped being usable on other releases. That was worked around in commit 3596c7b (Add variable for openSUSE RPM repository (#151)) but we can do better.
The repositories for the telegraf packages have well known locations on openSUSE's Open Build Service download server. We can choose from several repositories as the various Red Hat derivatives do already. In order not to break
Installation method/version
Ansible Version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/jeffm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.12 (default, Aug 31 2021, 01:23:42) [GCC]
Targetted hosts
Concerns the following OS(es):
Any SUSE release other than openSUSE Tumbleweed
Expected behavior
The appropriate repository for the release is used.
Additional context
It should be possible to simply add the obs://devel:languages:go
repository and let zypper handle the rest, but the Ansible zypper module tries to confirm that a repository has been added using the provided URL and that fails.
I've fixed this locally and will start a PR after submitting this issue to use as a reference.
Describe the bug
Telegraf appears to have changed their package structure in newer versions. Extracting version 1.10.0 which is the default in the playbook and downloads telegraf-1.10.0_windows_amd64.zip generates a directory name telegraf whereas downloading version 1.16.3 and file telgraf-1.16.3_windows_amd64.zip extracts to a directory named telegraf-1.16.3
Archive: telegraf-1.16.3_windows_amd64.zip
creating: telegraf-1.16.3/
inflating: telegraf-1.16.3/telegraf.conf
inflating: telegraf-1.16.3/telegraf.exe
This causes the step task, after Unzip File, named Configure Telegraf to fail in ansible-telegraf/tasks/configure_windows.yml
"msg": "Destination directory 'C:\Telegraf\telegraf' does not exist"}
Seems like this began in telegraf version 15?
Archive: ../telegraf-1.14.0_windows_amd64.zip
creating: telegraf/
inflating: telegraf/telegraf.exe
inflating: telegraf/telegraf.conf
Installation method/version
dj-wasabi.telegraf, 0.13.0
Ansible Version
ansible 2.9.13
config file = /Users/heckelrj/.ansible.cfg
configured module search path = ['/Users/heckelrj/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.2 (default, Mar 11 2020, 00:28:52) [Clang 11.0.0 (clang-1100.0.33.17)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
Expect that the telegraf be exported into a directory named telegraf perhaps?
If I configure a telegraf_plugins_extra, run ansible, delete the plugin and run ansible again, the plugin stays on the machine.
The "easy" way out is to just nuke /etc/telegraf/telegraf.d/*, though that will force to restart telegraf
Do this before copying the extra plugins:
- name: "Delete extra plugins"
shell: "rm -rf /etc/telegraf/telegraf.d/*"
Describe the bug
When using telegraf_agent_package_method=online
, the proxy configuration on the remote hosts is not taken into consideration, which causes the package download to fail with a "Connection refused" error.
PS: Downloading the package manually on the host using wget
works fine.
user@remote-host$ wget https://dl.influxdata.com/telegraf/releases/telegraf-1.10.2-1.x86_64.rpm
--2019-04-10 12:15:45-- https://dl.influxdata.com/telegraf/releases/telegraf-1.10.2-1.x86_64.rpm
Connecting to 192.168.38.10:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 17902995 (17M) [application/x-redhat-package-manager]
Saving to: ‘telegraf-1.10.2-1.x86_64.rpm’
100%[====================================================================================================================>] 17,902,995 53.2MB/s in 0.3s
2019-04-10 12:15:45 (53.2 MB/s) - ‘telegraf-1.10.2-1.x86_64.rpm’ saved [17902995/17902995]
Not sure if that's not supported by the role, or if I am doing something wrong.
TASK [dj-wasabi.telegraf : RedHat | Download Telegraf package (online)] **************************************************************************************
fatal: [host1]: FAILED! => {"changed": false, "msg": "Failed to connect to dl.influxdata.com at port 443: [Errno 111] Connection refused"}
fatal: [host2]: FAILED! => {"changed": false, "msg": "Failed to connect to dl.influxdata.com at port 443: [Errno 111] Connection refused"}
fatal: [host3]: FAILED! => {"changed": false, "msg": "Failed to connect to dl.influxdata.com at port 443: [Errno 111] Connection refused"}
fatal: [host4]: FAILED! => {"changed": false, "msg": "Failed to connect to dl.influxdata.com at port 443: [Errno 111] Connection refused"}
Installation method/version
Ansible Version
ansible 2.7.8
config file = None
configured module search path = ['/Users/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.7.8/libexec/lib/python3.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.7.2 (default, Feb 12 2019, 08:16:11) [Clang 9.0.0 (clang-900.0.39.2)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
When proxy configuration is set on the remote hosts, the module should use it to download the telegraf package.
Additional context
To make it work, I had to make the following change to the task:
- name: "RedHat | Download Telegraf package (online)"
get_url:
url: https://dl.influxdata.com/telegraf/releases/telegraf-{{ telegraf_agent_version }}-{{ telegraf_agent_version_patch }}.{{ ansible_architecture }}.#
dest: "{{ telegraf_agent_package }}"
use_proxy: true
environment:
http_proxy: "{{ http_proxy }}"
https_proxy: "{{ http_proxy }}"
when:
- telegraf_agent_package_method == "online"
And set the proxy in my vars files:
http_proxy: http://<PROXY_IP>:<PROXY_PORT>
Would you be interested in supporting Telegraf running in Docker? If so, I will be willing to add this feature. Before I start forking, I'd like to know if you are interested.
adding support for FreeBSD via pkg
as telegraf is in the official pkg repos for FreeBSD i guess it would be easy to adopt another Platform. I started to port your role to FreeBSD, but my ansible knowledge is very basic.
If you download the role from galaxy, the role breaks because 0.3.0 (the actual version) does not have the fix for the changed URL for .deb packages. A new release should fix that.
Is your feature request related to a problem? Please describe.
It is possible to configure plugins but the dependencies are still not installed.
Describe the solution you'd like
I would like the role to setup the dependencies for the plugins activated. I can see that this might be outside the scope of this role. Just wanted to check if you would be willing to accepts PR:s in this direction?
Additional context
Describe the bug
When running this role from a MacOS (Catalina) it is failing with this error:
fatal: [hostname]: FAILED! => {"msg": "The conditional check 'telegraf_agent_version is version('0.10.0', '<')' failed. The error was: Version comparison: '<' not supported between instances of 'str' and 'int'\n\nThe error appears to be in '/path/to/ansible/roles/external/telegraf/tasks/configure_linux.yml': line 24, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: "Copy the template for versions < 0.10.0"\n ^ here\n"}_
Installation method/version
Ansible Version
ansible 2.9.4
config file = /Users/alberto/src/ansible.cfg
configured module search path = ['/Users/alberto/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.9.4/libexec/lib/python3.8/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.8.1 (default, Dec 27 2019, 18:06:00) [Clang 11.0.0 (clang-1100.0.33.16)]
_
Targetted hosts
Concerns the following OS(es):
Expected behavior
Shouldn't be failing
Additional context
It is failing with Ansible 2.8 @ Catalina as well. I'm not 100% positive, but I guess it may be related to the Python version (3.x) instead of Ansible itself.
I have another machine running Linux and Ansible 2.8/2.9 and it works fine with Python 2.7.
Describe the bug
Impossible to start the telegraf serivce
Having a simple configuration like
default config +
telegraf_agent_output:
- type: influxdb
config:
- urls = ["http://influx.foo.com:8086"]
- database = "telegraf"
- username = "{{ influx_user }}"
- password = "{{ influx_password }}"
telegraf_plugins_extra_exclusive: True
telegraf_plugins_extra:
nginx:
config:
- urls = ["http://localhost:9090/nginx_status"]
phpfpm:
config:
- urls = ["http://localhost:9090/fpm-status"]
Generates inside telegraf.d/
folder :
-rw-r----- 1 telegraf telegraf 70 Nov 14 17:47 config.conf
-rw-r----- 1 telegraf telegraf 119 Nov 14 17:56 nginx.conf
-rw-r----- 1 telegraf telegraf 118 Nov 14 17:56 phpfpm.conf
-rw-r----- 1 telegraf telegraf 70 Nov 14 17:47 plugin.conf
The problem is that config.conf
and plugin.conf
are empty-ish
### MANAGED BY dj-wasabi.telegraf ANSIBLE ROLE ###
[[inputs.config]]
### MANAGED BY dj-wasabi.telegraf ANSIBLE ROLE ###
[[inputs.config]]
As long as those two files are present, telegraf
service won't start/keeps crashing.
Having set telegraf_plugins_extra_exclusive: True
to true doesn't help either.
Installation method/version
Ansible Version
2.7.1
Targetted hosts
Concerns the following OS(es):
Describe the bug
The telegraf packages in the open build service have a systemd service file but this role installs an init script unconditionally.
Newer SUSE/openSUSE systems don't require insserv-compat to be installed and installing the init script will fail with:
Unable to enable service telegraf: Synchronizing state of telegraf.service with SysV service script with /usr/lib/systemd/systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable telegraf
/sbin/insserv: No such file or directory
Installation method/version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/jeffm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.12 (default, Aug 31 2021, 01:23:42) [GCC]
Targetted hosts
Concerns the following OS(es):
Expected behavior
The role installs telegraf and enables it without error.
Additional context
I've fixed this locally and will start a PR after submitting this issue to use as a reference.
Hello,
The last merged PR #46 seems to don't allow anymore to use several time the same input plugin.
This PR make the input name based on a dict key, which can't be duplicated.
+[[inputs.{{ item.key }}]]
Ref in Telegraf doc : an input could be called several time https://github.com/influxdata/telegraf/blob/master/docs/CONFIGURATION.md#multiple-inputs-of-the-same-type
This is important for some input plugin like : influxdata/telegraf#2294 (comment)
Behavior added in ansible-telegraf here #46
Regards
Describe the bug
Failing on debian bookworm due to not following influxdata's recomendations
Installation method/version
Ansible Version
ansible [core 2.15.2]
config file = /Users/xxx/git.xxx.io/ansible/ansible.cfg
configured module search path = ['/Users/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/homebrew/Cellar/ansible/8.2.0/libexec/lib/python3.11/site-packages/ansible
ansible collection location = /Users/xxx/.ansible/collections:/usr/share/ansible/collections
executable location = /opt/homebrew/bin/ansible
python version = 3.11.4 (main, Jun 20 2023, 17:23:00) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/opt/homebrew/Cellar/ansible/8.2.0/libexec/bin/python3.11)
jinja version = 3.1.2
libyaml = True
Targetted hosts
Concerns the following OS(es):
Expected behavior
Not use specific releases, instead use the "stable main" as per telegraf's maintainer
Additional context
Issue showing maintainer directing people to the repo docs:
influxdata/telegraf#13458
Repo docs:
https://repos.influxdata.com/debian/dists/
Relevant section:
echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
When I define multiple plugins in telegraf_plugins_extra
, the role creates a separate file for each plugin in /etc/telegraf/telegraf.d
. However, each file lists all of the extra plugins.
The issue is that the task "Copy telegraf extra plugins" iterates over telegraf_plugins_extra
, but the template file telegraf-extra-plugin.conf
also iterates over telegraf_plugins_extra
, causing duplicates.
I'm not quite expert enough in ansible to know how to fix this yet, but I'll try to find some time to play with it...
Describe the bug
Influxdata has rotated their public key causing this role and currently installs to no longer work
Installation method/version
Galaxy
Ansible Version
ansible [core 2.13.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/xxxxxxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
ansible collection location = /home/xxxxxxxxx/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
jinja version = 3.1.2
libyaml = True
Targetted hosts
Concerns the following OS(es):
Expected behavior
A graceful way to handle the key rotation
Additional context
https://www.influxdata.com/blog/linux-package-signing-key-rotation/
Describe the bug
"online" download for my Pi4 running 32-bit debian buster is failing.
telegraf no longer builds an armv7l.deb package. I was able to manually install https://dl.influxdata.com/telegraf/releases/telegraf_1.22.1-1_armhf.deb
There are other issues preventing your plugin from completing, as python-apt no longer installs, so it may not be worth fixing it. I just wanted to get the details down before I try other installation methods.
And yes, I know buster is ancient, but it's still the current version for OctoPi unfortunately.
Installation method/version
Ansible Version
ansible 2.9.27
config file = None
configured module search path = ['/home/james/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /nix/store/8dkagx0dismw3yp5w2fwn645va1hy1c2-python3.9-ansible-2.9.27/lib/python3.9/site-packages/ansible
executable location = /nix/store/8dkagx0dismw3yp5w2fwn645va1hy1c2-python3.9-ansible-2.9.27/bin/ansible
python version = 3.9.6 (default, Jun 28 2021, 08:57:49) [GCC 10.3.0]
Targetted hosts
Concerns the following OS(es):
Expected behavior
Additional context
Is your feature request related to a problem? Please describe.
Currently, in the file templates/telegraf.conf.j2 it is assumed that the interval, flush_interval, flush_jitter and collection_jitter are set to seconds. According to telegraf documents, the settings are "ns, us (or µs), ms, s, m, h".
Describe the solution you'd like
Maybe it makes sense to set the default to 10s, rather than 10 and not assume a seconds measurement? Or maybe just document that it does use seconds. Up for discussion I'd say.
Additional context
Well, needless to say, setting the interval to 1m made for a very unhappy server as it resulted in a 1ms collection interval. 😳
Describe the bug
In recent versions of the telegraf .deb package, it appears that the InfluxDB team has begun to follow Debian Policy §9.2.1 which states that package-owned user and group names should begin with an underscore (_) so there are no name collisions with locally-created users.
This causes the Telegraf playbook to fail because it expects a user/group named "telegraf" to exist after package installation, but does not find it, so the permissions can't be set on the config files.
Installation method/version
Ansible Version
AWX/Ansible 2.15
Targetted hosts
Concerns the following OS(es):
Expected behavior
The playbook may need to be modified to check if the newly-created user and group are prefixed with an underscore, and to use that value accordingly when setting ownership of the config.
Additional context
If you manually rename the user/group to remove the underscore, and also change the systemd unit file to reflect the new user/group name, everything with this playbook works as expected. But this is obviously a manual intervention workaround, which is not ideal. I don't know when I'll have time to look deeper into a solution but wanted to share the finding here in case others run into this issue as well.
Describe the bug
In order to ensure that the zypper module works, the SUSE support installs the packages containing the libxml2 and xml python modules. The naming of these packages across releases is a bit of a mess and can fail on SLE15 due to the package being named python3-libxml2-python. That name will obviously not work when Python 2 is required on SLE12 systems due to it using Python 3.4, which Ansible will not use.
Installation method/version
ansible 2.9.27
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/jeffm/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.12 (default, Aug 31 2021, 01:23:42) [GCC]
Targetted hosts
Concerns the following OS(es):
Expected behavior
The package containing the Python libxml2 module is installed consistently across releases.
Additional context
I've fixed this locally and will start a PR after submitting this issue to use as a reference.
Hello there!
Thank you for your great role! We use it every day.
For yum, zypper, and windows, there are variables for the repository location, etc.
Would it be possible to have the same feature for debian-type installations?
Kind regards,
Describe the bug
When using the role for Almalinux 8.8, the repo and the package are not installed.
This is probably because the ansible_distribution
is inserted in the baseurl.
This fixed it for me:
- name: "RedHat | Add yum repository"
yum_repository:
name: influxdb
description: InfluxDB Repository - RHEL $releasever
- baseurl: "{{ telegraf_yum_baseurl[ansible_distribution|lower] | default(telegraf_yum_baseurl['default']) }}"
+ baseurl: "{{ telegraf_yum_baseurl['redhat'] | default(telegraf_yum_baseurl['default']) }}"
Installation method/version
Installation method: repo
Role version: 0.14.0
Ansible Version
ansible [core 2.13.3]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/centos/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/centos/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.13 (main, Nov 16 2022, 15:31:39) [GCC 8.5.0 20210514 (Red Hat 8.5.0-15)]
jinja version = 3.1.2
libyaml = True
Targetted hosts
Concerns the following OS(es):
Expected behavior
Installation of influx repo and telegraf package.
Describe the bug
After upgrade to version 0.12 of the role all my provision failed to download telegraf from repo
Installation method/version
Ansible Version
ansible-playbook 2.7.9
config file = 'omit'/ansible.cfg
configured module search path = ['/home/edbizarro/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.7/site-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127]
Targetted hosts
Concerns the following OS(es):
Expected behavior
Additional context
My .yml
- role: dj-wasabi.telegraf
become: yes
telegraf_agent_package_method: repo
telegraf_agent_hostname: "apps"
telegraf_agent_interval: 10
telegraf_agent_aws_tags: true
telegraf_agent_quiet: true
telegraf_agent_output:
- type: influxdb
config:
- urls = ["http://omit:8086"]
- database = "telegraf"
- precision = "s"
telegraf_plugins_default:
- plugin: cpu
config:
- percpu = false
- totalcpu = true
- plugin: disk
- plugin: swap
- plugin: processes
- plugin: diskio
- plugin: mem
- plugin: net
- plugin: system
- plugin: netstat
- plugin: kernel
- plugin: docker
Output
TASK [dj-wasabi.telegraf : Debian | Install Telegraf package] ********************************************************************************************************************************************
FAILED - RETRYING: Debian | Install Telegraf package (3 retries left).
FAILED - RETRYING: Debian | Install Telegraf package (2 retries left).
FAILED - RETRYING: Debian | Install Telegraf package (1 retries left).
fatal: [omit]: FAILED! => {"attempts": 3, "cache_update_time": 1554319334, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\" install 'telegraf=1.10.0-1'' failed: E: Version '1.10.0-1' for 'telegraf' was not found\n", "rc": 100, "stderr": "E: Version '1.10.0-1' for 'telegraf' was not found\n", "stderr_lines": ["E: Version '1.10.0-1' for 'telegraf' was not found"], "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\n", "stdout_lines": ["Reading package lists...", "Building dependency tree...", "Reading state information..."]}
Is your feature request related to a problem? Please describe.
We can't add Windows performance counter because they use object type which is not implemented.
[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"
Describe the solution you'd like
Modify telegraf-extra-plugin.conf.j2 to implement .object type
On old hosts with old SSL library, it is impossible to negotiate TLS with the repository. Hosts can't always be updated because of applications dependencies.
An installation from package files is mandatory in these cases.
Describe the solution you'd like
A way to install telegraf from pre-downloaded package files using ansible variables.
For example:
telegraf_install_mode
: "online"
or "offline"
telegraf_offline_apt_package
: "/path/to/telegraf_1.9.4-1_amd64.deb"
telegraf_offline_yum_package
: "/path/to/telegraf-1.9.4-1.x86_64.rpm"
Describe the bug
Role seems to think linux machine is an ec2_compute node. It's a VM. I suspect this is some sort of version issue since this playbook/role have worked well in the past and there have been multiple ansible upgrades since. I have checked to see if there are any other dependencies but none are listed.
Installation method/version
Ansible host is a RedHat 8 VM, target is a RedHat 8 VM
Installed via
ansible-galaxy role install dj-wasabi.telegraf
$ ansible-galaxy role list dj-wasabi.telegraf
# /home/ansible/.ansible/roles
- dj-wasabi.telegraf, 0.13.2
Ansible:
$ ansible --version
ansible [core 2.12.2]
config file = /home/ansible/work/ansible.cfg
configured module search path = ['/home/ansible/work/library']
ansible python module location = /usr/lib/python3.8/site-packages/ansible
ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
executable location = /bin/ansible
python version = 3.8.12 (default, Sep 16 2021, 10:46:05) [GCC 8.5.0 20210514 (Red Hat 8.5.0-3)]
jinja version = 2.10.3
libyaml = True
Targetted hosts
Concerns the following OS(es):
Expected behavior
Telegraf is installed and started
Additional context
PLAY [target-server] *******************************************************************************************************************************
TASK [dj-wasabi.telegraf : Install on RedHat] **********************************************************************************************
included: /home/ansible/.ansible/roles/dj-wasabi.telegraf/tasks/RedHat.yml for target-server
TASK [dj-wasabi.telegraf : RedHat | Set name if state == latest] ***************************************************************************
ok: [target-server]
TASK [dj-wasabi.telegraf : Use RHEL 7 packages for Fedora] *********************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : RedHat | Add yum repository] ************************************************************************************
ok: [target-server]
TASK [dj-wasabi.telegraf : RedHat | Download Telegraf package (online)] ********************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : RedHat | Install Telegraf package] ******************************************************************************
ok: [target-server]
TASK [dj-wasabi.telegraf : Install on Debian] **********************************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : Install on Suse] ************************************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : Install on FreeBSD] *********************************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : Install on MacOS] ***********************************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : include_tasks] **************************************************************************************************
skipping: [target-server]
TASK [dj-wasabi.telegraf : Configure Telegraf] *********************************************************************************************
fatal: [target-server]: FAILED! =>
reason: |-
couldn't resolve module/action 'ec2_metadata_facts'. This often indicates a misspelling, missing collection, or incorrect module path.
The error appears to be in '/home/ansible/.ansible/roles/dj-wasabi.telegraf/tasks/configure_linux.yml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Retrieve ec2 facts
^ here
PLAY RECAP *********************************************************************************************************************************
target-server : ok=4 changed=0 unreachable=0 failed=1 skipped=7 rescued=0 ignored=0
Collection of target works fine:
$ ansible -m setup target-server
PLAY [Ansible Ad-Hoc] **********************************************************************************************************************
TASK [setup] *******************************************************************************************************************************
ok: [target-server]
PLAY RECAP *********************************************************************************************************************************
target-server : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
List of collections installed:
$ ansible-galaxy collection list
# /home/ansible/.ansible/collections/ansible_collections
Collection Version
----------------- -------
ansible.posix 1.2.0
ansible.windows 1.10.0
community.crypto 2.5.0
community.docker 2.7.0
community.general 5.4.0
Describe the bug
Adding repo fails because it is missing become: yes
ansible-telegraf/tasks/RedHat.yml
Lines 16 to 24 in 8fdab6f
This throws a syntax error
ansible-telegraf/tasks/RedHat.yml
Lines 32 to 33 in 8fdab6f
default(omit)
after looking at Debian.yml
Installation method/version
Ansible Version
ansible 2.9.7
config file = /Users/rohitgohri/Projects/collegedunia/ansible-playbooks/ansible.cfg
configured module search path = ['/Users/rohitgohri/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/rohitgohri/Projects/collegedunia/ansible-playbooks/.venv/lib/python3.7/site-packages/ansible
executable location = /Users/rohitgohri/Projects/collegedunia/ansible-playbooks/.venv/bin/ansible
python version = 3.7.6 (default, Dec 30 2019, 19:38:36) [Clang 10.0.0 (clang-1000.11.45.5)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
yum_repository
should have become
Additional context
For the RedHat version the playbook installs a bunch of pip dependencies which, as far as I can see, are only used by tests (since Telegraf is written in go).
Those dependencies are causing issues with packages that might actually depend for example on the python-urllib3
yum package since yum will fail if files installed by the package already exist on the system.
Would it be possible to remove those dependencies? Or at least move them to the test.yml
test playbook?
here you should add
{% if item.filter is defined %}
{% if item.filter.name is defined %}
[outputs.{{ item.type }}.{{ item.filter.name }}]
{% if item.filter.config is defined and item.filter.config is iterable %}
{% for items in item.filter.config %}
{{ items }}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
many output agent need filters. For instance see at output.http.headers in output http plugin
Describe the bug
Given the following usage
- name: Setup and install telegraf
become: true
include_role:
name: dj-wasabi.telegraf
vars:
telegraf_plugins_extra:
# https://github.com/influxdata/telegraf/tree/master/plugins/inputs/smart
- plugin: smart
config:
- use_sudo = true
I get two files in /etc/telegraf/telegraf.d
confing.conf
and plugin.conf
. The contents of the files are
config.conf
### MANAGED BY dj-wasabi.telegraf ANSIBLE ROLE ###
[[inputs.config]]
plugins.conf
### MANAGED BY dj-wasabi.telegraf ANSIBLE ROLE ###
[[inputs.plugin]]
The plugin extras doesn't seem to be added.
Installation method/version
Ansible Version
ansible 2.7.1
config file = /Users/cada/development/ansible-servern/ansible.cfg
configured module search path = [u'/Users/cada/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /Users/cada/development/ansible-servern/venv/lib/python2.7/site-packages/ansible
executable location = /Users/cada/development/ansible-servern/venv/bin/ansible
python version = 2.7.15 (default, Oct 2 2018, 11:42:04) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.2)]
Targetted hosts
Concerns the following OS(es):
Expected behavior
I expect the plugins in telegraf_plugins_extra to be added to the plugins config file.
It's not possible to manage logparser configuration file
[[inputs.logparser]]
files = ["/var/log/messages"]
from_beginning = false
[inputs.logparser.grok]
patterns = [“invoked oom-killer”]
Hi,
The package change the namespace on Galaxy form
dj-wasabi.telegraf
to dj_wasabi.telegraf
All of our tower jobs failed since then with no error or no context. Only a local installation of the package highlighted the error.
I think changing the namespace change should be mentionned in your repository in an UPGRADE.md file or something like this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.