#!/bin/sh
#This script is created by ssparser automatically. The parser first created by MaoShouyan
printf "Content-type: text/html
Cache-Control: no-cache

"
echo -n ""; 
. ../common/common.sh 
cgipath="/cgi-bin/Monitor/ifview?ifname=${CGI_ifname}&title=${CGI_title}"
afm_load_page 30 "${cgipath}"

echo -n "
<script type=\"text/javascript\" src=\"/img/wz_jsgraphics.js\"></script>
<script type=\"text/javascript\" src=\"/img/pie.js\"></script>
<script type=\"text/javascript\" src=\"/img/common.js\"></script>
<script language=\"javascript\">
function popupurl(url, width, height)
{
	url += \"&ifname=\" + \"${CGI_ifname}\";
 	ShowWindow(url, \"scrollbars=1,resizable=0\", width, height);
}
</script>
<body>
<script type=\"text/javascript\" src=\"/img/wz_tooltip.js\"></script>
<span id=\"hlp3day\" style=\"display:none\">鿴ͼ</span>
<span id=\"hlpall\" style=\"display:none\">鿴һܡһµͼ</span>
"; 
cgi_show_title "${CGI_title}" 
TMPPATH=${PGPATH}/admin/tmp
iftcpudpbps=${TMPPATH}/iftcpudpbps_${CGI_ifname}.png
ifbps=${TMPPATH}/ifbps_${CGI_ifname}.png
iftcpudppps=${TMPPATH}/iftcpudppps_${CGI_ifname}.png
ifpps=${TMPPATH}/ifpps_${CGI_ifname}.png
comargs="width=800 height=300 hours=24"
errmsg=`${FLOWEYE} chart show ${comargs} outimg=${iftcpudpbps} tag=${CGI_ifname}.bpstcpin tag=${CGI_ifname}.bpstcpout tag=${CGI_ifname}.bpsudpin tag=${CGI_ifname}.bpsudpout`
errmsg=`${FLOWEYE} chart show ${comargs} outimg=${ifbps} tag=${CGI_ifname}.bpsin tag=${CGI_ifname}.bpsout`
errmsg=`${FLOWEYE} chart show ${comargs} outimg=${iftcpudppps} tag=${CGI_ifname}.ppstcpin tag=${CGI_ifname}.ppstcpout tag=${CGI_ifname}.ppsudpin tag=${CGI_ifname}.ppsudpout yname=packets/s`
errmsg=`${FLOWEYE} chart show ${comargs} outimg=${ifpps} tag=${CGI_ifname}.ppsin tag=${CGI_ifname}.ppsout yname=packets/s`
for nameval in `${FLOWEYE} if get ${CGI_ifname}`; do
	tag=`echo ${nameval} | cut -d'=' -f1`
	val=`echo ${nameval} | cut -d'=' -f2`
	case "${tag}" in
	"zone")
		if [ "${val}" = "inside" ]; then
			CGI_ifzone=""
		else
			CGI_ifzone=""
		fi
		;;
	"mode")
		if [ "${val}" = "0" ]; then
			CGI_ifmode="ģʽ"
		else
			CGI_ifmode="${val}"
		fi
		;;
	"link-state")
		if [ "${val}" = "up" ]; then
			CGI_status=""
		else
			CGI_status="ûнӵ"
		fi
		;;
	"driver")
		if [ "${val}" = "PANAOS" ]; then
			CGI_driver="ǿ"
		else
			CGI_driver="${val}"
		fi
		;;
	"bps-in")
		CGI_bpsin="${val}"
		;;
	"bps-tcp-in")
		CGI_bpstcpin="${val}"
		;;
	"bps-udp-in")
		CGI_bpsudpin="${val}"
		;;
	"bps-out")
		CGI_bpsout="${val}"
		;;
	"bps-tcp-out")
		CGI_bpstcpout="${val}"
		;;
	"bps-udp-out")
		CGI_bpsudpout="${val}"
		;;
	"macaddr")
		CGI_ifmac="${val}"
		;;
	"pps-in")
		CGI_ppsin="${val}"
		;;
	"pps-out")
		CGI_ppsout="${val}"
		;;
	"ifdesc")
		CGI_ifdesc="${val}"
		;;
	esac
done

