add new scripts
[monitor.git] / statistics / node_history_all.r
1 source("functions.r");
2
3 # system("./extract_all.py 2007-* > ../findbad_raw_2007.csv")
4 # system("./extract_all.py 2008-* > ../findbad_raw_2008.csv")
5 # system("./extract_all.py 2009-* > ../findbad_raw_2009.csv")
6
7 fb7 <- read.csv('findbad_raw_2007.csv', sep=',', header=TRUE)
8 fb8 <- read.csv('findbad_raw_2008.csv', sep=',', header=TRUE)
9 fb9 <- read.csv('findbad_raw_2009.csv', sep=',', header=TRUE)
10
11 online_nodes <- function (fb)
12 {
13     breaks <- unique(fb$timestamp)
14     n<-NULL
15     o<-NULL
16     x<-NULL
17     for (i in seq(1,length(breaks)) )
18     {
19         ts <- breaks[i]
20         sub <- fb[which(fb$timestamp == ts),]
21         node_count   <- length(unique(sub$hostname))
22         online_count <- length(unique(sub$hostname[which(sub$state=='BOOT')]))
23         x<-c(x,ts)
24         n<-c(n,node_count)
25         o<-c(o,online_count)
26     }
27     print(length(x))
28     print(length(n))
29     print(length(o))
30     return (rbind(x,n,o))
31 }
32 z7<- online_nodes(fb7)
33 z8<- online_nodes(fb8)
34 z9<- online_nodes(fb9)
35
36 plot(c(z7[1,],z8[1,],z9[1,]), log(c(z7[2,], z8[2,],z9[2,])), 
37         ylim=c(0,7), xlim=c(min(x1), max(x1)), type='p', pch='.', axes=F)
38 points(c(z7[1,],z8[1,],z9[1,]) , log(c(z7[3,], z8[3,],z9[3,])), pch='.')
39
40
41
42 t_july08 <-unclass(as.POSIXct("2008-07-01", origin="1970-01-01"))[1]
43 breaks <- unique(fb8$timestamp[which(fb8$timestamp < t_july08)])
44 fb8_boot <- fb8$timestamp[which(fb8$state=="BOOT" & fb8$timestamp < t_july08)]
45 h8<-hist(fb8_boot, breaks=breaks[which(!is.na(breaks) & breaks!=0)])
46
47 breaks <- unique(as.numeric(as.character(fb9$timestamp)))
48 fb9_boot <- as.numeric(as.character(fb9$timestamp[which(fb9$state=="BOOT")]))
49 hist(fb9_boot, breaks=breaks[which(!is.na(breaks) & breaks >= 1230775020)])
50