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

"
echo -n "";
if [ -f ${RAMDISK}/PG.conf ]; then
        . ${RAMDISK}/PG.conf
        PGPATH="${RAMDISK}"
else
        . /etc/PG.conf
fi
FLOWEYE=${PGPATH}/bin/floweye
firstelem=1
printf "["
${FLOWEYE} if list showsum=1 | while read name mode zone state driver mac type inbps outbps inpps outpps bdgname ifspeed theothers
do
	if [ "${state}" = "up" ]; then
		state=1
	else
		state=0
	fi
	if [ ${firstelem} -eq 1 ]; then
		printf "{'name':'${name}','state':${state},'inbps':'${inbps}','outbps':'${outbps}','inpps':'${inpps}','outpps':'${outpps}'}"
		firstelem=0
	else
		printf ",{'name':'${name}','state':${state},'inbps':'${inbps}','outbps':'${outbps}','inpps':'${inpps}','outpps':'${outpps}'}"
	fi
done
echo "]"

echo -n "
";