[GIT] refactor submodules: add all to own repo

This commit is contained in:
Jannik Beyerstedt 2019-10-06 22:55:56 +02:00
commit be2b9bf3c0
27 changed files with 3311 additions and 0 deletions

67
templates/borgbackup.sh Normal file
View file

@ -0,0 +1,67 @@
#!/bin/sh
# pass an arbitrary number of additional arguments to borg create by using
# borgbackup.sh $option1 $option2 ... $optionN
# pass -v --stats to show more information
# pass --list --filter AME to show all fiels Added Modified or with Error
#export BORG_RSH='ssh -i /home/jannik/.ssh/id_rsa'
export BORG_RSH='ssh -i /home/jannik/.ssh/id_ed25519'
export BORG_PASSPHRASE='borgbackup.{{ borgbackup_host }}@hetznerbx'
export BORG_REPO='ssh://u182062-sub{{ borgbackup_sub }}@u182062.your-storagebox.de:23/./borg'
# some helpers and error handling:
info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; }
trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM
# Backup the most important directories
borg create \
$@ \
--compression lz4 \
--exclude-caches \
--exclude '/home/*/.cache/*' \
--exclude '/var/run' \
--exclude '/var/cache/*' \
--exclude '/var/tmp/*' \
--exclude '/var/lib/apt/*' \
--exclude '/var/lib/dpkg/*' \
--exclude '/var/lib/yum/*' \
--exclude '/var/lib/docker/overlay2' \
--exclude '/var/lib/docker/containers' \
--exclude '/var/lib/docker/image' \
--exclude '/var/lib/docker/tmp' \
--exclude '/var/lib/lxcfs' \
--exclude '/var/log/*' \
\
$BORG_REPO::'{{ borgbackup_host }}-{now:%Y%m%d_%H%M}' \
/etc \
/var \
/root \
/home \
backup_exit=$?
# Prune old backups: keep 7 daily, 4 weekly and 3 monthly
borg prune \
--prefix '{{ borgbackup_host }}-' \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 3
prune_exit=$?
# use highest exit code as global exit code
global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit ))
if [ ${global_exit} -eq 1 ];
then
info "Backup and/or Prune finished with a warning"
fi
if [ ${global_exit} -gt 1 ];
then
info "Backup and/or Prune finished with an error"
fi
exit ${global_exit}

View file

