3 # data collected from M3 fb db
4 # system("./harvest_nodestatus.py > node-status-jun09-feb10.csv")
5 ns <- read.csv('node-status-jun09-feb10.csv', sep=',', header=TRUE)
7 available_nodes <- function (ns, from, to, type, fmt="%b")
9 # find 'type' range of days
10 dates <-seq(as.Date(from), as.Date(to), type)
11 months <- format(dates, fmt)
12 hbreaks<-unclass(as.POSIXct(dates))
17 for ( i in seq(1,length(hbreaks)-1) )
20 ns_sub <- ns[which(ns$date > hbreaks[i] & ns$date <= hbreaks[i+1] & ns$status == 'BOOT'),]
21 nodes <- length(ns_sub$date)
23 xx<- c(xx, hbreaks[i])
27 m<- months[1:length(months)-1]
28 return (rbind(xx,yy,m))
31 an <- available_nodes(ns, "2009-06-10", "2010-02-28", 'day')
33 x_start<-unclass(as.POSIXct("2009-06-10", origin="1970-01-01"))[1]
34 x_end <-unclass(as.POSIXct("2010-02-28", origin="1970-01-01"))[1]
37 par(mai=c(.9,.8,.5,.4))
38 #start_image("daily-node-count.png")
39 sx<-an[1,][which(as.numeric(an[2,]) > 100)]
40 sy<-an[2,][which(as.numeric(an[2,]) > 100)]
42 type='l', col='blue', ylim=c(0,1000), xlim=c(x_start, x_end),
43 xlab="Date", ylab="Node Count", axes=F)
45 axis(1, labels=months, at=hbreaks)