# Clone Debian Buster template, set up IPs, hostname, ssh keys
apt update
apt -y dist-upgrade
apt install influxdb

# Set up network interfaces, /etc/network/interfaces
auto lo
iface lo inet loopback
auto ens18 ens19 ens20 ens21 ens22 ens22:0 ens22:1
iface ens18 inet static
        address 10.22.22.116/24
        gateway 10.22.22.254
        dns-nameservers 10.22.22.254
        dns-search forksand.com
iface ens19 inet static
        address 10.68.68.116/24
iface ens20 inet static
        address 10.3.1.116/24
iface ens21 inet static
        address 10.3.2.116/24
iface ens22 inet static
        address 10.99.99.116/24
iface ens22:0 inet static
        address 10.99.1.116/24
iface ens22:1 inet static
        address 10.99.2.116/24


### Set to listen on one IP
### XXX set up auth, letsencrypt
[http]
  bind-address = "10.22.22.116:8086"

### XXX Setup Graphite listener
### XXX Setup collectd listener

### XXX Setup UDP listener for Proxmox
[[udp]]
  enabled = true
  bind-address = "10.22.22.116:8089"
  database = "proxmox"
  batch-size = 1000
  batch-timeout = "1s"

### set up collectd
apt install collectd-core

# Add to firewall
# Allow InfluxDB Web interface
-A INPUT -p tcp --dport  8086 -j ACCEPT
# Allow InfluxDB UDP port
-A INPUT -p udp --dport  8089 -j ACCEPT
# collectd
-A INPUT -p udp --dport 25826 -j ACCEPT

####################################################################
# Set up on Proxmox server sf-001 only,  /etc/pve/status.cfg
influxdb:
   server 10.22.22.116
   port 8089


####################################################################
### Set up on Grafana:
http://10.22.22.116:8086
# Database name:
proxmox

# Add dashboard enda-pve-kvm-dashboard.json
# https://forum.proxmox.com/threads/proxmox-4-0-external-metrics-server-wiki-howto.23901/
# Dashboards:
# https://grafana.com/dashboards/5872


### XXX Backups
### XXX Prometheus :)

####################################################################
apt install influxdb-client
# As non-root:
influx -host 10.22.22.116
> show databases
####################################################################
