Commit a2daae2d by feilong

init

parent da005429
...@@ -48,7 +48,6 @@ Get_current_value(){ ...@@ -48,7 +48,6 @@ Get_current_value(){
esac esac
} }
Push_n9e(){ Push_n9e(){
for metric_array in ${metric_arrays[@]};do for metric_array in ${metric_arrays[@]};do
{ {
for pre_metric in $(eval echo \${$metric_array[@]});do for pre_metric in $(eval echo \${$metric_array[@]});do
......
...@@ -7,10 +7,7 @@ items: ...@@ -7,10 +7,7 @@ items:
""" """
import os import os
import sys import sys
import urllib2
import base64
import json import json
import re
import time import time
import yaml import yaml
import commands import commands
......
...@@ -45,6 +45,7 @@ if __name__ == "__main__": ...@@ -45,6 +45,7 @@ if __name__ == "__main__":
sys.stderr.write('cannot get local ip') sys.stderr.write('cannot get local ip')
sys.exit(0) sys.exit(0)
core_total = int(os.popen("cat /proc/cpuinfo | grep processor | tail -1 | cut -d' ' -f2").read().strip()) + 1 core_total = int(os.popen("cat /proc/cpuinfo | grep processor | tail -1 | cut -d' ' -f2").read().strip()) + 1
# 核数太多采集单核指标意义不大
if core_total <= 8: if core_total <= 8:
print(json.dumps(get_cpu_core_stat(core_total))) print(json.dumps(get_cpu_core_stat(core_total)))
else: else:
......
...@@ -609,7 +609,8 @@ def check(target=False): ...@@ -609,7 +609,8 @@ def check(target=False):
# pass # pass
if __name__ == "__main__": if __name__ == "__main__":
code, endpoint = commands.getstatusoutput("ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1") code, endpoint = commands.getstatusoutput(
"ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1")
if code != 0: if code != 0:
sys.stderr.write('cannot get local ip') sys.stderr.write('cannot get local ip')
sys.exit(0) sys.exit(0)
...@@ -625,7 +626,7 @@ if __name__ == "__main__": ...@@ -625,7 +626,7 @@ if __name__ == "__main__":
step = 600 step = 600
else: else:
step = int(options.step) step = int(options.step)
metric=None metric = None
if options.metric: if options.metric:
metric = options.metric metric = options.metric
if metric not in metrics: if metric not in metrics:
...@@ -636,7 +637,7 @@ if __name__ == "__main__": ...@@ -636,7 +637,7 @@ if __name__ == "__main__":
if options.push: if options.push:
addmsg('status', 2) addmsg('status', 2)
print(json.dumps(messages)) print(json.dumps(messages))
#push(messages) # push(messages)
else: else:
if options.debug: if options.debug:
print(json.dumps(messages, indent=2)) print(json.dumps(messages, indent=2))
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#-*- coding:utf8 -*- #-*- coding:utf8 -*-
import sys import sys
import os
import pymongo import pymongo
from pymongo import MongoClient from pymongo import MongoClient
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
# coding: utf-8 # coding: utf-8
import cx_Oracle import cx_Oracle
import inspect
import json
import re
class OracleTool(object): class OracleTool(object):
...@@ -486,7 +483,7 @@ if __name__ == "__main__": ...@@ -486,7 +483,7 @@ if __name__ == "__main__":
'dbname': 'orcl11g', 'dbname': 'orcl11g',
} }
odb = OracleTool(dbconfig) odb = OracleTool(dbconfig)
print odb.version() print(odb.version())
print odb.tablespace_temp('TEMP') print(odb.tablespace_temp('TEMP'))
print odb.show_tablespaces_temp() print(odb.show_tablespaces_temp())
odb.db_close() odb.db_close()
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