-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathmonitor.php
More file actions
177 lines (146 loc) · 4.76 KB
/
monitor.php
File metadata and controls
177 lines (146 loc) · 4.76 KB
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
<?php
declare(strict_types = 1);
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2026 The Cacti Group |
| |
| 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 2 |
| 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. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
$guest_account = true;
chdir('../../');
include_once('./include/auth.php');
set_default_action();
// Record Start Time
$start = microtime(true);
$criticalities = [
0 => __('Disabled', 'monitor'),
1 => __('Low', 'monitor'),
2 => __('Medium', 'monitor'),
3 => __('High', 'monitor'),
4 => __('Mission Critical', 'monitor')
];
$iclasses = [
0 => 'deviceUnknown',
1 => 'deviceDown',
2 => 'deviceRecovering',
3 => 'deviceUp',
4 => 'deviceThreshold',
5 => 'deviceDownMuted',
6 => 'deviceUnmonitored',
7 => 'deviceWarning',
8 => 'deviceAlert',
9 => 'deviceThresholdMuted',
];
$icolorsdisplay = [
0 => __('Unknown', 'monitor'),
1 => __('Down', 'monitor'),
2 => __('Recovering', 'monitor'),
3 => __('Up', 'monitor'),
4 => __('Triggered', 'monitor'),
9 => __('Triggered (Muted/Acked)', 'monitor'),
5 => __('Down (Muted/Acked)', 'monitor'),
6 => __('No Availability Check', 'monitor'),
7 => __('Warning Ping', 'monitor'),
8 => __('Alert Ping', 'monitor'),
];
$classes = [
'monitor_exsmall' => __('Extra Small', 'monitor'),
'monitor_small' => __('Small', 'monitor'),
'monitor_medium' => __('Medium', 'monitor'),
'monitor_large' => __('Large', 'monitor'),
'monitor_exlarge' => __('Extra Large', 'monitor'),
'monitor_errorzoom' => __('Zoom', 'monitor')
];
$monitor_status = [
-2 => __('All Devices', 'monitor'),
-1 => __('All Monitored Devices', 'monitor'),
0 => __('Not Up', 'monitor'),
1 => __('Not Up or Triggered', 'monitor'),
2 => __('Not Up, Triggered or Breached', 'monitor'),
-4 => __('Devices without Thresholds', 'monitor'),
-3 => __('Devices not Monitored', 'monitor'),
];
$monitor_view_type = [
'default' => __('Default', 'monitor'),
'list' => __('List', 'monitor'),
'names' => __('Names only', 'monitor'),
'tiles' => __('Tiles', 'monitor'),
'tilesadt' => __('Tiles & Time', 'monitor')
];
$monitor_grouping = [
'default' => __('Default', 'monitor'),
'tree' => __('Tree', 'monitor'),
'site' => __('Site', 'monitor'),
'template' => __('Device Template', 'monitor')
];
$monitor_trim = [
0 => __('Default', 'monitor'),
-1 => __('Full', 'monitor'),
10 => __('10 Chars', 'monitor'),
20 => __('20 Chars', 'monitor'),
30 => __('30 Chars', 'monitor'),
40 => __('40 Chars', 'monitor'),
50 => __('50 Chars', 'monitor'),
75 => __('75 Chars', 'monitor'),
100 => __('100 Chars', 'monitor'),
];
global $thold_hosts, $maxchars;
$dozoomrefresh = false;
$dozoombgndcolor = false;
$maxchars = 12;
$_SESSION['names'] = 0;
if (!isset($_SESSION['monitor_muted_hosts'])) {
$_SESSION['monitor_muted_hosts'] = [];
}
include_once __DIR__ . '/db_functions.php';
include_once __DIR__ . '/monitor_render.php';
include_once __DIR__ . '/monitor_controller.php';
validateRequestVars();
$thold_hosts = checkTholds();
switch (get_nfilter_request_var('action')) {
case 'ajax_status':
ajaxStatus();
break;
case 'ajax_mute_all':
muteAllHosts();
drawPage();
break;
case 'ajax_unmute_all':
unmuteAllHosts();
drawPage();
break;
case 'dbchange':
loadDashboardSettings();
drawPage();
break;
case 'remove':
removeDashboard();
drawPage();
break;
case 'saveDb':
saveSettings();
drawPage();
break;
case 'save':
saveSettings();
break;
default:
drawPage();
}
exit;