-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ajax.php
49 lines (46 loc) · 1.16 KB
/
Ajax.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
<?php
$action=$_GET['action'];
include "include/conn.php";
switch ($action)
{
case 'getgraph':
include "graphs.php";
$starttime=$_GET['starttime'];
$endtime=$_GET['endtime'];
$code=$_GET['code'];
$sql="select host_name,alias,address from tbl_host where host_name='".$code."'";
$result=$db->get_row($sql);
if ($result->host_name=="")
{
print "<div>没有找到相关的DRL店</div>";
exit();
}
if ($starttime==""){
$starttime='-4h';
}
if ($endtime=="")
{
$endtime='-10';
}
$rrd=new TrafficAction();
echo "<div></br></div>";
echo '<table width="100%">';
for ($x=1; $x<=10; $x++) {
$jpgfile="./graphs/".$code."_".$result->address."_".$x.$starttime.".png";
$filename="/usr/local/mrtg-2/rrd/".$code."/".$result->address."_".$x.".rrd";
if(!is_file($filename)){
continue;
}
$rrd->create_traffic_graph($jpgfile,$starttime,$endtime,$result->alias."-Interface".$x,$filename);
echo '<tr> <td width="50%" align="center">';
echo '<img src="'.$jpgfile.'" alt="'.$result->alias.'" />';
echo '</td></tr><tr><td></br></td></tr>';
}
echo '</table>';
break;
case '':
break;
default:
print "参数错误";
}
?>