Commit e4ec1291 by feilong

init

parent 25432fc5
...@@ -13,7 +13,7 @@ ss_orphaned=$(echo $output | grep -Po "orphaned (\d+)" | awk '{print $2}') ...@@ -13,7 +13,7 @@ ss_orphaned=$(echo $output | grep -Po "orphaned (\d+)" | awk '{print $2}')
ss_synrecv=$(echo $output | grep -Po "synrecv (\d+)" | awk '{print $2}') ss_synrecv=$(echo $output | grep -Po "synrecv (\d+)" | awk '{print $2}')
ss_timewait=$(echo $output | grep -Po "timewait (\d+)" | awk '{print $2}') ss_timewait=$(echo $output | grep -Po "timewait (\d+)" | awk '{print $2}')
endpoint=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1) endpoint=$(ifconfig `route|grep '^default'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1)
step=$(basename $0|awk -F'_' '{print $1}') step=$(basename $0|awk -F'_' '{print $1}')
timestamp=$(date +%s) timestamp=$(date +%s)
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
PATH=$PATH:/usr/sbin:/sbin PATH=$PATH:/usr/sbin:/sbin
step=$(echo $0|grep -Po '\d+(?=_)') step=$(echo $0|grep -Po '\d+(?=_)')
endpoint=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1) endpoint=$(ifconfig `route|grep '^default'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1)
base_dir=$(cd $(dirname $0);pwd) base_dir=$(cd $(dirname $0);pwd)
cd $base_dir cd $base_dir
......
...@@ -8,7 +8,7 @@ mysqld_max_con=13684 ...@@ -8,7 +8,7 @@ mysqld_max_con=13684
user="monitor" user="monitor"
pass="3IPSkSxDpiPUtlF" pass="3IPSkSxDpiPUtlF"
host="127.0.0.1" host="127.0.0.1"
endpoint=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1) endpoint=$(ifconfig `route|grep '^default'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1)
Json_join(){ Json_join(){
metric=$1 metric=$1
......
...@@ -21,7 +21,7 @@ counter_metric_list = ["commits","dbseqread","indexffs","logfilesync","logprllwr ...@@ -21,7 +21,7 @@ counter_metric_list = ["commits","dbseqread","indexffs","logfilesync","logprllwr
conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'oracle_auth.conf') conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'oracle_auth.conf')
if not os.path.exists(conf_file): sys.exit(0) if not os.path.exists(conf_file): sys.exit(0)
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'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1")
if code != 0: sys.exit(0) if code != 0: sys.exit(0)
f = open(conf_file) f = open(conf_file)
y = yaml.load(f) y = yaml.load(f)
......
...@@ -19,7 +19,7 @@ rates = ('ack', 'deliver', 'deliver_get', 'publish') ...@@ -19,7 +19,7 @@ rates = ('ack', 'deliver', 'deliver_get', 'publish')
code, num = commands.getstatusoutput("grep 'beam.smp 15672' /home/n9e/service_port 2>/dev/null|grep -v grep|wc -l") code, num = commands.getstatusoutput("grep 'beam.smp 15672' /home/n9e/service_port 2>/dev/null|grep -v grep|wc -l")
if code != 0 or int(num) == 0: sys.exit(0) if code != 0 or int(num) == 0: sys.exit(0)
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'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1")
if code != 0: sys.exit(0) if code != 0: sys.exit(0)
timeout = 10 timeout = 10
p = [] p = []
......
...@@ -7,7 +7,7 @@ base_dir=$(cd $(dirname $0);pwd) ...@@ -7,7 +7,7 @@ base_dir=$(cd $(dirname $0);pwd)
cd $base_dir cd $base_dir
ip=127.0.0.1 ip=127.0.0.1
metrics_counter=(total_connections_received rejected_connections keyspace_hits keyspace_misses total_commands_processed total_net_input_bytes total_net_output_bytes expired_keys evicted_keys used_cpu_sys used_cpu_user) metrics_counter=(total_connections_received rejected_connections keyspace_hits keyspace_misses total_commands_processed total_net_input_bytes total_net_output_bytes expired_keys evicted_keys used_cpu_sys used_cpu_user)
endpoint=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1) endpoint=$(ifconfig `route|grep '^default'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1)
Json_join(){ Json_join(){
metric=$1 metric=$1
......
...@@ -3,7 +3,7 @@ step=$(echo $0|grep -Po '\d+(?=_)') ...@@ -3,7 +3,7 @@ step=$(echo $0|grep -Po '\d+(?=_)')
service_port=/home/n9e/service_port service_port=/home/n9e/service_port
base_dir=$(cd $(dirname $0);pwd) base_dir=$(cd $(dirname $0);pwd)
cd $base_dir cd $base_dir
endpoint=$(ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1) endpoint=$(ifconfig `route|grep '^default'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1)
Json_join(){ Json_join(){
metric=$1 metric=$1
......
...@@ -41,7 +41,7 @@ def get_cpu_core_stat(num): ...@@ -41,7 +41,7 @@ def get_cpu_core_stat(num):
return data return data
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'|head -n1|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)
......
...@@ -67,7 +67,7 @@ step = int(os.path.basename(__file__).split('_')[0]) ...@@ -67,7 +67,7 @@ step = int(os.path.basename(__file__).split('_')[0])
conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mongodb_auth.conf') conf_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'mongodb_auth.conf')
if not os.path.exists(conf_file): sys.exit(0) if not os.path.exists(conf_file): sys.exit(0)
from mongodb_server import mongodbMonitor from mongodb_server import mongodbMonitor
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'|head -n1|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1")
if code != 0: sys.exit(0) if code != 0: sys.exit(0)
f = open(conf_file) f = open(conf_file)
y = yaml.load(f) y = yaml.load(f)
......
...@@ -611,7 +611,7 @@ def check(target=False): ...@@ -611,7 +611,7 @@ def check(target=False):
if __name__ == "__main__": if __name__ == "__main__":
code, endpoint = commands.getstatusoutput( code, endpoint = commands.getstatusoutput(
"ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1") "ifconfig `route|grep '^default'|head -n1|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)
......
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