echo -n "
<br>
<table style=\"width:800; font:bold 14px; color:#CE6C04\">
<tr><td align=left><b>ӿ${CGI_ifname}ҪϢ</b></td></tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
	<td width=130 align=center>Ӧģʽ</td>
	<td width=130 align=center>λ</td>
	<td width=130 align=center></td>
	<td width=130 align=center>MACַ</td>
	<td width=130 align=center>·״̬</td>
	<td width=* align=center>ͺ</td>
</tr> 
<tr id=row1 height=22>
	<td align=center>${CGI_ifmode}</td>
	<td align=center>${CGI_ifzone}</td>
	<td align=center>${CGI_driver}</td>
	<td align=center>${CGI_ifmac}</td>
	<td align=center>${CGI_status}</td>
	<td align=center>${CGI_ifdesc}</td>
</tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1>
<tr id=tblhdr height=22>
	<td width=263 align=center>(tcp/udp/total, bps)</td>
	<td width=263 align=center>(tcp/udp/total, bps)</td>
	<td width=* align=center>PPS(in/out/total)</td>
</tr>
<tr id=row1 height=22>
	<td align=right>${CGI_bpstcpin},&nbsp;${CGI_bpsudpin},&nbsp;${CGI_bpsin}</td>
	<td align=right>${CGI_bpstcpout},&nbsp;${CGI_bpsudpout},&nbsp;${CGI_bpsout}</td>
	<td align=right>${CGI_ppsin},&nbsp;${CGI_ppsout},&nbsp;`expr ${CGI_ppsin} + ${CGI_ppsout}`</td>
</tr>
</table>
<br>
<table style=\"width:800; font:bold 14px; color:#CE6C04\">
<tr>
	<td align=left><b>24Сʱͼ</b></td>
	<td align=right>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=all&time=3day', 680, 800)\"
	    onmouseover=\"TagToTip('hlp3day')\" onmouseout=\"UnTip()\">նԱ</a>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=all&time=mon', 680, 800)\"
	    onmouseover=\"TagToTip('hlpall')\" onmouseout=\"UnTip()\">ʷͼ</a>
	</td>
</tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1 bgcolor=\"#ffffff\">
<tr><td><img src=\"/tmp/ifbps_${CGI_ifname}.png\"></img></td></tr>
</table>
<br>
<table style=\"width:800; font:bold 14px; color:#CE6C04\">
<tr>
	<td align=left><b>24СʱTCP/UDPͼ</b></td>
	<td align=right>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=tcpudp&time=3day', 680, 800)\"
	    onmouseover=\"TagToTip('hlp3day')\" onmouseout=\"UnTip()\">նԱ</a>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=tcpudp&time=mon', 680, 800)\"
	    onmouseover=\"TagToTip('hlpall')\" onmouseout=\"UnTip()\">ʷͼ</a>
	</td>
</tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1 bgcolor=\"#ffffff\">
<tr><td><img src=\"/tmp/iftcpudpbps_${CGI_ifname}.png\"></img></td></tr>
</table>
<br>
<table style=\"width:800; font:bold 14px; color:#CE6C04\">
<tr>
	<td align=left><b>24СʱPPSͼ</b></td>
	<td align=right>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=pps&time=3day', 680, 800)\"
	    onmouseover=\"TagToTip('hlp3day')\" onmouseout=\"UnTip()\">նԱ</a>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=pps&time=mon', 680, 800)\"
	    onmouseover=\"TagToTip('hlpall')\" onmouseout=\"UnTip()\">ʷͼ</a>
	</td>
</tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1 bgcolor=\"#ffffff\">
<tr><td><img src=\"/tmp/ifpps_${CGI_ifname}.png\"></img></td></tr>
</table>
<br>
<table style=\"width:800; font:bold 14px; color:#CE6C04\">
<tr>
	<td align=left><b>24СʱTCP/UDP PPSͼ</b></td>
	<td align=right>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=tcpudppps&time=3day', 680, 800)\"
	    onmouseover=\"TagToTip('hlp3day')\" onmouseout=\"UnTip()\">նԱ</a>
	<a href=\"javascript:popupurl('/cgi-bin/Monitor/ifgraph?type=tcpudppps&time=mon', 680, 800)\"
	    onmouseover=\"TagToTip('hlpall')\" onmouseout=\"UnTip()\">ʷͼ</a>
	</td>
</tr>
</table>
<table width=800 border=0 cellspacing=1 cellpadding=1 bgcolor=\"#ffffff\">
<tr><td><img src=\"/tmp/iftcpudppps_${CGI_ifname}.png\"></img></td></tr>
</table>
</body>
</html>
";