-
Notifications
You must be signed in to change notification settings - Fork 0
/
snver_tab.php
135 lines (109 loc) · 4.03 KB
/
snver_tab.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
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2021-2023 Petr Macek |
| |
| 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. |
+-------------------------------------------------------------------------+
| https://github.com/xmacan/ |
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
chdir('../../');
include_once('./include/auth.php');
include_once('./lib/snmp.php');
include_once('./plugins/snver/functions.php');
if (!isempty_request_var('find')) {
set_request_var('action','find');
unset_request_var('host_id');
}
set_default_action();
$selectedTheme = get_selected_theme();
switch (get_request_var('action')) {
case 'ajax_hosts':
$sql_where = '';
get_allowed_ajax_hosts(true, 'applyFilter', $sql_where);
break;
case 'find':
general_header();
display_snver_form();
snver_find();
bottom_footer();
break;
default:
general_header();
display_snver_form();
bottom_footer();
break;
}
function display_snver_form() {
global $config;
$snver_records = read_config_option('snver_records');
print get_md5_include_js($config['base_path'].'/plugins/snver/snver.js');
$host_where = '';
$host_id = get_filter_request_var('host_id');
html_start_box('<strong>SNVer</strong>', '100%', '', '3', 'center', '');
?>
<tr>
<td>
<form name="form_snver" action="snver_tab.php">
<table width="60%" cellpadding="0" cellspacing="0">
<tr class="navigate_form">
<td>
<?php print html_host_filter($host_id, 'applyFilter', $host_where);?>
</td>
<td>
Find in stored data <input type='text' class='ui-button ui-corner-all ui-widget' name='find' id='find' value='<?php print get_request_var('find');?>'>
<input type='submit' class='ui-button ui-corner-all ui-widget' value='<?php print __('Find');?>'>
</td>
<td>
<input type='button' class='ui-button ui-corner-all ui-widget' id='clear' value='<?php print __('Clear');?>' title='<?php print __esc('Clear Filters');?>'>
</td>
</tr>
</table>
</form>
</td>
<tr>
<?php
html_end_box();
if (in_array($host_id, snver_get_allowed_devices($_SESSION['sess_user_id'], true))) {
$actual_info = plugin_snver_get_info($host_id);
if ($actual_info) {
print $actual_info;
print '<br/><br/>';
$optional = plugin_snver_get_info_optional($host_id);
print $optional;
print '<br/><br/>';
}
if ($snver_records > 0) {
$history = plugin_snver_get_history($host_id);
$old = $actual_info;
if (cacti_sizeof($history)) {
foreach ($history as $key=>$value) {
if (strcmp ($value, $old) === 0) {
echo "$key - Stejna data<br/>\n";
} else {
echo "$key - Jina data<br/>\n";
echo $value;
}
$old = $value;
}
}
} else {
print 'History data store disabled';
}
}
}