Collecting DATA with telegraf

Hello,

i want to collect Data with telegraf which is in a Docker-Container(linux-Container) from a WINDOWS Server (Hyper-V), a Windows 10, a Ubiquiti WIFI System (SNMP) and a Synology NAS and a QNAP NAS, i am a starter in this and the collecting of my Docker-Containers (Metric) a runnig but no Windows or Others, can you help me?
Here the telegraf.conf
[ global_tags]
[agent]
interval = “10s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “10s”
flush_jitter = “0s”
precision = “”
debug = false
quiet = false
logfile = “”
hostname = “”
omit_hostname = false
[[outputs.influxdb]]
urls = [“http://influx:8086”] # required
database = “telegraf” # required
username = “telegraf”
password = “iijineeZ9iet”
retention_policy = “”
write_consistency = “any”
timeout = “5s”
##INPUTS##
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.mem]]
[[inputs.swap]]
[[inputs.netstat]]
[[inputs.system]]
[[inputs.docker]]
endpoint = “unix:///var/run/docker.sock”
[[inputs.ping]]
urls = [“www.google.com”]
count = 1
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default, telegraf gather stats for all mountpoints.
## Setting mountpoints will restrict the stats to the specified mountpoints.
# mount_points = [“/”]

      ## Ignore some mountpoints by filesystem type. For example (dev)tmpfs (usually
      ## present on /run, /var/run, /dev/shm or /dev).
      ignore_fs = ["tmpfs", "devtmpfs"]
    [[inputs.processes]]
    [[inputs.net]]
    [[inputs.kernel]]
    [[inputs.linux_sysctl_fs]]
    [[inputs.diskio]]
    [[inputs.interrupts]]
    ##
    ## SNMP Input Plugin
    ##
    ## UniFi APs (Gen 2/Gen 3)
    ## Last update:  11 April 2017
    ##
     [[inputs.snmp]]
       # List of agents to poll
       agents = [ "APBroFLORIAN", "uap2" ]
       # Polling interval
       interval = "60s"
       # Timeout for each SNMP query.
       timeout = "10s"
       # Number of retries to attempt within timeout.
       retries = 3
       # SNMP version, UAP only supports v1
       version = 1
       # SNMP community string.
       community = "public"
       # The GETBULK max-repetitions parameter
       max_repetitions = 10
       # Measurement name
       name = "snmp.UAP"
       ##
       ## System Details
       ##
       #  System name (hostname)
       [[inputs.snmp.field]]
         is_tag = true
         name = "sysName"
         oid = "RFC1213-MIB::sysName.0"
       #  System vendor OID
       [[inputs.snmp.field]]
         name = "sysObjectID"
         oid = "RFC1213-MIB::sysObjectID.0"
       #  System description
       [[inputs.snmp.field]]
         name = "sysDescr"
         oid = "RFC1213-MIB::sysDescr.0"
       #  System contact
       [[inputs.snmp.field]]
         name = "sysContact"
         oid = "RFC1213-MIB::sysContact.0"
       #  System location
       [[inputs.snmp.field]]
         name = "sysLocation"
         oid = "RFC1213-MIB::sysLocation.0"
       #  System uptime
       [[inputs.snmp.field]]
         name = "sysUpTime"
         oid = "RFC1213-MIB::sysUpTime.0"
       #  UAP model
       [[inputs.snmp.field]]
         name = "unifiApSystemModel"
         oid = "UBNT-UniFi-MIB::unifiApSystemModel"
       #  UAP firmware version
       [[inputs.snmp.field]]
         name = "unifiApSystemVersion"
         oid = "UBNT-UniFi-MIB::unifiApSystemVersion"
       ##
       ## Host Resources
       ##
       #  Total memory
       [[inputs.snmp.field]]
         name = "memTotal"
         oid = "FROGFOOT-RESOURCES-MIB::memTotal.0"
       #  Free memory
       [[inputs.snmp.field]]
         name = "memFree"
         oid = "FROGFOOT-RESOURCES-MIB::memFree.0"
       #  Buffer memory
       [[inputs.snmp.field]]
         name = "memBuffer"
         oid = "FROGFOOT-RESOURCES-MIB::memBuffer.0"
       #  Cache memory
       [[inputs.snmp.field]]
         name = "memCache"
         oid = "FROGFOOT-RESOURCES-MIB::memCache.0"
       #  Per-interface traffic, errors, drops
       [[inputs.snmp.table]]
         oid = "IF-MIB::ifTable"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "IF-MIB::ifDescr"
       ##
       ## Interface Details & Metrics
       ##
       #  Wireless interfaces
       [[inputs.snmp.table]]
         oid = "UBNT-UniFi-MIB::unifiRadioTable"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "UBNT-UniFi-MIB::unifiRadioName"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "UBNT-UniFi-MIB::unifiRadioRadio"
       #  BSS instances
       [[inputs.snmp.table]]
         oid = "UBNT-UniFi-MIB::unifiVapTable"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "UBNT-UniFi-MIB::unifiVapName"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "UBNT-UniFi-MIB::unifiVapRadio"
       #  Ethernet interfaces
       [[inputs.snmp.table]]
         oid = "UBNT-UniFi-MIB::unifiIfTable"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "UBNT-UniFi-MIB::unifiIfName"
       ##
       ## System Performance
       ##
       #  System load averages
       [[inputs.snmp.table]]
         oid = "FROGFOOT-RESOURCES-MIB::loadTable"
         [[inputs.snmp.table.field]]
           is_tag = true
           oid = "FROGFOOT-RESOURCES-MIB::loadDescr"
       ##
       ## SNMP metrics
       ##
       #  Number of SNMP messages received
       [[inputs.snmp.field]]
         name = "snmpInPkts"
         oid = "SNMPv2-MIB::snmpInPkts.0"
       #  Number of SNMP Get-Request received
       [[inputs.snmp.field]]
         name = "snmpInGetRequests"
         oid = "SNMPv2-MIB::snmpInGetRequests.0"
       #  Number of SNMP Get-Next received
       [[inputs.snmp.field]]
         name = "snmpInGetNexts"
         oid = "SNMPv2-MIB::snmpInGetNexts.0"
       #  Number of SNMP objects requested
       [[inputs.snmp.field]]
         name = "snmpInTotalReqVars"
         oid = "SNMPv2-MIB::snmpInTotalReqVars.0"
       #  Number of SNMP Get-Response received
       [[inputs.snmp.field]]
         name = "snmpInGetResponses"
         oid = "SNMPv2-MIB::snmpInGetResponses.0"
       #  Number of SNMP messages sent
       [[inputs.snmp.field]]
         name = "snmpOutPkts"
         oid = "SNMPv2-MIB::snmpOutPkts.0"
       #  Number of SNMP Get-Request sent
       [[inputs.snmp.field]]
         name = "snmpOutGetRequests"
         oid = "SNMPv2-MIB::snmpOutGetRequests.0"
       #  Number of SNMP Get-Next sent
       [[inputs.snmp.field]]
         name = "snmpOutGetNexts"
         oid = "SNMPv2-MIB::snmpOutGetNexts.0"
       #  Number of SNMP Get-Response sent
       [[inputs.snmp.field]]
         name = "snmpOutGetResponses"
         oid = "SNMPv2-MIB::snmpOutGetResponses.0"
         
    [[inputs.win_perf_counters]]
      [[inputs.win_perf_counters.object]]
        # Processor usage, alternative to native, reports on a per core.
        ObjectName = "Processor"
        Instances = ["*"]
        Counters = [
          "% Idle Time",
          "% Interrupt Time",
          "% Privileged Time",
          "% User Time",
          "% Processor Time",
          "% DPC Time",
        ]
        Measurement = "win_cpu"
        # Set to true to include _Total instance when querying for all (*).
        IncludeTotal=true

      [[inputs.win_perf_counters.object]]
        # Disk times and queues
        ObjectName = "LogicalDisk"
        Instances = ["*"]
        Counters = [
          "% Idle Time",
          "% Disk Time",
          "% Disk Read Time",
          "% Disk Write Time",
          "Current Disk Queue Length",
          "% Free Space",
          "Free Megabytes",
        ]
        Measurement = "win_disk"
        # Set to true to include _Total instance when querying for all (*).
        #IncludeTotal=false

      [[inputs.win_perf_counters.object]]
        ObjectName = "PhysicalDisk"
        Instances = ["*"]
        Counters = [
          "Disk Read Bytes/sec",
          "Disk Write Bytes/sec",
          "Current Disk Queue Length",
          "Disk Reads/sec",
          "Disk Writes/sec",
          "% Disk Time",
          "% Disk Read Time",
          "% Disk Write Time",
        ]
        Measurement = "win_diskio"

      [[inputs.win_perf_counters.object]]
        ObjectName = "Network Interface"
        Instances = ["*"]
        Counters = [
          "Bytes Received/sec",
          "Bytes Sent/sec",
          "Packets Received/sec",
          "Packets Sent/sec",
          "Packets Received Discarded",
          "Packets Outbound Discarded",
          "Packets Received Errors",
          "Packets Outbound Errors",
        ]
        Measurement = "win_net"

      [[inputs.win_perf_counters.object]]
        ObjectName = "System"
        Counters = [
          "Context Switches/sec",
          "System Calls/sec",
          "Processor Queue Length",
          "System Up Time",
        ]
        Instances = ["------"]
        Measurement = "win_system"
        # Set to true to include _Total instance when querying for all (*).
        #IncludeTotal=false

      [[inputs.win_perf_counters.object]]
        # Example query where the Instance portion must be removed to get data back,
        # such as from the Memory object.
        ObjectName = "Memory"
        Counters = [
          "Available Bytes",
          "Cache Faults/sec",
          "Demand Zero Faults/sec",
          "Page Faults/sec",
          "Pages/sec",
          "Transition Faults/sec",
          "Pool Nonpaged Bytes",
          "Pool Paged Bytes",
          "Standby Cache Reserve Bytes",
          "Standby Cache Normal Priority Bytes",
          "Standby Cache Core Bytes",

        ]
        # Use 6 x - to remove the Instance bit from the query.
        Instances = ["------"]
        Measurement = "win_mem"
        # Set to true to include _Total instance when querying for all (*).
        #IncludeTotal=false

      [[inputs.win_perf_counters.object]]
        # Example query where the Instance portion must be removed to get data back,
        # such as from the Paging File object.
        ObjectName = "Paging File"
        Counters = [
          "% Usage",
        ]
        Instances = ["_Total"]
        Measurement = "win_swap"

