[root@xx scripts]# ls
table.txt testslownum.py testslowtable.py
[root@xx scripts]# cat testslowtable.py
#!/usr/bin/python
# coding:utf-8
import subprocess
import json
file='/usr/local/zabbix/scripts/table.txt'
tables=[]
with open(file,'r') as f:
for i in f.readlines():
table = i.strip('\n')
tables.append({'{#TABLE_NAME}': table})
print json.dumps({'data': tables}, indent=4, separators=(',', ':'))
结合lepus库[root@ct1 scripts]# cat testslownum.py
#!/usr/bin/python
# coding:utf-8
import datetime,time
import sys
import MySQLdb
import sys
from ConfigParser import ConfigParser
conf = ConfigParser()
timenow = time.localtime()
datenow = time.strftim