This scrapes all possible interfaces for a device and sends the data to the configured InfluxDB.
The idea was born, because Telegraf Docker container was too big to run on a Mikrotik CCR2004-1G-12S+2XS (it has only 128mb flash). Also the approach is to be able to cut off inbound internet access to the Mikrotik completely and just send metrics via HTTPS to InFluxDb.
Also the idea is to scrape multiple devices from the Mikrotik and just upload all this data without the need to install the container on every device.
Container size
REPOSITORY TAG IMAGE ID CREATED SIZE scraper latest 2861ced8e846 About an hour ago 55.8MB Disk usage after install
default_community: public devices: - hostname: testhost01 ip: 127.0.0.1 community: public username: password: influxdb: uri: testinflux username: testuser password: testpw database: nicedb Select and export a corresponding docker image like this:
docker pull ghcr.io/awlx/snmp-to-influx-python:latest@sha256:f225b522613270f6b36fb22683e78ff466c47f5c052aa911b933f583b602ab51 docker save snmp-to-influx-python:latest > snmp.tar Requirements:
- Working container package and veth pairs on the Mikrotik device
- You uploaded the snmp.tar to the rootfs
- You created a directory
configon part0 and added ascraper.yaml
/container/mounts/add name=scraper src=config dst=/config /container/envs/add list=snmp name=SNMP_TO_INFLUX_CONFIG_FILE value=/config/scraper.yaml /container/add file=snmp.tar interface=veth1 root-dir=snmp mounts=scraper logging=yes envlist=snmp /container/start <insert_container_number_here> When everything works you should see an output like this
[admin@MikroTik] > /container/print 0 file=snmp.tar name="a1f6ef78-bdcb-4fc8-8bc4-4eac98743ff0" tag="scraper:latest" os="linux" arch="arm64" interface=veth1 envlist="snmp" root-dir=snmp mounts=scraper dns="" logging=yes status=running [admin@MikroTik] > Logs can be found in /log/print
All pre-build containers can be downloaded here
References:

