finchen961988
Goto Top

Monitoring mit Docker

Hallo liebes Forum und frohe Ostern nachträglich,

ich möchte mich in das Thema Docker reinarbeiten, um mal ebend schnell ein DB - Server ohne viel Stress aufzubauen, da bin ich durch das Buch "Docker" vom Rheinwerk-Verlag auf das Thema Grafana und Monitoring gestoßen und habe mich versucht daran!
Alles soweit so gut!
Der Container mit Grafan, InfluxDB und Telegraf laufen!
Ich kann auch die Container im Grafana sehen und auch das die was tun!
Geprüft ob die Anzeige richtig ist unter Powershell mit Docker stats

Jetzt bin ich aber am gucken und bekomme es nicht hin, dass zum Beipiel mein Windows PC sichtbar wird, meine QNAP NAS und meine Ubiquiti AP System!

Ich schicke mal die docker-compose

version: '3'  
services:
  grafana:
    container_name: grafana
    #image: grafana/grafana:latest
    build: D:/Docker/Dashboard/grafana     
    ports:
      - 3000:3000    
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=geheim        
  telegraf:
    container_name: telegraf
    build: D:/Docker/Dashboard/telegraf 
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock:ro     
    restart: always
  influx:
    container_name: influx 
    #build: D:/Docker/Dashboard/influxdb
    image: influxdb
    restart: unless-stopped
    ports:
      - 8086:8086
      
    environment:
      - INFLUXDB_USER=telegraf
      - INFLUXDB_USER_PASSWORD=password
      - INFLUXDB_DB=telegraf

Dockerfile von grafana
#Datei grafana/Dockerfile

FROM grafana/grafana:latest

Dockerfile telegraf
#Datei telegraf/Dockerfile
FROM telegraf
COPY telegraf.conf /etc/telegraf/telegraf.conf

Die Telegraf.conf mit Windows HOST udn SNMP!
[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]]

[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
# Processor usage, alternative to native, reports on a per core.
ObjectName = "Processor"  
Instances = ["PC-FT"]  
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"  

##
## SNMP Input Plugin
##
## UniFi APs (Gen 2/Gen 3)
## Last update:  11 April 2017
##
[[inputs.snmp]]
# List of agents to poll
agents = [ "uap1", "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"  


Die Zusäzte für snmp und Windows habe ich von grafana, hier die links, ich habe alles so durchgeführt wie es da steht, aber es geht nicht!
https://grafana.com/dashboards/1486
https://grafana.com/dashboards/1941

Erst mal die DOCKER Netzwerkeinstellung ist auf das 10.0.75.0 255.255.255.0 geblieben, hab eich auch geändert, hat aber nichts gebracht!

Meine Fragen hierzu sind,
was muss ich machen, dass der Telegraf von anderen System NAS, Windows Server/PC und UBIquiti daten bekommt und ich die Visualieren kann!
Weitere frage ist, ich arbeite auf einem Windows Host und ich möchte eigentlich in der docker-compose mit Orderner(Freigaben) arbeiten die ich mit den Container verlinke aller
volumes:
- ./dashboards:/var/lib/grafana/dashboards

ALSO
C:/Users/user/dashboard/dashboard:/var/lib/grafana/dashboards
So müsse doch der Inhalt aus dem Ordner dashboard in /var/lib/grafana/dashboards landen oder nicht?


Wie muss das aussehen?
Macht das Sinn dem Grafana eine eigene IP im REAL - Netz zugeben?
Wie kann ich dem Grafana eine Datasource mitgeben, alle Lösungen im Internet die ich gefunden habe, haben nicht funktioniert!

Content-Key: 444288

Url: https://administrator.de/contentid/444288

Printed on: April 26, 2024 at 07:04 o'clock

Member: BassFishFox
BassFishFox Apr 25, 2019 updated at 18:31:39 (UTC)
Goto Top
Setz den Code ganz schnell in Code-Tags.

Also editiere Deinen Post und setze an den Anfach voe dem CFG-Krams ein "Pfeil links code Pfeil rechts" und dann am Ende Deines Krams ein "Pfeil links /code Pfeil rechts".

Dein Post war ist eigentlich unlesbar.

Ergaenzung:
Hast es wohl selbst gemerkt. Dennoch, setz den Code in Code-Tags. Bist doch nicht das erste mal hier.

BFF
Member: Pjordorf
Pjordorf Apr 25, 2019 at 17:34:22 (UTC)
Goto Top
Hallo,

Zitat von @Finchen961988:
Vermutlich einge Wörter vergessen, oder?
Ich schicke mal die docker-compose
Nutze biite die Code Tags (links vom Editorfenster die kleiner als - Schrägstrich - größer als Zeichen) , deine Daten brauchen sonst einen 4 meter breiten Monitor (oder noch breiter?) um noch dargestellt zu werden.
editor

Gruß,
Peter
Member: Finchen961988
Finchen961988 Apr 25, 2019 at 17:47:49 (UTC)
Goto Top
Danke,

ich habe es geändert
Member: aqui
aqui Apr 26, 2019 updated at 07:58:00 (UTC)
Goto Top
...außerdem fehlt ein "g" in der Überschrift. So denkt man immer das dort eine weibliche Überwacherin agiert !
Member: Finchen961988
Finchen961988 Apr 26, 2019 at 07:43:53 (UTC)
Goto Top
So,
nu habe ich alles geändert, hat einer hier nee IDEE?
Member: Finchen961988
Finchen961988 Apr 26, 2019 at 09:44:11 (UTC)
Goto Top
ALSO per Telegraf bekomem ich nu von mehreren CLIENTS Daten geschickt und im Grafana sind die sichtbar!
Ich bekomme nur noch nicht die Volumen hin
volumes:
- ./dashboards:/var/lib/grafana/dashboards
ALSO
C:/Users/user/dashboard/dashboard:/var/lib/grafana/dashboards

Und keine SNMP Daten von Ubiquiti oder QNAP

##
## SNMP Input Plugin
##
## UniFi APs (Gen 2/Gen 3)
## Last update:  11 April 2017
##
 [[inputs.snmp]]
   # List of agents to poll
   agents = [ "uap1", "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"  
##
## InfluxDB Output Plugin
##
[[outputs.influxdb]]
  urls = ["http://localhost:8086"] # required  
  database = "telegraf" # required  
  retention_policy = ""  
  write_consistency = "any"  
  timeout = "5s"  
  username = "username"  
  password = "password"  
  user_agent = "telegraf"  
#
Member: Finchen961988
Finchen961988 Apr 26, 2019 at 19:27:40 (UTC)
Goto Top
Die Volume Problematik ist nu auch geklärt, allerdings bekomme ich die Unifi-Welt nicht hin!


Ich habe 2 X AP-AC-PRO und 1 X AP -LR, das snmp ist im Controller an!
Mit dem SNMP Tester sehe ich auch unter der IP der APs, dass OIDs gesendet werden, aber es passiert einfach nichts im Dashboard!

Ich habe auch schon die OIDs eingetragen in die telegraf.conf, war zwar fummelig, die richtige Stelle zu finden, aber leider bringt das nichts, kann mir jemand helfen?