如下所示:
#!/usr/bin/python
#coding:utf-8
import MySQLdb
import time,datetime
#zabbix数据库信息:
zdbhost = '172.16.8.200'
zdbuser = 'zabbix'
zdbpass = 'zabbix'
zdbport = 3306
zdbname = 'zabbix'
#生成文件名称:
xlsfilename = 'zabbix.xls'
#需要查询的key列表 [名称,表名,key值,取值,格式化,数据整除处理]
keys = [
['CPU核心数','trends_uint','sy