????????????????????????
???????????? ???????[ 2015/8/20 15:02:27 ] ??????????????????
?????????????????????????????????????????Щ????????????????????????????????rrdtool??????????????????????о???????echarts?????????????????????????????????????????????:
????1????????????????????γ????:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os??sys??json
import time
import sys
import pycurl
class Test:
def __init__(self):
self.contents = ''
def callback(self??buf):
self.contents = self.contents + buf
def test_gzip(input_url):
data = {}
t = Test()
c = pycurl.Curl()
c.setopt(pycurl.WRITEFUNCTION??t.callback)
c.setopt(pycurl.ENCODING?? 'gzip')
c.setopt(pycurl.URL??input_url)
c.perform()
NAMELOOKUPTIME = c.getinfo(c.NAMELOOKUP_TIME)
CONNECTTIME = c.getinfo(c.CONNECT_TIME)
PRETRANSFERTIME = c.getinfo(c.PRETRANSFER_TIME)
STARTTRANSFERTIME = c.getinfo(c.STARTTRANSFER_TIME)
TOTALTIME = c.getinfo(c.TOTAL_TIME)
HTTPCODE = c.getinfo(c.HTTP_CODE)
SIZEDOWNLOAD = c.getinfo(c.SIZE_DOWNLOAD)
HEADERSIZE = c.getinfo(c.HEADER_SIZE)
SPEEDDOWNLOAD=c.getinfo(c.SPEED_DOWNLOAD)
data["HTTPCODE"]= HTTPCODE
data["NAMELOOKUPTIME"]="%.2f"%(NAMELOOKUPTIME*1000)
data["CONNECTTIME"]="%.2f"%(CONNECTTIME*1000)
data["PRETRANSFERTIME"]="%.2f"%(PRETRANSFERTIME*1000)
data["STARTTRANSFERTIME"]="%.2f"%(STARTTRANSFERTIME*1000)
data["TOTALTIME"]="%.2f"%(TOTALTIME*1000)
data["SIZEDOWNLOAD"]="%d"%(SIZEDOWNLOAD)
data["HEADERSIZE"] ="%d"%(HEADERSIZE)
data["SPEEDDOWNLOAD"]="%d"%(SPEEDDOWNLOAD)
return data
if __name__ == '__main__':
input_url = sys.argv[1]
print test_gzip(input_url)
????2?????????????????????:
????def pycurl(request):
????cmd = "python %s/backend/pcurl.py www.shikee.com" %('/yizhan/oms/app01')
????data = os.popen(cmd).read()
????data=eval(data) #????????????????????????????????????eval????
????NAMELOOKUPTIME=float(data['NAMELOOKUPTIME'])
????CONNECTTIME=float(data['CONNECTTIME'])
????PRETRANSFERTIME=float(data['PRETRANSFERTIME'])
????STARTTRANSFERTIME=float(data['STARTTRANSFERTIME'])
????TOTALTIME=float(data['TOTALTIME'])
????SPEEDDOWNLOAD=float(data['SPEEDDOWNLOAD'])
????return render_to_response('pycurl.html'??{'NAMELOOKUPTIME':NAMELOOKUPTIME??'CONNECTTIME':CONNECTTIME??'PRETRANSFERTIME':PRETRANSFERTIME??'STARTTRANSFERTIME':STARTTRANSFERTIME??'TOTALTIME':TOTALTIME??'SPEEDDOWNLOAD':SPEEDDOWNLOAD})
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11