add new scripts
[monitor.git] / statistics / bm_reboot_api.r
1
2 source("functions.r");
3
4 # system("parse_rt_data.py > rt_data.csv");
5 # ./bmevents.py events.1-18-10 BootUpdateNode > bm_reboot_2010-01-18.csv
6 # ./bmevents.py events.10-08-09 BootUpdateNode > bm_reboot_2009-10-08.csv 
7 # ./bmevents.py events.29.12.08.dump BootUpdateNode > bm_reboot_2008-12-29.csv
8 # ./bmevents.py events.8-25-09.dump BootUpdateNode > bm_reboot_2009-08-25.csv
9
10 t <- read.csv('bm_reboot_2008-12-29.csv', sep=',', header=TRUE)
11
12 t2<-t
13
14 tstamp_78 <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))[1]
15 tstamp_89 <-unclass(as.POSIXct("2009-01-01", origin="1960-01-01"))[1]
16
17 t_7 <- t2[which( t2$start < tstamp_78 ),]
18 t_8 <- t2[which( t2$start >= tstamp_78 & t2$start < tstamp_89 ),]
19 t_9 <- t2[which( t2$start >= tstamp_89 ),]
20
21 tstamp <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))
22 t_67 <- t2[which( t2$start <  tstamp[1] ),]
23 t_89 <- t2[which( t2$start >= tstamp[1] ),]
24
25 start_image("bm_reboot_api.png")
26
27 par(mfrow=c(2,1))
28 par(mai=c(.5,.4,.5,.4))
29 year_hist(t_9, "2009", "2009/06/21", "2010/2/10", 500, 'day', "Daily Reboot Rates")
30 rows_api <- year_hist_unique(t_9, "2009", "2009/06/21", "2010/2/10", 100, 'day', "Unique Daily Reboots")
31
32 #year_hist(t_89, "2008-2009", "2008/01/21", "2010/2/10", 0, 'day', "Daily Reboot Rates")
33 #rows <- year_hist_unique(t_89, "2008-2009", "2008/01/21", "2010/2/10", 0, 'day', "Unique Daily Reboots")
34
35 end_image()
36
37
38 ## NOTE: compare api and log data:
39 start_image("bm_reboot_compare.png", width=960)
40 par(mfrow=c(1,1))
41 par(mai=c(1.0,.7,.7,.7))
42 x<- cbind(rows$reboots, rows_api$reboots)
43 #barplot(t(x), beside=TRUE, ylim=c(0,150), main="Compare Daily Frequency of Raw-logs & API Events")
44 barplot(rows$reboots-rows_api$reboots, ylim=c(-40,150), main="Difference between Raw-logs & API Events", xlab="Day", ylab="Difference of Frequency")
45 end_image()
46
47 # it appears that logs come out ahead consistently of the API events.
48 start_image("bm_reboot_diff_freq.png")
49 d<-rows$reboots-rows_api$reboots
50 hist(d[which( d > -10 & d < 20)], breaks=20, main="Frequency of Differences", xlab="Difference")
51 end_image()
52
53 # * why is this so?
54
55 ###
56
57 start_image("reboot_distributions.png")
58 par(mfrow=c(2,1))
59 par(mai=c(.5,.5,.5,.5))
60
61 m<-mean(rows$reboots[which(rows$reboots>0&rows$reboots<50)])
62 s<-sd(rows$reboots[which(rows$reboots>0&rows$reboots<50)])
63
64 qqnorm(rows$reboots[which(rows$reboots>0&rows$reboots<50)])
65 qqline(rows$reboots[which(rows$reboots>0&rows$reboots<50)])
66
67 h<-hist(rows$reboots[which(rows$reboots>0&rows$reboots<50)], breaks=20)
68 x<- 0:100/100 * 2 * m
69 y<- dnorm(x, mean=m, sd=s)
70 lines(x,y*max(h$counts)/max(y))
71 end_image()
72
73 par(mfrow=c(1,1))
74 par(mai=c(.7,.7,.7,.7))