PRTG ist übrigens beim Server-Betrieb beliebter als beim Netzwerk-Team.
Wie schon einmal an anderer Stelle hier erwähnt (finde ich gerade nicht wieder) kann man das ganz nett mit SNMP und Grafana/Influxdb in Docker lösen.
FROM telegraf:latest
#laden der bereitgestellten Synolgy MIBS
COPY mibs/* /usr/share/snmp/mibs/
#snmp-downloader von Debian zur Verarbeitung
RUN echo "deb http://http.us.debian.org/debian stable main contrib non-free" >/etc/apt/sources.list.d/nonfree.list && \
apt-get -y update && \
apt-get -y install snmp-mibs-downloader && \
apt clean
docker build --no-cache -t ${USER}/telegraf .
#!/bin/bash
CONFIG=$(pwd)/config
if [ ! -d $CONFIG ]; then
mkdir $CONFIG
fi
chmod -R a+rx $CONFIG
#run it
docker run -d --restart=always \
-v $CONFIG:/etc/telegraf:ro \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /sys:/rootfs/sys:ro \
-v /proc:/rootfs/proc:ro \
-v /etc:/rootfs/etc:ro \
-v "${SHARED_DIR}/logs":/var/log/telegraf \
--dns "192.168.178.2" \
--dns-search "home.local" \
--env-file env_file \
--hostname $VMNAME \
--name ${VMNAME} \
${USER}/telegraf $@
# Global tags can be specified here in key=value format.
[global_tags]
# dc = us-east-1 # will tag all metrics with dc=us-east-1
# rack = 1a
## Environment variables can be used as tags, and throughout the config file
# user = root
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at most
## metric_batch_size metrics.
## This controls the size of writes that Telegraf sends to output plugins.
metric_batch_size = 1000
## For failed writes, telegraf will cache metric_buffer_limit metrics for each
## output, and will flush this buffer on a successful write. Oldest metrics
## are dropped first when this buffer fills.
## This buffer only fills when writes fail to output plugin(s).
metric_buffer_limit = 10000
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. You shouldn't set this below
## interval. Maximum flush_interval will be flush_interval + flush_jitter
flush_interval = "10s"
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## By default or when set to "0s", precision will be set to the same
## timestamp order as the collection interval, with the maximum being 1s.
## ie, when interval = "10s", precision will be "1s"
## when interval = "250ms", precision will be "1ms"
## Precision will NOT be used for service inputs. It is up to each individual
## service input to set the timestamp at the appropriate precision.
## Valid time units are "ns", "us" (or "µs"), "ms", "s".
precision = "s"
## Logging configuration:
## Run telegraf with debug log messages.
debug = false
## Run telegraf in quiet mode (error log messages only).
quiet = false
## Specify the log file name. The empty string means to log to stderr.
logfile = ""
## Override default hostname, if empty use os.Hostname()
hostname = "DS3018"
## If set to true, do no set the "host" tag in the telegraf agent.
omit_hostname = false
###############################################################################
# INPUT PLUGINS #
###############################################################################
# Read metrics about cpu usage
[[inputs.cpu]]
## Whether to report per-cpu stats or not
percpu = true
## Whether to report total system cpu stats or not
totalcpu = true
## If true, collect raw CPU time metrics.
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states.
report_active = false
# Read metrics about disk usage by mount point
[[inputs.disk]]
## By default stats will be gathered for all mount points.
## Set mount_points will restrict the stats to only the specified mount points.
# mount_points = ["/"]
## Ignore mount points by filesystem type.
ignore_fs = ["tmpfs", "devtmpfs", "devfs"]
# Read metrics about disk IO by device
[[inputs.diskio]]
## By default, telegraf will gather stats for all devices including
## disk partitions.
## Setting devices will restrict the stats to the specified devices.
# devices = ["sda", "sdb", "vd*"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
#
## On systems which support it, device metadata can be added in the form of
## tags.
## Currently only Linux is supported via udev properties. You can view
## available properties for a device by running:
## 'udevadm info -q property -n /dev/sda'
# device_tags = ["ID_FS_TYPE", "ID_FS_USAGE"]
#
## Using the same metadata source as device_tags, you can also customize the
## name of the device via templates.
## The 'name_templates' parameter is a list of templates to try and apply to
## the device. The template may contain variables in the form of '$PROPERTY' or
## '${PROPERTY}'. The first template which does not contain any variables not
## present for the device is used as the device name tag.
## The typical use case is for LVM volumes, to get the VG/LV name instead of
## the near-meaningless DM-0 name.
# name_templates = ["$ID_FS_LABEL","$DM_VG_NAME/$DM_LV_NAME"]
# Get kernel statistics from /proc/stat
[[inputs.kernel]]
# no configuration
# Read metrics about memory usage
[[inputs.mem]]
# no configuration
# Get the number of processes and group them by status
[[inputs.processes]]
# no configuration
# Read metrics about swap memory usage
[[inputs.swap]]
# no configuration
# Read metrics about system load & uptime
[[inputs.system]]
# no configuration
[[inputs.docker]]
## Docker Endpoint
## To use TCP, set endpoint = "tcp://[ip]:[port]"
## To use environment variables (ie, docker-machine), set endpoint = "ENV"
endpoint = "unix:///var/run/docker.sock"
## Only collect metrics for these containers, collect all if empty
container_names = []
## Timeout for docker list, info, and stats commands
timeout = "5s"
[[outputs.influxdb]]
## The full HTTP or UDP URL for your InfluxDB instance.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
# urls = ["unix:///var/run/influxdb.sock"]
# urls = ["udp://127.0.0.1:8089"]
# urls = ["http://127.0.0.1:8086"]
urls = ["http://influxdb:8086"]
## The target database for metrics; will be created as needed.
# database = "telegraf"
###############################################################################
# INPUT PLUGINS #
###############################################################################
##
## Retrieves details via SNMP from remote agents
##
##
## Synology
##
[[inputs.snmp]]
# List of agents to poll
agents = [ "ds3018","ds1812", "ds215j" ]
# 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 = 2
# SNMP community string.
community = "public"
# The GETBULK max-repetitions parameter
max_repetitions = 30
# Measurement name
name = "snmp.SYNO"
##
## 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"
# Inet interface
[[inputs.snmp.table]]
oid = "IF-MIB::ifTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "IF-MIB::ifDescr"
#Syno disk
[[inputs.snmp.table]]
oid = "SYNOLOGY-DISK-MIB::diskTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "SYNOLOGY-DISK-MIB::diskID"
#Syno raid
[[inputs.snmp.table]]
oid = "SYNOLOGY-RAID-MIB::raidTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "SYNOLOGY-RAID-MIB::raidName"
#Syno load
[[inputs.snmp.table]]
oid = "UCD-SNMP-MIB::laTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "UCD-SNMP-MIB::laNames"
# System memTotalSwap
[[inputs.snmp.field]]
name = "memTotalSwap"
oid = "UCD-SNMP-MIB::memTotalSwap.0"
# System memAvailSwap
[[inputs.snmp.field]]
name = "memAvailSwap"
oid = "UCD-SNMP-MIB::memAvailSwap.0"
# System memTotalReal
[[inputs.snmp.field]]
name = "memTotalReal"
oid = "UCD-SNMP-MIB::memTotalReal.0"
# System memAvailReal
[[inputs.snmp.field]]
name = "memAvailReal"
oid = "UCD-SNMP-MIB::memAvailReal.0"
# System memTotalFree
[[inputs.snmp.field]]
name = "memTotalFree"
oid = "UCD-SNMP-MIB::memTotalFree.0"
# System Status
[[inputs.snmp.field]]
name = "systemStatus"
oid = "SYNOLOGY-SYSTEM-MIB::systemStatus.0"
# System temperature
[[inputs.snmp.field]]
name = "temperature"
oid = "SYNOLOGY-SYSTEM-MIB::temperature.0"
# System powerStatus
[[inputs.snmp.field]]
name = "powerStatus"
oid = "SYNOLOGY-SYSTEM-MIB:owerStatus.0"
# System systemFanStatus
[[inputs.snmp.field]]
name = "systemFanStatus"
oid = "SYNOLOGY-SYSTEM-MIB::systemFanStatus.0"
# System cpuFanStatus
[[inputs.snmp.field]]
name = "cpuFanStatus"
oid = "SYNOLOGY-SYSTEM-MIB::cpuFanStatus.0"
# System modelName
[[inputs.snmp.field]]
name = "modelName"
oid = "SYNOLOGY-SYSTEM-MIB::modelName.0"
# System serialNumber
[[inputs.snmp.field]]
name = "serialNumber"
oid = "SYNOLOGY-SYSTEM-MIB::serialNumber.0"
# System version
[[inputs.snmp.field]]
name = "version"
oid = "SYNOLOGY-SYSTEM-MIB::version.0"
# System upgradeAvailable
[[inputs.snmp.field]]
name = "upgradeAvailable"
oid = "SYNOLOGY-SYSTEM-MIB::upgradeAvailable.0"
# System volume
[[inputs.snmp.table]]
oid = "HOST-RESOURCES-MIB::hrStorageTable"
[[inputs.snmp.table.field]]
is_tag = true
oid = "HOST-RESOURCES-MIB::hrStorageDescr"
# System ssCpuUser
[[inputs.snmp.field]]
name = "ssCpuUser"
oid = ".1.3.6.1.4.1.2021.11.9.0"
# System ssCpuSystem
[[inputs.snmp.field]]
name = "ssCpuSystem"
oid = ".1.3.6.1.4.1.2021.11.10.0"
# System ssCpuIdle
[[inputs.snmp.field]]
name = "ssCpuIdle"
oid = ".1.3.6.1.4.1.2021.11.11.0"
# Service users CIFS
[[inputs.snmp.table.field]]
name = "usersCIFS"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "1"
# Service users AFP
[[inputs.snmp.table.field]]
name = "usersAFP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "2"
# Service users NFS
[[inputs.snmp.table.field]]
name = "usersNFS"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "3"
# Service users FTP
[[inputs.snmp.table.field]]
name = "usersFTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "4"
# Service users SFTP
[[inputs.snmp.table.field]]
name = "usersSFTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "5"
# Service users HTTP
[[inputs.snmp.table.field]]
name = "usersHTTP"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "6"
# Service users TELNET
[[inputs.snmp.table.field]]
name = "usersTELNET"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "7"
# Service users SSH
[[inputs.snmp.table.field]]
name = "usersSSH"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "8"
# Service users OTHER
[[inputs.snmp.table.field]]
name = "usersOTHER"
oid = "SYNOLOGY-SERVICES-MIB::serviceUsers"
oid_index_suffix = "9"
# UPS Status
[[inputs.snmp.table.field]]
name = "upsStatus"
oid = "SYNOLOGY-UPS-MIB::upsInfoStatus"
# UPS Load
[[inputs.snmp.table.field]]
name = "upsLoad"
oid = "SYNOLOGY-UPS-MIB::upsInfoLoadValue"
# UPS Battery Charge
[[inputs.snmp.table.field]]
name = "upsCharge"
oid = "SYNOLOGY-UPS-MIB::upsBatteryChargeValue"
# UPS Battery Charge Warning
[[inputs.snmp.table.field]]
name = "upsWarning"
oid = "SYNOLOGY-UPS-MIB::upsBatteryChargeWarning"
Der Punkt am Ende hat seine Bedeutung. Er bezechnet das Arbeitsverzeichnis, wo das Dockerfile und alle anderen Files (wie das mibs Verzeichnis mit den Synology-MIBs) erwartet werdendocker build --no-cache -t ${USER}/telegraf .
Wenn du das Forum hilfreich findest oder uns unterstützen möchtest, dann gib uns doch einfach einen Kaffee aus.
Als Dankeschön schalten wir deinen Account werbefrei.