set.seed(1113)
sample(c("Axel","Mike","Markus"))
set.seed(1214)
sample(c("Axel","Mike","Markus"), size=1)
library("tidyverse")
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ✔ dplyr 1.1.4 ✔ readr 2.1.5 ✔ forcats 1.0.0 ✔ stringr 1.5.1 ✔ ggplot2 3.4.4 ✔ tibble 3.2.1 ✔ lubridate 1.9.3 ✔ tidyr 1.3.1 ✔ purrr 1.0.2 ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag() ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
options(repr.plot.width=14, repr.plot.res=300)
cpu <- read_tsv("cpu.tsv") %>% mutate(timestamp = ymd_hms(timestamp))
Rows: 346230 Columns: 10 ── Column specification ──────────────────────────────────────────────────────── Delimiter: "\t" chr (2): hostname, timestamp dbl (8): interval, CPU, %user, %nice, %system, %iowait, %steal, %idle ℹ Use `spec()` to retrieve the full column specification for this data. ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
head(cpu)
hostname | interval | timestamp | CPU | %user | %nice | %system | %iowait | %steal | %idle |
---|---|---|---|---|---|---|---|---|---|
<chr> | <dbl> | <dttm> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
gaia2 | 60 | 2024-03-01 09:45:27 | -1 | 1.05 | 0 | 2.62 | 0.09 | 0 | 96.23 |
gaia2 | 60 | 2024-03-01 09:46:27 | -1 | 1.33 | 0 | 2.92 | 0.16 | 0 | 95.60 |
gaia2 | 60 | 2024-03-01 09:47:27 | -1 | 1.47 | 0 | 2.98 | 0.16 | 0 | 95.38 |
gaia2 | 60 | 2024-03-01 09:48:27 | -1 | 1.65 | 0 | 3.25 | 0.09 | 0 | 95.01 |
gaia2 | 60 | 2024-03-01 09:49:27 | -1 | 1.05 | 0 | 2.42 | 0.06 | 0 | 96.47 |
gaia2 | 60 | 2024-03-01 09:50:27 | -1 | 1.38 | 0 | 2.22 | 0.06 | 0 | 96.34 |
cpu %>%
ggplot(aes(x=timestamp, y=`%idle`, color=hostname)) + geom_line()
cpu2<-cpu%>%
filter(timestamp<lubridate::ymd("2024-03-31"))
cpu2 %>%
ggplot(aes(x=timestamp, y=`%idle`, color=hostname)) + geom_line()
summary(cpu2$timestamp)
Min. 1st Qu. "2024-03-01 09:45:25.0000" "2024-03-08 16:06:26.0000" Median Mean "2024-03-15 22:27:27.0000" "2024-03-15 16:42:06.9877" 3rd Qu. Max. "2024-03-22 18:14:46.0000" "2024-03-29 10:20:05.0000"
cpu3 <- cpu2 %>%
group_by(hostname, lubridate::day(timestamp)) %>%
summarize(idle=min(`%idle`))
`summarise()` has grouped output by 'hostname'. You can override using the `.groups` argument.
cpu3%>%
ggplot(aes(x=idle,fill=hostname))+
geom_histogram()
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
cpu3 %>%
filter(idle>75 & idle<90)
hostname | lubridate::day(timestamp) | idle |
---|---|---|
<chr> | <int> | <dbl> |
gaia2 | 5 | 75.80 |
gaia2 | 11 | 89.48 |
gaia2 | 25 | 87.04 |
gaia3 | 12 | 89.67 |
gaia3 | 28 | 87.86 |
gaia4 | 2 | 82.10 |
gaia4 | 3 | 81.42 |
gaia4 | 7 | 88.19 |
gaia4 | 8 | 78.73 |
gaia4 | 12 | 76.43 |
gaia4 | 13 | 75.38 |
gaia4 | 14 | 76.56 |
gaia4 | 15 | 75.30 |
gaia4 | 16 | 75.92 |
gaia4 | 25 | 75.66 |
gaia5 | 1 | 83.84 |
gaia5 | 2 | 82.90 |
gaia5 | 3 | 82.16 |
gaia5 | 6 | 81.99 |
gaia5 | 7 | 80.09 |
gaia5 | 9 | 78.55 |
gaia5 | 10 | 79.08 |
gaia5 | 11 | 78.16 |
gaia5 | 13 | 87.42 |
gaia5 | 14 | 80.74 |
gaia5 | 15 | 82.00 |
gaia5 | 16 | 75.49 |
gaia5 | 17 | 86.24 |
gaia5 | 18 | 83.54 |
gaia5 | 19 | 86.82 |
gaia5 | 20 | 77.34 |
gaia5 | 21 | 89.68 |
gaia5 | 22 | 87.67 |
gaia5 | 25 | 89.70 |
gaia5 | 26 | 89.16 |
gaia5 | 27 | 86.28 |
gaia5 | 28 | 89.08 |
jupiter4 | 3 | 83.03 |
jupiter4 | 27 | 88.34 |
jupiter5 | 3 | 86.39 |
library(lubridate)
cpu2 %>%
mutate(d=day(timestamp)) %>%
filter(hostname=="gaia5", d==5) %>%
ggplot(aes(x=timestamp, y=`%idle`)) + geom_line()
cpu2 %>%
mutate(d=day(timestamp)) %>%
filter(hostname=="gaia5") %>%
ggplot(aes(x=timestamp, y=`%idle`)) + geom_line() + facet_wrap(d~., scales="free_x")
cpu2 %>%
mutate(d=day(timestamp)) %>%
filter(hostname=="jupiter") %>%
ggplot(aes(x=timestamp, y=`%idle`)) + geom_line() + facet_wrap(d~., scales="free_x")
cpu2 %>%
mutate(d=day(timestamp)) %>%
filter(hostname=="jupiter") %>%
ggplot(aes(x=timestamp, y=`%idle`)) + geom_line() + facet_wrap(d~., scales="free_x")
mem <- read_tsv("mem.tsv") %>% mutate(timestamp = ymd_hms(timestamp))
Rows: 346229 Columns: 14 ── Column specification ──────────────────────────────────────────────────────── Delimiter: "\t" chr (2): hostname, timestamp dbl (12): interval, kbmemfree, kbavail, kbmemused, %memused, kbbuffers, kbca... ℹ Use `spec()` to retrieve the full column specification for this data. ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
mem2<-mem %>%
filter(timestamp<lubridate::ymd("2024-03-31"))%>%
filter(hostname=="jupiter")
mem2%>%
mutate(d=day(timestamp))%>%
ggplot(aes(x=timestamp, y=`%memused`)) + geom_line() + facet_wrap(d~., scales="free_x")