@ -0,0 +1,350 @@
##
## SNMP Input For Unifi APs (Gen 2/Gen 3)
##
[[inputs.snmp]]
agents = [ "192.168.4.11", "192.168.4.12", "192.168.8.13" ]
interval = "5m"
timeout = "10s"
retries = 3
# SNMP version, UAP only supports v1
version = 2
community = "public"
max_repetitions = 10
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"
# UAP model
[[inputs.snmp.field]]
name = "unifiApSystemModel"
oid = "UBNT-UniFi-MIB::unifiApSystemModel"
# System uptime
[[inputs.snmp.field]]
name = "sysUpTime"
oid = "RFC1213-MIB::sysUpTime.0"
##
## 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"
##
## 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 Input For EdgeRouter/ Unifi USG
##
[[inputs.snmp]]
agents = [ "192.168.2.1" ]
interval = "5m"
timeout = "5s"
retries = 3
# SNMP version, values can be 1, 2, or 3
version = 2
community = "public"
max_repetitions = 10
name = "snmp.EdgeOS"
##
## Exclusions
##
# Don't want these columns from UCD-SNMP-MIB::laTable
fielddrop = [ "laErrorFlag", "laErrMessage" ]
# Don't want these rows from UCD-DISKIO-MIB::diskIOTable
[inputs.snmp.tagdrop]
diskIODevice = [ "loop*", "ram*" ]
##
## System details
##
# System name (hostname)
[[inputs.snmp.field]]
name = "sysName"
oid = "SNMPv2-MIB::sysName.0"
is_tag = true
# System vendor OID
[[inputs.snmp.field]]
name = "sysObjectID"
oid = "SNMPv2-MIB::sysObjectID.0"
# System description
[[inputs.snmp.field]]
name = "sysDescr"
oid = "SNMPv2-MIB::sysDescr.0"
# System uptime
[[inputs.snmp.field]]
name = "sysUpTime"
oid = "HOST-RESOURCES-MIB::hrSystemUptime.0"
# Device Listing
[[inputs.snmp.table]]
oid = "HOST-RESOURCES-MIB::hrDeviceTable"
[[inputs.snmp.table.field]]
oid = "HOST-RESOURCES-MIB::hrDeviceIndex"
is_tag = true
##
## Host performance metrics
##
# System Load Average
[[inputs.snmp.table]]
oid = "UCD-SNMP-MIB::laTable"
[[inputs.snmp.table.field]]
oid = "UCD-SNMP-MIB::laNames"
is_tag = true
##
## CPU utilization
##
# Number of 'ticks' spent on user-level
[[inputs.snmp.field]]
name = "ssCpuRawUser"
oid = "UCD-SNMP-MIB::ssCpuRawUser.0"
# Number of 'ticks' spent on reduced-priority
[[inputs.snmp.field]]
name = "ssCpuRawNice"
oid = "UCD-SNMP-MIB::ssCpuRawNice.0"
# Number of 'ticks' spent on system-level
[[inputs.snmp.field]]
name = "ssCpuRawSystem"
oid = "UCD-SNMP-MIB::ssCpuRawSystem.0"
# Number of 'ticks' spent idle
[[inputs.snmp.field]]
name = "ssCpuRawIdle"
oid = "UCD-SNMP-MIB::ssCpuRawIdle.0"
# Number of 'ticks' spent waiting on I/O
[[inputs.snmp.field]]
name = "ssCpuRawWait"
oid = "UCD-SNMP-MIB::ssCpuRawWait.0"
# Number of 'ticks' spent in kernel
[[inputs.snmp.field]]
name = "ssCpuRawKernel"
oid = "UCD-SNMP-MIB::ssCpuRawKernel.0"
# Number of 'ticks' spent on hardware interrupts
[[inputs.snmp.field]]
name = "ssCpuRawInterrupt"
oid = "UCD-SNMP-MIB::ssCpuRawInterrupt.0"
# Number of 'ticks' spent on software interrupts
[[inputs.snmp.field]]
name = "ssCpuRawSoftIRQ"
oid = "UCD-SNMP-MIB::ssCpuRawSoftIRQ.0"
##
## System Memory (physical/virtual)
##
# Size of phsyical memory (RAM)
[[inputs.snmp.field]]
name = "hrMemorySize"
oid = "HOST-RESOURCES-MIB::hrMemorySize.0"
# Size of real/phys mem installed
[[inputs.snmp.field]]
name = "memTotalReal"
oid = "UCD-SNMP-MIB::memTotalReal.0"
# Size of real/phys mem unused/avail
[[inputs.snmp.field]]
name = "memAvailReal"
oid = "UCD-SNMP-MIB::memAvailReal.0"
# Total amount of mem unused/avail
[[inputs.snmp.field]]
name = "memTotalFree"
oid = "UCD-SNMP-MIB::memTotalFree.0"
# Size of mem used as shared memory
[[inputs.snmp.field]]
name = "memShared"
oid = "UCD-SNMP-MIB::memShared.0"
# Size of mem used for buffers
[[inputs.snmp.field]]
name = "memBuffer"
oid = "UCD-SNMP-MIB::memBuffer.0"
# Size of mem used for cache
[[inputs.snmp.field]]
name = "memCached"
oid = "UCD-SNMP-MIB::memCached.0"
##
## Interface metrics
##
# Per-interface traffic, errors, drops
[[inputs.snmp.table]]
oid = "IF-MIB::ifTable"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifName"
is_tag = true
# Per-interface high-capacity (HC) counters
[[inputs.snmp.table]]
oid = "IF-MIB::ifXTable"
[[inputs.snmp.table.field]]
oid = "IF-MIB::ifName"
is_tag = true
##
## IP metrics
##
# System-wide IP metrics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::ipSystemStatsTable"
##
## ICMP Metrics
##
# ICMP statistics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::icmpStatsTable"
# ICMP per-type statistics
[[inputs.snmp.table]]
index_as_tag = true
oid = "IP-MIB::icmpMsgStatsTable"
##
## UDP statistics
##
# Datagrams delivered to app
[[inputs.snmp.field]]
name = "udpInDatagrams"
oid = "UDP-MIB::udpInDatagrams.0"
# Datagrams received with no app
[[inputs.snmp.field]]
name = "udpNoPorts"
oid = "UDP-MIB::udpNoPorts.0"
# Datagrams received with error
[[inputs.snmp.field]]
name = "udpInErrors"
oid = "UDP-MIB::udpInErrors.0"
# Datagrams sent
[[inputs.snmp.field]]
name = "udpOutDatagrams"
oid = "UDP-MIB::udpOutDatagrams.0"
##
## TCP statistics
##
# Number of CLOSED -> SYN-SENT transitions
[[inputs.snmp.field]]
name = "tcpActiveOpens"
oid = "TCP-MIB::tcpActiveOpens.0"
# Number of SYN-RCVD -> LISTEN transitions
[[inputs.snmp.field]]
name = "tcpPassiveOpens"
oid = "TCP-MIB::tcpPassiveOpens.0"
# Number of SYN-SENT/RCVD -> CLOSED transitions
[[inputs.snmp.field]]
name = "tcpAttemptFails"
oid = "TCP-MIB::tcpAttemptFails.0"
# Number of ESTABLISHED/CLOSE-WAIT -> CLOSED transitions
[[inputs.snmp.field]]
name = "tcpEstabResets"
oid = "TCP-MIB::tcpEstabResets.0"
# Number of ESTABLISHED or CLOSE-WAIT
[[inputs.snmp.field]]
name = "tcpCurrEstab"
oid = "TCP-MIB::tcpCurrEstab.0"
# Number of segments received
[[inputs.snmp.field]]
name = "tcpInSegs"
oid = "TCP-MIB::tcpInSegs.0"
# Number of segments sent
[[inputs.snmp.field]]
name = "tcpOutSegs"
oid = "TCP-MIB::tcpOutSegs.0"
# Number of segments retransmitted
[[inputs.snmp.field]]
name = "tcpRetransSegs"
oid = "TCP-MIB::tcpRetransSegs.0"
# Number of segments received with error
[[inputs.snmp.field]]
name = "tcpInErrs"
oid = "TCP-MIB::tcpInErrs.0"
# Number of segments sent w/RST
[[inputs.snmp.field]]
name = "tcpOutRsts"
oid = "TCP-MIB::tcpOutRsts.0"
##
## IP routing statistics
##
# Number of valid routing entries
[[inputs.snmp.field]]
name = "inetCidrRouteNumber"
oid = "IP-FORWARD-MIB::inetCidrRouteNumber.0"
# Number of valid entries discarded
[[inputs.snmp.field]]
name = "inetCidrRouteDiscards"
oid = "IP-FORWARD-MIB::inetCidrRouteDiscards.0"
# Number of valid forwarding entries
[[inputs.snmp.field]]
name = "ipForwardNumber"
oid = "IP-FORWARD-MIB::ipForwardNumber.0"
##
## IP routing statistics
##
# Number of valid routes discarded
[[inputs.snmp.field]]
name = "ipRoutingDiscards"
oid = "RFC1213-MIB::ipRoutingDiscards.0"

View file

@ -0,0 +1,10 @@
[[inputs.docker]]
endpoint = "unix:///var/run/docker.sock"
perdevice = false
total = true
container_name_include = []
container_name_exclude = []
# container_state_include = []
# container_state_exclude = []
docker_label_include = []
docker_label_exclude = []

77
templates/telegraf.conf Normal file
View file

@ -0,0 +1,77 @@
[agent]
interval = "300s"
hostname = ""
[[outputs.influxdb]]
urls = ["https://influx.jtbx.de:65086"]
database = "servers"
skip_database_creation = true
## Name of existing retention policy to write to.
retention_policy = ""
## Write timeout (for the InfluxDB client), formatted as a string.
timeout = "5s"
username = "servers"
password = "Servers-w.influx@home"
# Read metrics about cpu usage
[[inputs.cpu]]
percpu = false
totalcpu = true
collect_cpu_time = false ## If true, collect raw CPU time metrics
report_active = true ## If true, compute and report the sum of all non-idle CPU states.
fieldpass = ["usage_user", "usage_system", "usage_iowait", "usage_irq", "usage_active"]
# Read metrics about memory usage
[[inputs.mem]]
#fieldpass = ["total", "used_percent"]
# Read metrics about disk usage by mount point
[[inputs.disk]]
# By default, telegraf gather stats for all mountpoints.
mount_points = ["/"]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"]
fieldpass = ["total", "free", "used_percent"]
# Read metrics about disk IO by device
[[inputs.diskio]]
## By default, telegraf will gather stats for all devices including partitions.
## Setting devices will restrict the stats to the specified devices.
devices = ["sd[a-d]", "mmcblk[0-1]", "ada[0-9]", "nvd[0-9]"]
## Uncomment the following line if you need disk serial numbers.
# skip_serial_number = false
fieldpass = ["read_bytes", "write_bytes", "io_time", "weighted_io_time", "iops_in_progress"]
# Read metrics about system load & uptime
[[inputs.system]]
# default config, pass all fields
# Get TCP connection state and UDP socket counts using lsof
[[inputs.netstat]]
fieldpass = ["tcp_established", "tcp_listen", "udp_socket"]
# Gather metrics about network interface and protocol usage (Linux only)
[[inputs.net]]
interfaces = ["eth*", "enp0s[0-1]"]
ignore_protocol_stats = true
fieldpass = ["bytes_sent", "bytes_recv"]
{% if telegraf_docker|default(false)|bool %}
{% include telegraf_docker_file %}
{% endif %}
{% if telegraf_snmp|default(false)|bool %}
{% include telegraf_snmp_file %}
{% endif %}
# # Monitor sensors, requires lm-sensors package
# [[inputs.sensors]]
# ## Remove numbers from field names.
# ## If true, a field name like 'temp1_input' will be changed to 'temp_input'.
# # remove_numbers = true

View file

@ -0,0 +1,31 @@
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file
dc_eximconfig_configtype='internet'
dc_other_hostnames='{{ ansible_hostname }}, localhost.localdomain, localhost'
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=''
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname=''
dc_mailname_in_oh='true'
dc_localdelivery='maildir_home'