Skip to content

langerma/ansible-role-grafana-agent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-role-grafana-agent

Install and Configure Grafana-Agent with Ansible

This example is taken from molecule/resources/converge.yml and is tested on each push, pull request and release.

---
- name: converge
  hosts: all
  become: yes
  gather_facts: yes

  roles:
    - role: ansible-role-grafana-exporter

for agent configuration have a look at Grafana Agent Documentation

These variables are set in defaults/main.yml:

---
# defaults for grafana-agent

agent_version: "0.29.0"
agent_arch: amd64
agent_url: "https://github.com/grafana/agent/releases/download/v{{ agent_version }}/grafana-agent-{{ agent_version }}-1.{{ agent_arch }}.deb"
agent_runasroot: false

agent_server_http_address: "127.0.0.1:9099"
agent_server_grpc_address: "127.0.0.1:19095"

agent_config:
  metrics:
    global:
      scrape_interval: 15s
      remote_write:
        - url: http://cortex.service.consul:9009/api/v1/push
    wal_directory: '/var/lib/grafana-agent'
    configs:
    - name: agent
      host_filter: false
      scrape_configs:
        - job_name: agent
          static_configs:
            - targets: ['127.0.0.1:9099']
  integrations:
    agent:
      enabled: true
    node_exporter:
      enabled: true
      include_exporter_metrics: true
      enable_collectors:
        - "systemd"
      disable_collectors:
        - "mdadm"
    consul_exporter:
      enabled: true
  logs:
    configs:
    - name: default
      positions:
        filename: /tmp/positions.yaml
      scrape_configs:
        - job_name: varlogs
          static_configs:
            - targets: [localhost]
              labels:
                job: varlogs
                __path__: /var/log/*log
        - job_name: journal
          journal:
            max_age: 12h
            labels:
              job: systemd-journal
          relabel_configs:
            - source_labels: ['__journal__systemd_unit']
              target_label: 'unit'
      clients:
        - url: http://loki.service.consul:3100/loki/api/v1/push

This role has been tested on these container images:

container tags
debian buster
ubuntu bionic, focal
RHEL 7, 8
Fedora 33, 34
FreeBSD 12, 13

The minimum version of Ansible required is 2.10, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

If you find issues, please register them in GitHub

About

Install and configure Grafana Agent.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 78.2%
  • Jinja 21.8%