#!/bin/sh

# Add $ARGS for more arguments to node_exporter
[ -f ./conf ] && . ./conf

: ${USER:=_node_exporter}
: ${RUNIT_COLLECTOR:='-collector.runit.servicedir /var/service'}
[ -n "$LISTEN_ADDR" ] && LISTEN_ADDR="-web.listen-address ${LISTEN_ADDR}"
# The below must match upstream's default enabled collectors, and because we can, we add 'runit'
: ${ENABLED_MODS:='conntrack,diskstats,entropy,edac,filefd,filesystem,hwmon,infiniband,loadavg,mdadm,meminfo,netdev,netstat,sockstat,stat,textfile,time,uname,vmstat,wifi,zfs,runit'}

exec chpst -u $USER node_exporter -collectors.enabled ${ENABLED_MODS} ${RUNIT_COLLECTOR} ${LISTEN_ADDR} ${ARGS}