I get this Message from Telegraf
[telegraf] Error running agent: Error parsing /etc/telegraf/telegraf.conf, Undefined but requested input: win_perf_counter

And no data over snmp

Where is your telegraf agent running, is it on the Windows machine that is hosting the docker container? Or from within the docker container?

Are you using the windows version of telegraf binaries if you are running telegraf on the Windows machine?

With agent you mean the Programm which using telegraf. Conf
the telegraf is running in a Linux docker container
I can send the docker-compose.yml tommorow

The win_perf_counter plugin only works, and is only included, in the Windows build, as it uses pdh.dll under the hood.

Okay,
what must I do to get data from a windows host/pc into the telegraf docker?

The only way I know to get the performance counter data from within Docker is to use a Windows container. This has been reported to work at least on Windows 10 professional.
Unable to collect network metrics on Windows Container · Issue #5357 · influxdata/telegraf · GitHub

It is potentially possible, and this is a real longshot, that somehow you could use wine. I haven’t talked to anyone crazy enough to try this though.

Okay,

Or can I build the docker container for the influxdb, telegraf and grafana in the RealNetworks 192.168.178. 0 instead of 10.75.0.0 and instell the telegraf agent on windows and choose the output source the influxdb containers

I’m not sure I understand, but you could definitely run Telegraf on the real Windows host and send the data into the container running InfluxDB.

Yes,
it works now, i can see Metrics from my Windows 10 PC and Windows 10 Notebook!
But the snmp part didn’t work!
I think I’m on the wrong track, because i put the snmp-Input part into the telegraf.conf from the Docker telegraf, but i think it is wrong!
But what must i do, to Evaluate the data or to get the snmp data into the influxdb and than to see them in the grafa?

The official docker containers doesn’t contain the net-snmp tools needed for the snmp plugin. Here is a comment describing a way to rebuild the container with the extra bits. Keep an eye on the Telegraf logs to help with troubleshooting.

Thank you it works, i see the status.
Last Question
I have a QNAP NAS System and i want to collcet data from there, but the telegraf don’t understand the QNAP SNMP, but i have the MIB?
How can i get it into the telegraf?

OKAY, i am getting the SNMP from my UBIQUITI!

1 Like