Add a script to generate test data for plog95
This commit is contained in:
parent
32a1cd3cbc
commit
06f1c42c29
1 changed files with 56 additions and 0 deletions
56
tests/gen-data.py
Executable file
56
tests/gen-data.py
Executable file
|
@ -0,0 +1,56 @@
|
|||
#! /usr/bin/env python3
|
||||
from datetime import datetime, timezone, timedelta
|
||||
# import array
|
||||
import sys
|
||||
|
||||
ifaces=[ 'eth0', 'eth1', 'eth2' ]
|
||||
state={}
|
||||
for i in ifaces:
|
||||
state[i] = {
|
||||
'rbytes': 1000,
|
||||
'rpackets': 20,
|
||||
'rerrs': 0,
|
||||
'rdrop': 0,
|
||||
'rfifo': 0,
|
||||
'rframe': 0,
|
||||
'rcomp': 0,
|
||||
'rmulti': 10,
|
||||
'tbytes': 2000,
|
||||
'tpackets': 40,
|
||||
'terrs': 0,
|
||||
'tdrop': 0,
|
||||
'tfifo': 0,
|
||||
'tcoll': 0,
|
||||
'tcarrier': 0,
|
||||
'tcomp': 0
|
||||
}
|
||||
|
||||
|
||||
d = datetime(2023, 2, 18, 0, 0, 0, tzinfo=timezone.utc)
|
||||
|
||||
for i in range(8640):
|
||||
print( d.strftime("=== %a %b %d %H:%M:%S %Z %Y ==="))
|
||||
d += timedelta(seconds=10)
|
||||
for iface in ifaces:
|
||||
state[iface]['rbytes'] += 100000000
|
||||
|
||||
print("Inter-| Receive | Transmit")
|
||||
print(" face |bytes packets errs drop fifo frame compresses multicast|bytes packets errs drop fifo colls carrier compressed")
|
||||
print("%s: %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d" % (
|
||||
iface,
|
||||
state[iface]["rbytes"],
|
||||
state[iface]["rpackets"],
|
||||
state[iface]["rerrs"],
|
||||
state[iface]["rdrop"],
|
||||
state[iface]["rfifo"],
|
||||
state[iface]["rframe"],
|
||||
state[iface]["rcomp"],
|
||||
state[iface]["rmulti"],
|
||||
state[iface]["tbytes"],
|
||||
state[iface]["tpackets"],
|
||||
state[iface]["terrs"],
|
||||
state[iface]["tdrop"],
|
||||
state[iface]["tfifo"],
|
||||
state[iface]["tcoll"],
|
||||
state[iface]["tcarrier"],
|
||||
state[iface]["tcomp"]))
|
Loading…
Add table
Reference in a new issue