-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathnagios.php
executable file
·261 lines (232 loc) · 8.31 KB
/
nagios.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?php
# The nagios-dashboard was written by Morten Bekkelund & Jonas G. Drange in 2010
#
# 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 = "Operations Nagios Dashboard";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title><? echo($pagetitle); ?></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
body {
font-family: sans-serif;
line-height: 1.4em;
overflow-x: hidden;
background: #404040;
padding: .5em 1em;
}
table {
border-collapse: collapse;
width: 100%;
}
td {
padding: .1em 1em;
}
h1 {
display: inline-block;
margin-left: 10px;
}
h2 {
margin: 0 0 .2em 0;
color: white;
text-shadow: 1px 1px 0 #000;
font-size: 1em;
}
.clear {
clear: both;
}
.head {
}
.head th {
}
.dash {
}
.dash_wrapper {
background: white;
padding: 1em;
-moz-border-radius: .5em;
}
.dash_unhandled {
width: 60%;
float: left;
}
.dash_unhandled .dash_wrapper {
margin-right: 1em;
margin-bottom: 1em;
}
.dash_tactical_overview {
width: 40%;
float: left;
}
.dash_unhandled_service_problems {
clear: both;
margin-top: 0em;
}
.dash_table_head {
background: -moz-linear-gradient(top center, #d3d3d3, #bdbdbd);
color: #181818;
text-shadow: 1px 1px 0 #ededed;
}
.dash_table_head th {
padding: .2em 1em;
border-bottom: 1px solid #757575;
border-right: 2px groove #aaa;
}
.dash_table_head th:first-child {
border-left: none;
}
.dash_table_head th:last-child {
border-right: none;
}
.critical {
background: -moz-linear-gradient(top center, #af1000 50%, #990000 50%);
color: white;
text-shadow: 1px 1px 0 #5f0000;
}
.critical td {
border-right: 1px solid #6f0000;
border-bottom: 1px solid #6f0000;
}
.ok {
background: -moz-linear-gradient(top center, #00b400 50%, #018f00 50%);
color: white;
text-shadow: 1px 1px 0 #015f00;
}
.warning {
background: -moz-linear-gradient(top center, yellow 50%, #edef00 50%);
color: black;
text-shadow: -1px -1px 0 #feff5f;
}
.critical td,
.ok td,
.warning td {
}
.warning td{
border-bottom: 1px solid #bdbf00;
border-right: 1px solid #bdbf00;
}
.ok td{
border-bottom: 1px solid #016f00;
border-right: 1px solid #016f00;
}
.date {
white-space: nowrap;
}
.statusinfo {
font-size: 14px !important;
}
.nagios_statusbar {
background: -moz-linear-gradient(top center, #6a6a6a, #464646);
position: fixed;
bottom: 0;
width: 100%;
margin: 0 0 0 -1em;
height: 40px;
text-align: right;
border-top: 1px solid #818181;
opacity: .9;
}
.nagios_statusbar_item {
border-left: 2px groove #000;
height: 40px;
line-height: 40px;
padding: 0 1em;
color: white;
text-shadow: 1px 1px 0 black;
position: relative;
float: right;
}
#nagios_placeholder {
}
#loading {
background: transparent url(throbber.gif) no-repeat center center;
width: 24px;
height: 40px;
position: absolute;
}
#refreshing {
padding-left: 35px;
}
#refreshing_countdown {
}
#timestamp_wrap {
cursor: default;
font-size: 2em;
}
.timestamp_stamp {
}
</style>
</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("./merlin.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_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>