sdfsdfsdfsdf
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sdfsdfsdfsdf相关的知识,希望对你有一定的参考价值。
#安装所需的依赖包 yum -y install net-snmp net-snmp-devel ntpdate libxml2 libxml2-devel net-snmp-devel curl curl-devel yum -y install mysql-devel yum -y install gcc yum -y install vim #安装ntpdate yum -y install ntpdate #同步服务器跟客户端的时间,避免日志出现时间错乱 ntpdate 1.cn.pool.ntp.org #配置编译,指定安装目录,编译server与agent ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
class ReportForm: def __init__(self): #打开数据库连接 self.conn = MySQLdb.connect(host=dbhost,user=dbuser,passwd=dbpasswd,db=dbname,port=dbport,charset=‘utf8‘) self.cursor = self.conn.cursor(cursorclass=MySQLdb.cursors.DictCursor) def getGraphID(self,HostName,GraphsName): #获取graphid sql = ‘select distinct graphs_items.graphid from items join graphs_items on graphs_items.itemid=items.itemid join graphs on graphs_items.graphid=graphs.graphid where items.hostid=(select hostid from hosts where host="%s") and graphs.name="%s"‘ % (HostName,GraphsName) if self.cursor.execute(sql): graphid = self.cursor.fetchone()[‘graphid‘] else: graphid = None return graphid def __del__(self): #关闭数据库连接 self.cursor.close() self.conn.close()
以上是关于sdfsdfsdfsdf的主要内容,如果未能解决你的问题,请参考以下文章