mkfifo ifstat_fifo
ifstat -n > ifstat_fifo
Then, in another terminal, open an R shell and do the following:
# Plot the most recent 100 seconds of inbound network traffic
> while(T){
d <- read.table(fifo("ifstat_fifo",open="read"))
x <- rbind(x,d)
x <-tail(x,100)
plot(x$V1,type='l')
Sys.sleep(1)
}
You may have to run it a couple times while the fifo fills with data. And here's what that looks like:
Thanks for this post. However, I don't know what x is in your example. Also, I couldn't get the read.table(...) function to work but was able to use readLines(...). I'm new to R, so do you mind expanding on this post?
ReplyDeleteThanks!