Skip to content

flah00/lan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

LAN scripts

Store ifconfig stats, including RX/TX errors, drops, overruns, packets, in influxdb

Stats are stored in a bucket, the measurement is called ifconfig

Influx tags

  • iface: eth0, lo, etc
  • stat: errors, dropped, overruns, etc
  • dir: tx or tx
  • host: the alias tag assigned by ifconfig.sh

Scripts

  • ifconfig.sh: collect ifconfig output, insert into local docker influxdb
    • ENVVAR DEBUG: Do not delete mktemp dir if set to true, write stdout and stderr to /tmp/ifconfig.$$.log
    • Exits non-zero, if influx generates an error file
  • parse.py: extract ifconfig stats, convert to csv
    • ARG 1: csv output file
    • ARG 2: host alias, an influxdb tag
    • ARG 3: RFC 3339 date

Influx setup

docker volume create influxdb2_data
docker volume create influxdb2_etc_data

docker create --name influxdb2 \
  -v influxdb2_etc_data:/etc/influxdb2 \
  -v influxdb2_data:/var/lib/influxdb2 \
  -p 8086:8086 \
  influxdb:2.0

Influx Query

from(bucket: "home")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r["_measurement"] == "ifconfig" and
       r["_field"] == "long" and
       (r["dir"] == "rx" or r["dir"] == "tx") and
       r["host"] == "router" and
       r["iface"] == "eth1" and
       (r["stat"] == "dropped" or r["stat"] == "errors" or r["stat"] == "overruns"))
  |> aggregateWindow(every: 1m, fn: last, createEmpty: false)
  |> yield(name: "last")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published