This repository has been archived by the owner on Apr 4, 2022. It is now read-only.
forked from etsy/opsweekly
-
Notifications
You must be signed in to change notification settings - Fork 1
/
year_report.php
206 lines (170 loc) · 7.9 KB
/
year_report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<div class="row">
<div class="span12">
<h2>Overall stats <small> for last year </small></h2>
<p class='lead'><?php echo $year_total_notifications; ?> notifications received this year
over <?php echo $num_weeks; ?> weeks of data (average of <?php echo $week_avg; ?> per week)</p>
<h3>Alert Status Distribution</h3>
<p>Breakdown of the type of notifications received during the last year</p>
<?php echo renderStatusProgressBar($year_status_agg, $year_status_agg_total); ?>
<br />
<h3>Tag Status Summary</h3>
<p>Breakdown of the tags applied to the notifications received during the last year</p>
<?php echo renderTagTable($year_tag_agg, $year_tag_agg_total, $nagios_alert_tags) ?>
<p>Breakdown of the tags applied (normalised)</p>
<?php echo renderTagTable($year_tag_agg_normalised, $year_tag_agg_total, $nagios_tag_categories) ?>
<br />
<?php
if ( ($year_sleep_status_agg[1] > 0) || ($year_sleep_status_agg[0] > 0) ) { ?>
<h3>Sleep State Summary</h3>
<p>Breakdown of sleep states people were in during notifications this year</p>
<?php
echo renderSleepStatus($year_sleep_status_agg, $year_status_agg_total, $year_mtts_total, $year_rtts_count, $year_ntts_count);
}
?>
<br />
<h3>Top Notifying Hosts</h3>
<p>Hosts that received the most notifications during this year</p>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Hostname</th><th>Count</th>
</tr>
</thead>
<tbody>
<?php
echo renderTopNTableBody($year_top_host_agg, 10, 'host');
?>
</tbody>
</table>
<?php if (count($year_top_waking_host) > 1) { ?>
<p>The top 5 hosts that woke people up were:
<?php echo renderTopNPrettyLine($year_top_waking_host) ?>
</p>
<?php } ?>
<h3>Top Notifying Services</h3>
<p>Services that received the most notifications during this year</p>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Service</th><th>Count</th>
</tr>
</thead>
<tbody>
<?php
echo renderTopNTableBody($year_top_service_agg, 10, 'service');
?>
</tbody>
</table>
<?php if (count($year_top_waking_service) > 1) { ?>
<p>The top 5 services that woke people up were:
<?php echo renderTopNPrettyLine($year_top_waking_service) ?>
</p>
<?php } ?>
<h3>Notification Time Map</h3>
<p>This illustrates alerts received over the last year, in a heat map fashion. Hovering over the times
gives you more detail about the number of alerts received. </p>
<div id="cal-heatmap-year"></div>
<script type="text/javascript">
var year_time_data = <?php echo json_encode($year_time_counts) ?>;
var year_cal = new CalHeatMap();
year_cal.init({
data: year_time_data,
domain : "month",
start: new Date(<?php echo date("U", strtotime("-1 year")) ?>*1000),
subDomain : "day",
id: "cal-heatmap-year",
range : 13,
itemName: ["notification", "notifications"],
domainGutter: 2
});
</script>
<br />
<h3>Average Alert Volume per Day</h3>
<p>What is the busiest day, alert volume wise? This is the average number of alerts received per day. </p>
<div id="per_day_volume"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($per_day_graph_data) ?>);
var options = {
hAxis: { title: 'Day of Week', gridlines: { count: 10 } },
vAxis: { title: 'Number of alerts' }
};
var chart = new google.visualization.ColumnChart(document.getElementById('per_day_volume'));
chart.draw(data, options);
</script>
<h3>Alert Types Over Time</h3>
<p>The number of the difference type of alerts received over the last year</p>
<div id="alert_types_chart"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($status_graph_data) ?>);
var options = {
colors: ['#b94a48', '#f89406', '#333333', '#3a87ad'],
hAxis: { title: 'Week Commencing' },
vAxis: { title: 'Number of notifications' }
};
var chart = new google.visualization.LineChart(document.getElementById('alert_types_chart'));
chart.draw(data, options);
</script>
<h3>Tag Summary Over Time</h3>
<p>These graphs show your 'alert hygeine' over the past year. Hopefully, both the quantity and the
percentage of 'No Action Taken' alerts decrease over time. </p>
<div id="alert_tags_chart"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($tag_graph_data) ?>);
var options = {
hAxis: { title: 'Week Commencing' },
vAxis: { title: 'Number of notifications' }
};
var chart = new google.visualization.LineChart(document.getElementById('alert_tags_chart'));
chart.draw(data, options);
</script>
<div id="alert_tags_pct_chart"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($tag_pct_graph_data) ?>);
var options = {
hAxis: { title: 'Week Commencing' },
vAxis: { title: 'Percent of Notifications', format: '#%' },
isStacked: true,
};
var formatter = new google.visualization.NumberFormat({pattern: '0.00%'});
formatter.format(data, 1);
formatter.format(data, 2);
var chart = new google.visualization.AreaChart(document.getElementById('alert_tags_pct_chart'));
chart.draw(data, options);
</script>
<h3>Average Tag Summary per Person</h3>
<p>Breakdown of the average number of alerts received by each person whilst on call</p>
<div id="user_tags_chart"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($user_graph_data) ?>);
var options = {
hAxis: { title: 'Number of alerts by tag type', gridlines: { count: 10 } },
vAxis: { title: 'Person' },
isStacked: true,
};
var chart = new google.visualization.BarChart(document.getElementById('user_tags_chart'));
chart.draw(data, options);
</script>
<h3>Weekly Tag Summary per Person</h3>
<p>Breakdown of the tag type used per person for the last on call periods</p>
<div id="weekly_user_tags_chart"></div>
<br />
<script type="text/javascript">
var data = google.visualization.arrayToDataTable(<?php echo json_encode($user_tag_graph_data) ?>);
var options = {
hAxis: { title: 'Number of alerts by tag type', gridlines: { count: 10 } },
vAxis: { title: 'Person/Week Commencing', textStyle: { fontSize: '12' } },
isStacked: true,
chartArea: {left: 200 },
height: 800,
legend: { position: 'bottom' }
};
var chart = new google.visualization.BarChart(document.getElementById('weekly_user_tags_chart'));
chart.draw(data, options);
</script>
</div>
</div>