Commit d49d2dbb by 陈森彬

切换elk

parent 4b6a85a0
Showing with 20 additions and 20 deletions
...@@ -5,12 +5,12 @@ from datetime import datetime, timedelta ...@@ -5,12 +5,12 @@ from datetime import datetime, timedelta
from elasticsearch import Elasticsearch from elasticsearch import Elasticsearch
ichunt_elk = Elasticsearch(host="127.0.0.1", port=9200, timeout=20) ichunt_elk = Elasticsearch(host="172.18.137.50", port=9200, timeout=20)
task_mapping = { task_mapping = {
'arg': 'arrow sku更新', 'arg': 'arrow sku更新',
'arc': 'arrow新品采集', 'arc': 'arrow新品采集',
'ang': 'avnet sku更新', # 'ang': 'avnet sku更新',
'anc': 'avnet新品采集', # 'anc': 'avnet新品采集',
'alg': 'allied sku更新', 'alg': 'allied sku更新',
'alc': 'allied新品采集', 'alc': 'allied新品采集',
'rog': 'rochester sku更新', 'rog': 'rochester sku更新',
...@@ -19,18 +19,18 @@ task_mapping = { ...@@ -19,18 +19,18 @@ task_mapping = {
'mug': 'mouser sku更新', 'mug': 'mouser sku更新',
'dggw': 'digikey sku更新', 'dggw': 'digikey sku更新',
'dgc': 'digikey新品采集', 'dgc': 'digikey新品采集',
'r24g': 'rutronik sku更新', # 'r24g': 'rutronik sku更新',
'r24c': 'rutronik新品采集', # 'r24c': 'rutronik新品采集',
'skw': '搜索关键词sku更新', # 'skw': '搜索关键词sku更新',
'pc': '平台比价', # 'pc': '平台比价',
'spu': 'spu税率采集', # 'spu': 'spu税率采集',
'bkc': 'buerklin新品采集', # 'bkc': 'buerklin新品采集',
'bkg': 'buerklin sku更新', # 'bkg': 'buerklin sku更新',
'bkgn': 'buerklin sku更新', # 'bkgn': 'buerklin sku更新',
'msg': 'master sku更新', 'msg': 'master sku更新',
'csg': 'chip1stop sku更新', 'csg': 'chip1stop sku更新',
'elgw': 'element14 sku更新', # 'elgw': 'element14 sku更新',
'elc': 'element14 新品更新', # 'elc': 'element14 新品更新',
'poc': 'powell 新品采集', 'poc': 'powell 新品采集',
'pog': 'powell sku更新', 'pog': 'powell sku更新',
"mcc": 'microchip 新品采集', "mcc": 'microchip 新品采集',
...@@ -41,18 +41,18 @@ task_mapping = { ...@@ -41,18 +41,18 @@ task_mapping = {
"tig": "TI sku更新", "tig": "TI sku更新",
"mxc": 'maxim 新品采集', "mxc": 'maxim 新品采集',
'mxg': 'maxim sku更新', 'mxg': 'maxim sku更新',
'ikkw': 'ickey 自营采集', # 'ikkw': 'ickey 自营采集',
'ikid': 'ickey 指数采集', # 'ikid': 'ickey 指数采集',
'mkg': 'marki sku更新', 'mkg': 'marki sku更新',
'cfc': 'corestaff 新品采集', # 'cfc': 'corestaff 新品采集',
'cfg': 'corestaff sku更新', 'cfg': 'corestaff sku更新',
"lcg": '深圳立创 sku更新', "lcg": '深圳立创 sku更新',
"lcc": "深圳立创 新品采集", "lcc": "深圳立创 新品采集",
"icnud": 'ic交易网 更新', # "icnud": 'ic交易网 更新',
"apc": 'aipco 新品更新', "apc": 'aipco 新品更新',
"apg": 'aipco sku更新', "apg": 'aipco sku更新',
"fuc": 'future 新品更新', # "fuc": 'future 新品更新',
"fug": 'future sku更新', # "fug": 'future sku更新',
"tmeg": 'tme sku更新', "tmeg": 'tme sku更新',
"oyg": '唯样 sku更新', "oyg": '唯样 sku更新',
"wpgg": 'wpg sku更新' "wpgg": 'wpg sku更新'
...@@ -84,7 +84,7 @@ def gen_msg(time_range, buckets): ...@@ -84,7 +84,7 @@ def gen_msg(time_range, buckets):
def get_task_error_rate(time_range=30, error_rate=30): def get_task_error_rate(time_range=30, error_rate=30):
utc_since = datetime.utcnow() - timedelta(minutes=time_range) utc_since = datetime.utcnow() - timedelta(minutes=time_range)
# date_now = datetime.now() - timedelta(minutes=time_range) # date_now = datetime.now() - timedelta(minutes=time_range)
index = 'logstash-' + utc_since.strftime('%Y.%m.%d') index = 'spider_logs-' + utc_since.strftime('%Y.%m.%d')
query = { query = {
"size": 0, "size": 0,
"query": { "query": {
......
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 sign in to comment