Sending stats to graphite / influx db

Last week I tried to configure kresd on my Turris Omnia to load the graphite module and write statistics to my influxdb instance.
It turned out, that it wasn’t enough to install luasocket with the package manager. It seems kresd uses its own lua modules directory, and does not use the system luas modules. Strange!
I had to make two symlinks in /usr/lib/kdns_modules/

lrwxrwxrwx 1 root root 19 May 27 17:37 socket -> /usr/lib/lua/socket
lrwxrwxrwx 1 root root 23 May 27 17:36 socket.lua -> /usr/lib/lua/socket.lua

Kresd config for graphite (add to /etc/kresd/custom.conf)
modules.load( ‘graphite’ )
graphite.config( {
prefix = ‘kresd’…’.’…hostname()…’.’…worker.id, – optional metric prefix
host = ‘1.2.3.4’, – graphite server address
interval = 5 * sec, – publish interval
tcp = true – set to true if want TCP mode
}
)

My Influx db config for graphite
[[graphite]]
enabled = true
bind-address = ":2003"
database = "dns"
retention-policy = ""
protocol = "tcp"
batch-size = 5000
batch-pending = 10
batch-timeout = "1s"
consistency-level = "one"
separator = "_"
udp-read-buffer = 0
templates = [
“kresd.* .host.worker.measurement.field”
]