Commit c86808b8 by zhangwei

修改zabbix用户无法导入数据库模块的问题

parent 2b5bb08a
......@@ -31,6 +31,7 @@ def action(failure_count):
#cms_post.post(ali_uid, metric_name, failure_count, unit, fields)
if __name__ == '__main__':
count = 0
dbname="summer_hill"
# timestamp 起始时间戳,定义为当前一小时内,3600秒。
timestamp=times.currsecs()-3600
......@@ -55,6 +56,6 @@ order by
if len(rs)>0:
for line in rs:
#print("[sum]:%s,[user_id]:%s,[truename]:%s") % (line[0], line[1], line[2])
print(line[0])
else:
print(0)
\ No newline at end of file
if line[0] > 1:
count = count + 1
print(count)
\ No newline at end of file
......@@ -46,4 +46,4 @@ def main():
action()
if __name__ == '__main__':
sys.exit(action(sys.argv[1]))
sys.exit(action(sys.argv[1]))
\ No newline at end of file
......@@ -51,7 +51,6 @@ def action():
project_name = "user.shenlan"
elif opts.type == 'videocs': # 视频-深蓝学城
project_name = "video-center.shenlan"
check_log(project_name)
def main():
......@@ -70,4 +69,4 @@ def main():
if __name__ == '__main__':
sys.exit(main())
sys.exit(main())
\ No newline at end of file
......@@ -4,5 +4,5 @@
"unit": "Seconds",
"dimensions": "log_active=project-log-active",
"log_dir": "/usr/local/nginx/logs",
"log_exten": ".access.log"
}
"log_exten": "shenlan.access.log"
}
\ No newline at end of file
import MySQLdb
import os
import times
import sys
#zabbix用户import MySQLdb
try:
import MySQLdb
except:
os.environ["PYTHON_EGG_CACHE"] = "/tmp/.python-eggs"
import MySQLdb
'''
host = "192.168.2.26"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment