3 nsh <- read.csv('node_status_history.csv', sep=',', header=TRUE)
5 # system("./harvest_nodehistory.py > node_status_history_nopcu.csv")
6 nsh_nopcu <- read.csv('node_status_history_nopcu.csv', sep=',', header=TRUE)
8 nsh_m1 <- read.csv('node_status_history_m1.csv', sep=',', header=TRUE)
9 # system("stats-m1/harvest_nodehistory_m1.py > ./node_status_history_m1_nopcu.csv")
10 nsh_m1_nopcu <- read.csv('node_status_history_m1_nopcu.csv', sep=',', header=TRUE)
11 nsh_m1_nopcu_may <- read.csv('node_status_history_m1_nopcu_may08sep08.csv', sep=',', header=TRUE)
13 node_hist_image <- function (t, year, from, to, max=0, type="week", title="")
15 dates <-seq(as.Date(from), as.Date(to), type)
16 months <- format(dates, "%b-%d")
17 hbreaks<-unclass(as.POSIXct(dates))
19 image <- matrix(data=0, nrow=max(as.numeric(t$hostname)), ncol=length(hbreaks))
21 for ( i in seq(1, length(hbreaks)) )
23 # find the range : d plus a day
26 # find unique hosts in this day range
27 t_sub <- t[which(t$start > d & t$start <= d_end & t$status == 'down'),]
28 unique_hosts <- unique(t_sub$hostname)
29 if (length(unique_hosts) == 0 ) { next }
31 host_n_list <- unique_hosts
32 host_s_list <- as.character(unique_hosts)
34 for ( hi in seq(1, length(unique_hosts)) )
36 host_s <- host_s_list[hi]
37 host_n <- host_n_list[hi]
38 # events for this host after d (to avoid already identified events)
39 ev <- t[which(t$hostname == host_s & t$start > d ),]
40 print (sprintf("events length for host %s %s", host_s, length(ev$start)));
41 # get down events for this host
42 down_ev_index_list <- which(ev$status == 'down')
43 for ( e_i in down_ev_index_list )
45 if ( e_i == length(ev$status) ) {
46 # then the node ends down, so fill in the rest with 1.
47 for ( j in seq(i,length(hbreaks)) ) {
51 # then there is a subsequent 'good' event
54 dbreaks <- seq(d,good_ev$start+60*60*24,60*60*24)
55 # for every index for time d, to good_ev$start
57 print (sprintf("length %s",l));
58 for ( j in seq(i,i+l) )
66 myImagePlot(image, xLabels=months, yLabels=c(""), title=title)
72 node_hist_dist <- function (t, year, from, to, max=0, type="week", title="")
74 dates <-seq(as.Date(from), as.Date(to), type)
75 months <- format(dates, "%b-%d")
76 hbreaks<-unclass(as.POSIXct(dates))
77 current_ts <- unclass(as.POSIXct(Sys.Date()))
81 unique_hosts <- unique(t$hostname)
82 host_n_list <- unique_hosts
83 host_s_list <- as.character(unique_hosts)
87 for ( hi in seq(1, length(unique_hosts)) )
89 host_s <- host_s_list[hi]
90 host_n <- host_n_list[hi]
91 # events for this host after d (to avoid already identified events)
92 ev <- t[which( t$hostname == host_s ),]
93 print (sprintf("events length for host %s %s", host_s, length(ev$start)));
94 # get down events for this host
95 down_ev_index_list <- which(ev$status == 'down')
96 for ( e_i in down_ev_index_list )
98 # when equal, there is no resolution so leave it as down
99 if ( e_i != length(ev$status) ) {
100 good_ev <- ev[e_i+1,]
102 dist <- c(dist, good_ev$start - down_ev$start)
103 } else if ( e_i == length(ev$status) && length(ev$status) == 1) {
104 print (sprintf("DOWN FOREVER! %s", length(ev$start) ))
106 dist <- c(dist, 10*current_ts - ev$start)
114 nsh_image <- node_hist_image(nsh, '2009', '2009-06-01', '2010-02-28', 0, 'day')
115 nsh_image_m1 <- node_hist_image(nsh_m1, '2009', '2008-10-01', '2009-03-28', 0, 'day')
118 nsh_short <- nsh[which(nsh$start > unclass(as.POSIXct("2009-06-01", origin="1970-01-01"))[1]),]
119 nsh_short <- nsh_short[which(nsh_short$start < unclass(as.POSIXct("2009-10-31", origin="1970-01-01"))[1]),]
122 nsh_short <- nsh_nopcu
123 nsh_dist <- node_hist_dist(nsh_short, '2009', '2009-06-01', '2010-02-28', 0, 'day')
124 d<- ecdf(nsh_dist/(60*60*24))
126 #nsh_m1_short <- nsh_m1[which(nsh_m1$start > unclass(as.POSIXct("2008-10-01", origin="1970-01-01"))[1]),]
127 nsh_m1_short <- nsh_m1_nopcu
128 # NOTE: something happened betweeen 10-2 and 10-3
129 t_1015 <- unclass(as.POSIXct("2008-10-15", origin="1970-01-01"))[1]
130 t_0224 <- unclass(as.POSIXct("2009-02-24", origin="1970-01-01"))[1]
131 nsh_m1_short <- nsh_m1_nopcu[which(nsh_m1_nopcu$start > t_1015 & nsh_m1_nopcu$start <= t_0224),]
133 nsh_m1_short <- nsh_m1_nopcu
134 nsh_dist_m1 <- node_hist_dist(nsh_m1_short, '2008', '2008-10-01', '2009-03-22', 0, 'day')
135 d_m1<- ecdf(nsh_dist_m1/(60*60*24))
138 t_0530 <- unclass(as.POSIXct("2008-05-30", origin="1970-01-01"))[1]
139 t_0815 <- unclass(as.POSIXct("2008-08-15", origin="1970-01-01"))[1]
140 nsh_m1_short <- nsh_m1_nopcu_may[which(nsh_m1_nopcu_may$start > t_0530 & nsh_m1_nopcu_may$start <= t_0815),]
141 nsh_dist_m1 <- node_hist_dist(nsh_m1_short, '2008', '2008-05-10', '2008-08-15', 0, 'day')
142 d_m1_may <- ecdf(nsh_dist_m1/(60*60*24))
145 # d<-ecdf(nsh_dist[which(nsh_dist/(60*60*24) < 90 )]/(60*60*24)),
148 par(mai=c(.9,.9,.1,.1))
149 start_image("node_history_ttr_nopcu.png")
150 plot(d, xlim=c(0,180), ylim=c(0,1), axes=F, xlab="Days to Resolve", ylab="Percentile",
151 col.hor='red', col.vert='red', pch='.', col.points='red', main="")
152 plot(d_m1, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", ylab="Percentile",
153 col.hor='blue', col.vert='blue', pch='.', col.points='blue', add=TRUE)
154 plot(d_m1_may, xlim=c(0,180), ylim=c(0,1), xlab="Days to Resolve", ylab="Percentile",
155 col.hor='green', col.vert='green', pch='.', col.points='green', add=TRUE)
157 weeks <- c(0,7,14,21,28,60,90,120,150,180)
158 axis(1, labels=weeks, at=weeks)
159 percentages <- c(0,0.25, 0.5, 0.75, 0.85, 0.95, 1)
160 axis(2, las=1, labels=percentages, at=percentages)
162 abline(v=c(7,14,21,28), col='grey80', lty=2)
163 abline(h=c(0.5, 0.6, 0.75, 0.85, 0.95 ), col='grey80', lty=2)
164 abline(v=c(91), col='grey80', lty=2)
169 legend=c("Typical MyOps -- July2009-Feb2010", "Notice Bug -- Oct2008-Mar2009", "Kernel Bug -- May2008-Sept2008"),
170 pch=c('-', '-', '-'),
171 col=c('red', 'blue', 'green'),
172 lty=c(1, 1, 1), merge=T)