|
10 | 10 |
|
11 | 11 | if ($_GET['f_id_config_dynamic_dashboard']) { |
12 | 12 |
|
13 | | - |
14 | | - $lib='SELECT |
15 | | - cddg.* |
16 | | - FROM |
| 13 | + |
| 14 | + $lib='SELECT |
| 15 | + cddg.* |
| 16 | + FROM |
17 | 17 | config_dynamic_dashboard cdd |
18 | 18 | LEFT JOIN config_dynamic_dashboard_group cddg |
19 | 19 | ON cdd.id_config_dynamic_dashboard=cddg.id_config_dynamic_dashboard |
|
26 | 26 | WHERE aug.id_auth_user=:s_id_user |
27 | 27 | AND cdd.id_config_dynamic_dashboard=:f_id_config_dynamic_dashboard |
28 | 28 | ORDER BY dash_ordering'; |
29 | | - |
| 29 | + |
30 | 30 | $connSQL=new DB(); |
31 | 31 | $connSQL->bind('s_id_user',$s_id_user); |
32 | 32 | $connSQL->bind('f_id_config_dynamic_dashboard',$f_id_config_dynamic_dashboard); |
33 | 33 | $cur_dashboard=$connSQL->row($lib); |
34 | | - |
| 34 | + |
35 | 35 | if ($cur_dashboard->id_auth_group) { |
36 | 36 | $lib='SELECT |
37 | 37 | cddc.* |
|
40 | 40 | WHERE |
41 | 41 | cddc.id_config_dynamic_dashboard=:f_id_config_dynamic_dashboard |
42 | 42 | ORDER BY dash_ordering'; |
43 | | - |
| 43 | + |
44 | 44 | $connSQL=new DB(); |
45 | 45 | $connSQL->bind('f_id_config_dynamic_dashboard',$f_id_config_dynamic_dashboard); |
46 | 46 | $all_content=$connSQL->query($lib); |
47 | 47 | $cpt_content=count($all_content); |
48 | | - |
49 | | - |
| 48 | + |
| 49 | + |
50 | 50 | for ($i=0; $i<$cpt_content; $i++) { |
51 | 51 | $cpt_p=0; |
52 | | - |
| 52 | + |
53 | 53 | $lib=' |
54 | | - SELECT |
55 | | - cs.id_config_server, |
| 54 | + SELECT |
| 55 | + cs.id_config_server, |
56 | 56 | cs.server_name, |
57 | 57 | COALESCE(cs.collectd_version,"'.COLLECTD_DEFAULT_VERSION.'") as collectd_version |
58 | 58 | FROM config_server cs |
59 | | - LEFT JOIN config_server_project csp |
| 59 | + LEFT JOIN config_server_project csp |
60 | 60 | ON cs.id_config_server=csp.id_config_server |
61 | | - LEFT JOIN perm_project_group ppg |
| 61 | + LEFT JOIN perm_project_group ppg |
62 | 62 | ON ppg.id_config_project=csp.id_config_project |
63 | | - LEFT JOIN auth_group ag |
| 63 | + LEFT JOIN auth_group ag |
64 | 64 | ON ag.id_auth_group=ppg.id_auth_group |
65 | | - LEFT JOIN auth_user_group aug |
| 65 | + LEFT JOIN auth_user_group aug |
66 | 66 | ON aug.id_auth_group=ag.id_auth_group |
67 | 67 | WHERE aug.id_auth_user=:s_id_user |
68 | 68 | AND cs.server_name REGEXP :regex_srv |
|
73 | 73 | $connSQL->bind('s_id_user',$s_id_user); |
74 | 74 | $connSQL->bind('regex_srv',$all_content[$i]->regex_srv); |
75 | 75 | $all_server=$connSQL->query($lib); |
76 | | - $cpt_server=count($all_server); |
77 | | - |
| 76 | + $cpt_server=count($all_server); |
| 77 | + |
78 | 78 | if (isset($time_start) && isset($time_end)) { |
79 | 79 | $zoom='onclick="Show_Popup($(this).attr(\'src\').split(\'?\')[1],\'\',\''.$time_start.'\',\''.$time_end.'\')"'; |
80 | 80 | } else { |
|
84 | 84 | for ($j=0; $j<$cpt_server; $j++) { |
85 | 85 | $allDatadir=getAllDatadir(); |
86 | 86 | foreach($allDatadir as $key => $datadir){ |
87 | | - if(!is_dir($datadir.'/'.$all_server[$j]->server_name.'/')) unset($allDatadir[$key]); |
| 87 | + if(!is_dir($datadir.'/'.$all_server[$j]->server_name.'/')) unset($allDatadir[$key]); |
88 | 88 | } |
89 | 89 | if (!empty($allDatadir)) { |
90 | 90 | $myregex='#^(('.implode('|',$allDatadir).')/'.$all_server[$j]->server_name.'/)('.$all_content[$i]->regex_p_filter.')(?:\-('.$all_content[$i]->regex_pi_filter.'))?/('.$all_content[$i]->regex_t_filter.')(?:\-('.$all_content[$i]->regex_ti_filter.'))?\.rrd#'; |
|
94 | 94 | $tplugins = preg_find($myregex, $datadir.'/'.$all_server[$j]->server_name, PREG_FIND_RECURSIVE|PREG_FIND_FULLPATH|PREG_FIND_SORTBASENAME); |
95 | 95 | $plugins=array_merge($plugins, $tplugins); |
96 | 96 | } |
97 | | - |
| 97 | + |
98 | 98 | foreach ($plugins as $plugin) { |
99 | 99 | $plugin_array[$cpt_p]['servername']=$all_server[$j]->server_name; |
100 | 100 | $plugin_array[$cpt_p]['collectd_version']=$all_server[$j]->collectd_version; |
101 | 101 |
|
102 | 102 | preg_match($myregex, $plugin, $matches); |
103 | | - $plugin_datadir = getDatadirEntry($matches[1]); |
104 | | - |
| 103 | + $plugin_array[$cpt_p]['datadir'] = getDatadirEntry($matches[1]); |
| 104 | + |
105 | 105 | if (isset($matches[3])) { |
106 | 106 | $plugin_array[$cpt_p]['p']=$matches[3]; |
107 | 107 | } else { |
|
121 | 121 | } else { |
122 | 122 | $plugin_array[$cpt_p]['pc']=null; |
123 | 123 | $plugin_array[$cpt_p]['pi']=null; |
124 | | - } |
| 124 | + } |
125 | 125 | if (isset($matches[5])) { |
126 | 126 | $plugin_array[$cpt_p]['t']=$matches[5]; |
127 | 127 | } else { |
|
134 | 134 | $tmp=explode('-',$plugin_array[$cpt_p]['ti']); |
135 | 135 | $plugin_array[$cpt_p]['tc']=$tmp[0]; |
136 | 136 | $ti=null; |
137 | | - } |
| 137 | + } |
138 | 138 | } else { |
139 | 139 | $plugin_array[$cpt_p]['tc']=null; |
140 | 140 | $plugin_array[$cpt_p]['ti']=null; |
141 | 141 | } |
142 | | - |
| 142 | + |
143 | 143 | $cpt_p++; |
144 | 144 | } |
145 | 145 | } |
|
170 | 170 | $old_pi=null; |
171 | 171 | $old_p=null; |
172 | 172 | $old_servername=null; |
173 | | - |
| 173 | + |
174 | 174 | //$final_array=array_merge_recursive($plugin_array, $final_array); |
175 | 175 | foreach ($plugin_array as $plugin) { |
176 | 176 | if (! isset(${$plugin['servername'].$plugin['p'].$plugin['pc'].$plugin['pi'].$plugin['t'].$plugin['tc'].$plugin['ti']}) ) { |
177 | 177 | ${$plugin['servername'].$plugin['p'].$plugin['pc'].$plugin['pi'].$plugin['t'].$plugin['tc'].$plugin['ti']}=true; |
178 | | - |
| 178 | + |
179 | 179 | if ($all_content[$i]->rrd_ordering=='S') { |
180 | 180 | if ($old_servername!=$plugin['servername']) { |
181 | 181 | echo '<h1>'.$plugin['servername'].'</h1>'; |
|
234 | 234 | } |
235 | 235 |
|
236 | 236 | if ($CONFIG['no_break'] == true) { echo '<span style="white-space:nowrap">'; } |
237 | | - if (!preg_match('/^(df|interface|oracle|snmp)$/', $plugin['p']) || |
| 237 | + if (!preg_match('/^(df|interface|oracle|snmp)$/', $plugin['p']) || |
238 | 238 | (((preg_replace('/[^0-9\.]/','',$plugin['collectd_version']) >= 5) |
239 | 239 | && !preg_match('/^(oracle|snmp)$/', $plugin['p']) && $plugin['t']!='df')) |
240 | 240 | || ($plugin['p'] == 'snmp' && $plugin['t'] == 'memory') |
|
250 | 250 | $_GET['t'] = $plugin['t']; |
251 | 251 | $_GET['tc'] = $plugin['tc']; |
252 | 252 | $_GET['ti'] = $plugin['ti']; |
253 | | - |
| 253 | + |
254 | 254 | chdir(DIR_FSROOT); |
255 | 255 | include DIR_FSROOT.'/plugin/'.$plugin['p'].'.php'; |
256 | 256 | } else { |
257 | 257 | $graph_title=gen_title($plugin['servername'],$plugin['p'],$plugin['pc'],$plugin['pi'],$plugin['t'],$plugin['tc'],$plugin['ti']); |
258 | 258 | if (GRAPH_TITLE=='text') { echo '<figure><figcaption style="max-width:'.($CONFIG['width']+100).'px" title="'.$graph_title.'">'.$graph_title.'</figcaption>'; } |
259 | 259 | if ($time_range!=null) { |
260 | | - echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin_datadir.'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_range.'" />'."\n"; |
| 260 | + echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin['datadir'].'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_range.'" />'."\n"; |
261 | 261 | } else { |
262 | | - echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin_datadir.'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_start.'&e='.$time_end.'" />'."\n"; |
| 262 | + echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin['datadir'].'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_start.'&e='.$time_end.'" />'."\n"; |
263 | 263 | } |
264 | 264 | if(GRAPH_TITLE=='text') { echo '</figure>'; } |
265 | 265 | } |
|
273 | 273 | $_GET['t'] = $plugin['t']; |
274 | 274 | $_GET['tc'] = $plugin['tc']; |
275 | 275 | $_GET['ti'] = $plugin['ti']; |
276 | | - |
| 276 | + |
277 | 277 | chdir(DIR_FSROOT); |
278 | 278 | include DIR_FSROOT.'/plugin/'.$plugin['p'].'.php'; |
279 | 279 | } else { |
280 | 280 | $graph_title=gen_title($plugin['servername'],$plugin['p'],$plugin['pc'],$plugin['pi'],$plugin['t'],$plugin['tc'],$plugin['ti']); |
281 | 281 | if (GRAPH_TITLE=='text') { echo '<figure><figcaption style="max-width:'.($CONFIG['width']+100).'px" title="'.$graph_title.'">'.$graph_title.'</figcaption>'; } |
282 | 282 | if ($time_range!=null) { |
283 | | - echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin_datadir.'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_range.'" />'."\n"; |
| 283 | + echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin['datadir'].'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_range.'" />'."\n"; |
284 | 284 | } else { |
285 | | - echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin_datadir.'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_start.'&e='.$time_end.'" />'."\n"; |
| 285 | + echo '<img class="imggraph" '.$zoom.' title="'.CLICK_ZOOM.' : '.$graph_title.'" src="'.DIR_WEBROOT.'/graph.php?datadir='.$plugin['datadir'].'&h='.urlencode($plugin['servername']).'&p='.urlencode($plugin['p']).'&pc='.urlencode($plugin['pc']).'&pi='.urlencode($plugin['pi']).'&t='.urlencode($plugin['t']).'&tc='.urlencode($plugin['tc']).'&ti='.urlencode($plugin['ti']).'&s='.$time_start.'&e='.$time_end.'" />'."\n"; |
286 | 286 | } |
287 | 287 | if(GRAPH_TITLE=='text') { echo '</figure>'; } |
288 | 288 | } |
289 | 289 | } |
290 | 290 | if ($CONFIG['no_break'] == true) { echo '</span>'; } |
291 | | - |
| 291 | + |
292 | 292 | $old_t=$plugin['t']; |
293 | 293 | $old_tc=$plugin['tc']; |
294 | 294 | $old_ti=$plugin['ti']; |
|
0 commit comments