Created
November 12, 2016 11:36
-
-
Save titpetric/65edef0a4a09493f6059692deb8dbbce to your computer and use it in GitHub Desktop.
Fake copy of a part of /proc/net fs, with about 200ms of latency
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
OUTPUT="/dev/shm/fakenet/"; | |
if [ ! -d "$OUTPUT" ]; then | |
mkdir -p $OUTPUT/{rpc,stat,ip_vs} | |
fi | |
SOURCES="/proc/net/dev | |
/proc/net/ip_vs_stats | |
/proc/net/ip_vs/stats | |
/proc/net/netstat | |
/proc/net/rpc/nfs | |
/proc/net/rpc/nfsd | |
/proc/net/snmp | |
/proc/net/snmp6 | |
/proc/net/softnet_stat | |
/proc/net/stat/conntrack | |
/proc/net/stat/nf_conntrack | |
/proc/net/stat/synproxy" | |
NETFILES="" | |
for SOURCE in $SOURCES; do | |
if [ -f "$SOURCE" ]; then | |
NETFILES="$NETFILES $SOURCE" | |
fi | |
done | |
while [ true ]; do | |
for NETFILE in $NETFILES; do | |
OUTFILE="${NETFILE:10}" | |
echo "$(<$NETFILE)" > $OUTPUT$OUTFILE | |
done | |
#date +%s.%N | |
sleep 0.18 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment