Skip to content

Instantly share code, notes, and snippets.

@alinVD
Created February 9, 2017 18:37
Show Gist options
  • Select an option

  • Save alinVD/f755dbbceeaa3f78cd474aeacb1fa78a to your computer and use it in GitHub Desktop.

Select an option

Save alinVD/f755dbbceeaa3f78cd474aeacb1fa78a to your computer and use it in GitHub Desktop.
Compute overall usage of Netflow Data
# RTime: 282s
# Tuples:
## This query shows the total activity, measured in bytes transmitted in either
## direction. The daily profiles are charted at the 15 minute resolution.
library(gtStats)
## The bounds for the data that is being considered.
lower <- as.POSIXct("2012-04-06 00:00:00", "GMT")
upper <- as.POSIXct("2012-04-16 23:59:59", "GMT")
## The data is filtered to only include data from April.
flow <- Load(NetFlow)[.(lower) <= StartTime && StartTime <= .(upper)]
daily <- GroupBy(flow,
c(Date = Date(StartTime),
Hour = StartTime$Hour(),
Quarter = StartTime$Minute() %/% 15),
Bytes = Sum(abs(TotBytes)),
Count = Count())
overall <- GroupBy(daily, Date,
LineChart(c(4 * Hour + Quarter, Bytes), Chart, 96),
Sum(Count))
ordered <- OrderBy(overall, asc(Date))
result <- View(ordered)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment