clearer names for actions, and infer actions better
[monitor.git] / statistics / rt_monitor_data.r
1
2
3 source("functions.r");
4
5 # system("parse_rt_data.py 22 > rt_monitor_data.csv");
6 m <- read.csv('rt_monitor_data.csv', sep=',', header=TRUE)
7
8 par(mfrow=c(2,1))
9
10 h<-hist(log(log(m$replies)), breaks=50)
11 lines(h$breaks[which(h$counts!=0)], h$counts[which(h$counts!=0)])
12 h<-hist(log(log(log(m$replies))), breaks=50)
13 lines(h$breaks[which(h$counts!=0)], h$counts[which(h$counts!=0)])
14
15
16 par(mfrow=c(1,1))
17
18 m2 <- m[which(m$complete == 1),]
19 d <- (m2$lastreply - m2$start)/(60*60)
20
21 #start_image("rt_hist_ttc_1000.png")
22 #hist(d[which(d<1000)], xlab="hours from creation to last reply", breaks=30)
23 #end_image()
24 #
25 #start_image("rt_hist_ttc_200.png")
26 #hist(d[which(d<200)], xlab="hours from creation to last reply", breaks=30)
27 #end_image()
28 #
29 #start_image("rt_hist_ttc_50.png")
30 #hist(d[which(d<50)], xlab="hours from creation to last reply", breaks=30)
31 #end_image()
32 #
33 #start_image("rt_hist_ttc_10.png")
34 #hist(d[which(d<10)], xlab="hours from creation to last reply", breaks=30)
35 #end_image()
36 #
37 #d2 <- (t2$lastreply - t2$start)
38 #h<-hist(log(d2), plot=F, breaks=50)
39 #lines(h$breaks[which(h$counts!=0)], h$counts[which(h$counts!=0)])
40
41
42 # this doesn't work as I would like.  I think the bins aren't as I expect
43 #h <- hist(d, plot=F, breaks=c(seq(0,max(d)+1, .1)))
44 #plot(h$counts, log="x", pch=20, col="blue",
45 #       main="Log-normal distribution",
46 #       xlab="Value", ylab="Frequency")
47
48 #plot(log(d2))
49 #plot(ecdf(d2))
50
51 d2<-(m2$lastreply-m2$start)
52 start_image("rt_monitor_ttc.png")
53 par(mfrow=c(2,1))
54 qqnorm(log(d2))
55 plot_rt_hist(m2)
56 end_image()
57
58 par(mfrow=c(1,1))
59 start_image("rt_monitor_trends.png")
60 hist(log(d2[which(d2>59026)]), breaks=60, xlab="LOG(time to last-reply)", main="Monitor Queue Traffic patterns")
61 end_image()
62
63 tstamp_78 <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))[1]
64 tstamp_89 <-unclass(as.POSIXct("2009-01-01", origin="1960-01-01"))[1]
65
66 m_7 <- m2[which( m2$start < tstamp_78 ),]
67 m_8 <- m2[which( m2$start >= tstamp_78 & m2$start < tstamp_89 ),]
68 m_9 <- m2[which( m2$start >= tstamp_89 ),]
69
70
71 par(mfrow=c(3,1))
72 plot_rt_hist(m_7)
73 plot_rt_hist(m_8)
74 plot_rt_hist(m_9)
75 par(mfrow=c(1,1))
76
77
78 tstamp <-unclass(as.POSIXct("2008-01-01", origin="1960-01-01"))
79 m_67 <- m2[which( m2$start <  tstamp[1] ),]
80 m_89 <- m2[which( m2$start >= tstamp[1] ),]
81
82
83 #par(mfrow=c(2,1))
84 #plot_rt_hist(t_67)
85 #plot_rt_hist(t_89)
86 par(mfrow=c(1,1))
87 par(mai=c(1,1,1,2))
88 par(mar=c(5,4,4,8))
89
90 s_list <- c('2006'=1112, '2007'=1591, '2008'=1019, '2009'=815)
91 m_list <- c('2006'=0,    '2007'=119,  '2008'=229,  '2009'=251)
92
93 start_image('rt_aggregate_traffic.png')
94 par(mfrow=c(1,1))
95 par(mai=c(1,1,1,1))
96 par(mar=c(5,4,4,4))
97
98 s_list <- c(1519, 1596, 1112, 1591, 1019, 815)
99 m_list <- c(0,0,0,    119,  229,  251)
100 x_online_node_list <- c(1,   2.5,  4, 5.5, 7, 8.5)
101 y_online_node_list <- c(330, 480,  500,    550,  575,  642)
102
103 y<- rbind(support=s_list, monitor=m_list)
104 barplot(y, space=0.5, width=1, ylim=c(0,2000), xlim=c(0,9),  
105         col=c('grey35', 'grey85'),
106         legend=F, ylab="Tickets with One or More Replies", xlab="Year", axes=F)
107 scale_by <- 1500 / 700
108 lines(x_online_node_list, y_online_node_list*scale_by)
109 points(x_online_node_list, y_online_node_list*scale_by, pch=c(22))
110 ticks<-c(0, 100, 200, 300, 400, 500, 600, 700)
111
112 axis(1, labels=c('2004', '2005', '2006', '2007', '2008', '2009'), at=x_online_node_list)
113 axis(2, las=1)
114 axis(4, las=1, labels=ticks, at=ticks*scale_by)
115
116 mtext("Online Node Count", 4, line=3)
117 legend(6.5, 2000, 
118         cex=0.7,
119         legend=c("Online Node Count", "MyOps Tickets", "Support Tickets"), 
120          fill=c(0, 'grey85', 'grey40'),
121         lty=c(1,0,0), merge=T)
122 end_image()
123
124 start_image('rt_tickets_per_machine.png')
125 t_list <- s_list + m_list
126 plot(x_online_node_list, t_list / y_online_node_list, ylim=c(0,5), space=0.5, width=1, legend=F, ylab="Tickets per Online Node", xlab="Year", xlim=c(0,9), axes=F, type='l')
127 points(x_online_node_list, t_list / y_online_node_list, ylim=c(0,5), xlim=c(0,9), pch=c(23))
128 axis(1, labels=c('2004', '2005', '2006', '2007', '2008', '2009'), at=x_online_node_list)
129 axis(2)
130 legend(5.5, 1, 
131         cex=0.7,
132         legend=c("Tickets per Online Node"), 
133         pch=c(23),
134         #fill=c('grey85'),
135         lty=c(1), merge=T)
136
137 end_image()
138
139
140 start_image("rt_monitor_seasonal.png")
141 par(mfrow=c(3,1))
142 par(mai=c(.3,.3,.3,.3))
143 year_hist(m_7, "2007", "2006/12/31", "2008/1/7", 60)
144 year_hist(m_8, "2008", "2007/12/30", "2009/1/7", 60)
145 year_hist(m_9, "2009", "2008/12/28", "2010/1/30", 60)
146 end_image()
147
148 par(mfrow=c(1,1))