forked from fnordpojk/merlin-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlivestatus.php
99 lines (87 loc) · 3.57 KB
/
livestatus.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
<?php
# The nagios-dashboard was written by Morten Bekkelund & Jonas G. Drange in 2010
#
# Patched, modified and added to by various people, see README
# Maintained as merlin-dashboard by Mattias Bergsten <[email protected]>
#
# Parts copyright (C) 2010 Morten Bekkelund & Jonas G. Drange
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See: http://www.gnu.org/copyleft/gpl.html
$refreshvalue = 10; //value in seconds to refresh page
$pagetitle = "Jottacloud Monitoring Dashboard";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link type="image/ico" rel="icon" href="op5.ico" />
<title><?php echo($pagetitle); ?></title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<link rel="stylesheet" type="text/css" href="nagios.css" />
</head>
<body>
<script type="text/javascript">
var placeHolder,
refreshValue = <?php print $refreshvalue; ?>;
$().ready(function(){
placeHolder = $("#nagios_placeholder");
updateNagiosData(placeHolder);
window.setInterval(updateCountDown, 1000);
});
// timestamp stuff
function createTimeStamp() {
// create timestamp
var ts = new Date();
ts = ts.toTimeString();
ts = ts.replace(/\s+GMT.+/ig, "");
// ts = ts.replace(/\:\d+(?=$)/ig, "");
$("#timestamp_wrap").empty().append("<div class=\"timestamp_drop\"></div><div class=\"timestamp_stamp\">" + ts +"</div>");
}
function updateNagiosData(block){
$("#loading").fadeIn(200);
block.load("./merlin2.php", function(response){
$(this).html(response);
$("#loading").fadeOut(200);
createTimeStamp();
});
}
function updateCountDown(){
var countdown = $("#refreshing_countdown");
var remaining = parseInt(countdown.text());
if(remaining == 1){
updateNagiosData(placeHolder);
countdown.text(remaining - 1);
}
else if(remaining == 0){
countdown.text(refreshValue);
}
else {
countdown.text(remaining - 1);
}
}
</script>
<div id="nagios_placeholder"></div>
<div class="nagios_statusbar">
<div class="nagios_statusbar_logo">
<p id="logo_holder"><span id="logo"></span></p>
</div>
<div class="nagios_statusbar_item">
<div id="timestamp_wrap"></div>
</div>
<div class="nagios_statusbar_item">
<div id="loading"></div>
<p id="refreshing">Refresh in <span id="refreshing_countdown"><?php print $refreshvalue; ?></span> seconds</p>
</div>
</div>
</body>
</html>