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
/
week_report.php
96 lines (83 loc) · 3.51 KB
/
week_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
<div class="row">
<div class="span12">
<h2>Week Stats <small> for week <?php echo $pretty_start; ?> - <?php echo $pretty_end; ?></small></h2>
<p class='lead'><?php echo $total_notifications; ?> notifications received this week </p>
<h3>Alert Status Distribution</h3>
<p>Breakdown of the type of notifications received during the week</p>
<?php echo renderStatusProgressBar($week_status_agg, $week_status_agg_total); ?>
<br />
<h3>Tag Status Summary</h3>
<p>Breakdown of the tags applied to the notifications received during the week</p>
<?php echo renderTagTable($week_tag_agg, $week_tag_agg_total, $nagios_alert_tags) ?>
<p>Breakdown of the tags applied (normalised)</p>
<?php echo renderTagTable($week_tag_agg_normalised, $week_tag_agg_total, $nagios_tag_categories) ?>
<br />
<?php
if ( ($week_sleep_status_agg[1] > 0) || ($week_sleep_status_agg[0] > 0) ) { ?>
<h3>Sleep State Summary</h3>
<p>Breakdown of sleep states person was in during notifications this week</p>
<?php
echo renderSleepStatus($week_sleep_status_agg, $week_status_agg_total, $week_mtts_total, $week_rtts_count, $week_ntts_count);
}
?>
<br />
<h3>Top Notifying Hosts</h3>
<p>Hosts that received the most notifications during this week</p>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Hostname</th><th>Count</th>
</tr>
</thead>
<tbody>
<?php
echo renderTopNTableBody($week_top_host_agg, 10, 'host');
?>
</tbody>
</table>
<h3>Top Notifying Services</h3>
<p>Services that received the most notifications during this week</p>
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Service</th><th>Count</th>
</tr>
</thead>
<tbody>
<?php
echo renderTopNTableBody($week_top_service_agg, 10, 'service');
?>
</tbody>
</table>
<h3>Alert Volume per Day</h3>
<p>Breakdown of the number of alerts received per day over the last week</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>Notification Time Map</h3>
<p>Grids read from top to bottom through hours, the darker the more alerts were received <small>(Hover over the blocks for a count)</small></p>
<div id="cal-heatmap"></div>
<script type="text/javascript">
var time_data = <?php echo json_encode($week_time_counts) ?>;
var cal = new CalHeatMap();
cal.init({
data: time_data,
domain : "day",
start: new Date(<?php echo date("U", $oncall_start) ?>*1000),
subDomain : "hour",
range : 8,
itemName: ["notification", "notifications"],
domainGutter: 4
});
</script>
<br />
</div>
</div>