naviat
8/1/2018 - 4:35 PM

Telegraf configuration file

Telegraf configuration file

files:
    "/etc/telegraf/telegraf.conf":
        mode: "000666"
        owner: root
        group: root
        content: |
            [global_tags]
            hostname="Avengers"

            # Read metrics about CPU usage
            [[inputs.cpu]]
            percpu = false
            totalcpu = true
            fieldpass = [ "usage*" ]
            name_suffix = "_vm"

            # Read metrics about disk usagee
            [[inputs.disk]]
            fielddrop = [ "inodes*" ]
            mount_points=["/"]
            name_suffix = "_vm"

            # Read metrics about network usage
            [[inputs.net]]
            interfaces = [ "eth0", "eth1" ]
            fielddrop = [ "icmp*", "ip*", "tcp*", "udp*" ]
            name_suffix = "_vm"

            # Read metrics about memory usage
            [[inputs.mem]]
            name_suffix = "_vm"

            # Read metrics about swap memory usage
            [[inputs.swap]]
            name_suffix = "_vm"

            # Read metrics about system load and uptime
            [[inputs.system]]
            name_suffix = "_vm"

            # Read metrics from docker socket api
            [[inputs.docker]]
            endpoint = "unix:///var/run/docker.sock"
            container_names = []
            name_suffix = "_docker"

            [[outputs.influxdb]]
            database = "instances"
            urls = ["http://172.31.38.51:8086"]
            namepass = ["*_vm"]

            [[outputs.influxdb]]
            database = "containers"
            urls = ["http://172.31.38.51:8086"]
            namepass = ["*_docker"]