{ "info": { "author": "JamesZOU", "author_email": "zouzhicheng@foxmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "Intended Audience :: Information Technology", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Networking", "Topic :: Utilities" ], "description": "# \u5173\u4e8eNatrix\n\nNatrix\u662f\u5f00\u6e90\u6df7\u5408\u4e91\u62e8\u6d4b\u7cfb\u7edf\n\n# \u5173\u4e8eNatrixclient\n\nnatrixclient\u662f\u914d\u5408Natrix\u7684\u529f\u80fd\uff0c\u5b89\u88c5\u5728\u7ec8\u7aef\u4e0a\u7684\u5ba2\u6237\u7aef\u8f6f\u4ef6\uff0c\u672c\u8f6f\u4ef6\u5177\u5907\u5982\u4e0b\u529f\u80fd\n\n- \u547d\u4ee4\u884c\u547d\u4ee4\uff0c\u7528\u4e8e\u5355\u673a\u8c03\u8bd5\n- API\u63a5\u53e3\uff0c\u4f5c\u4e3apip\u5e93\uff0c\u7528\u4e8e\u7b2c\u4e09\u65b9\u8c03\u7528\n- \u63a5\u5165Natrix\u7cfb\u7edf\uff0c\u63d0\u4f9b\u6570\u636e\uff0c \u73b0\u9636\u6bb5\u4e3b\u8981\u652f\u6301 RabbitMQ\n\n# \u5b89\u88c5\n\n## \u5fc5\u8981\u6761\u4ef6\n\n1. \u5fc5\u987b\u662froot\u7528\u6237\n2. \u76ee\u524d\u53ea\u652f\u6301 python >=2.7, >= 3.4\n\n## \u6d4b\u8bd5\u77e9\u9635\n\n| \u64cd\u4f5c\u7cfb\u7edf \\| \u786c\u4ef6 | \u6811\u8393\u6d3e2 | \u6811\u6885\u6d3e3B | X86-64 |\n| --------------- | ---- | ----- | ------ |\n| raspbian wheezy | Y | | |\n| raspbian jessie | | Y | |\n| raspbian strech | | Y | |\n| ubuntu 18 | | | Y |\n| centos 7 | | | Y |\n| windows 7 | | | |\n| windows 10 | | | |\n\n## \u66f4\u65b0\u7cfb\u7edf\n\n\u63a8\u8350\u66f4\u65b0\u7cfb\u7edf\u5230\u5f53\u524d\u6700\u65b0\u7248\u672c\n\n### debian\u7cfb\n\n```\nsudo apt-get update -y\nsudo apt-get upgrade -y\n```\n\n### rhel\u7cfb\n\n```\nyum update -y\n```\n\n## \u5b89\u88c5Python\n\n### debian\u7cfb\n\n#### Python2\n\n```\nsudo apt-get install python python-pip python-dev\n```\n\n#### Python3\n\n```\nsudo apt-get install python3 python3-pip python3-dev\n```\n\n### rhel\u7cfb\n\n#### Python2\n\n```\nsudo yum install python python-pip python-dev\n```\n\n#### Python3\n\n```\nsudo yum install python36 python36-pip python3-dev\n```\n\n### \u5347\u7ea7setuptools\n\n\u6709\u4e9bpython\u4e2d\u81ea\u5e26\u7684setuptools\u7248\u672c\u592a\u4f4e\uff0c\u5bfc\u81f4\u95ee\u9898\uff0c\u5efa\u8bae\u5347\u7ea7setuptools\n\n#### Python2\n\n```\npip install -U setuptools\n```\n\n#### Python3\n\n```\npip3 install -U setuptools\n```\n\n## \u5b89\u88c5\u5176\u4ed6\u8f6f\u4ef6\n\n\u7531\u4e8enatrixclient\u4f7f\u7528\u4e86pycurl\u7684\u5305\u7b49\uff0c\u6240\u4ee5\u4e5f\u9700\u8981\u5b89\u88c5\u4e00\u4e9b\u5176\u4ed6\u7684\u76f8\u5173\u8f6f\u4ef6\n\n### debian\u7cfb\n\n```\nsudo apt-get install libcurl4-openssl-dev libevent-dev libssl-dev\n```\n\n### rhel\u7cfb\n\n```\nsudo yum install gcc libffi-devel openssl-devel libcurl-devel libevent-devel\n```\n\n\n\n## \u5b89\u88c5Natrixclient\n\n### \u6ce8\u610f\n\n**\u5fc5\u987b\u4f7f\u7528root\u6743\u9650**\n\n### \u786e\u8ba4\u5b89\u88c5\u4f4d\u7f6e\n\n\u5b89\u88c5\u4e4b\u524d\uff0c\u8bf7\u786e\u8ba4\u597d\u672c\u673a\u7684python\u7248\u672c\uff0c\n\n### \u9ed8\u8ba4\u5b89\u88c5\n\n```\npip install natrixclient\n```\n\n### Python2\u5b89\u88c5\n\n```\npip install natrixclient\n```\n\n### Python 3\u5b89\u88c5\n\n```\npip3 install natrixclient\n```\n\n## \u521d\u59cb\u5316\n\n\u521d\u59cb\u5316\u4e3b\u8981\u5b8c\u6210\u5982\u4e0b\u4e8b\u9879\n\n- \u521b\u5efa\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55 /etc/natrix\n- \u62f7\u8d1d\u914d\u7f6e\u6587\u4ef6\u6a21\u7248\u548c\u811a\u672c\u5230\u914d\u7f6e\u6587\u4ef6\u76ee\u5f55\n- \u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u76ee\u5f55 /var/log/natrix\n- \u521b\u5efasystemctl\u670d\u52a1\n\n### \u9ed8\u8ba4\u521d\u59cb\u5316\n\n\u5b89\u88c5natrixclient\u4f7f\u7528**\u9ed8\u8ba4\u5b89\u88c5**\uff0c\u4f7f\u7528\u9ed8\u8ba4\u521d\u59cb\u5316\u5c31\u884c\u4e86\n\n```\nnatrix service init\n```\n\n### Python2\u521d\u59cb\u5316\n\n\u5b89\u88c5natrixclient\u4f7f\u7528**python2\u5b89\u88c5**\uff0c\u4f7f\u7528\u9ed8\u8ba4\u521d\u59cb\u5316\u5c31\u884c\u4e86\n\n```\nnatrix service init -p 2\n```\n\n### Python3\u521d\u59cb\u5316\n\n\u5b89\u88c5natrixclient\u4f7f\u7528**python3\u5b89\u88c5**\uff0c\u4f7f\u7528\u9ed8\u8ba4\u521d\u59cb\u5316\u5c31\u884c\u4e86\n\n```\nnatrix service init -p 3\n```\n\n## \u914d\u7f6e\u6587\u4ef6\u4fee\u6539\n\n\u6839\u636e\u81ea\u5df1\u516c\u53f8\u5b9e\u9645\uff0c\u4fee\u6539\u914d\u7f6e\u6587\u4ef6 /etc/natrix/natrix.ini\n\n### RabbitMQ\u914d\u7f6e\n\n\u914d\u7f6e\u5982\u4e0b\n\n```\n[RABBITMQ]\nhost = rabbitmq.natrix.com\nport = 5672\nusername = natrix\npassword = natrix\nvhost = /natrix\n```\n\n\u6839\u636e\u90e8\u7f72\u60c5\u51b5\u8fdb\u884c\u4fee\u6539\n\n### \u8bbf\u95ee\u914d\u7f6e\n\n\u4e3b\u8981\u662f\u8bbf\u95ee\u5916\u7f51, \u4f01\u4e1a\u5185\u7f51\uff0c\u5c40\u57df\u7f51\u4e09\u79cd\u60c5\u51b5\uff0c\u4f8b\u5982\n\n```\n[NETWORK]\ninternet_websites = [\"www.baidu.com.com\", \"www.alibaba.com\", \"www.qq.com\"]\ncorporate_websites = [\"test1.natrix.com\", \"test2.natrix.com\"]\nintranet_ips = [\"192.168.31.166\", \"192.168.31.188\"]\n```\n\ninternet_websites \u68c0\u6d4b\u7ec8\u7aef\u662f\u5426\u80fd\u591f\u8bbf\u95ee\u4e92\u8054\u7f51\uff0c\u7b80\u6613\u8f93\u5165\u51e0\u4e2a\u5178\u578b\u7684\u4e92\u8054\u7f51\u7f51\u5740\n\ncorporate_websites \u68c0\u6d4b\u7ec8\u7aef\u662f\u5426\u80fd\u591f\u8bbf\u95ee\u4f01\u4e1a\u7f51\uff0c\u7b80\u6613\u8f93\u5165\u51e0\u4e2a\u5178\u578b\u7684\u4f01\u4e1a\u5185\u7f51\u7f51\u5740\uff0c\u4f8b.com\u7f51\u5740\n\nintranet_ips \u68c0\u6d4b\u7ec8\u7aef\u662f\u5426\u80fd\u591f\u8bbf\u95ee\u5c40\u57df\u7f51\uff0c\u7b80\u6613\u8f93\u5165\u51e0\u4e2a\u5178\u578b\u7684\u5185\u7f51IP\u5730\u5740\n\n## \u542f\u52a8\u5ba2\u6237\u7aef\n\n```\nnatrix service start\n```\n\n\u4e3b\u8981\u67092\u4e2a\u4f5c\u7528\n\n1. \u542f\u52a8natrixclient systemd\u670d\u52a1\n2. \u8bbe\u7f6enatrixclient crontab\u5468\u671f\u6027\u547d\u4ee4\n\n### \u505c\u6b62\n\n```\nnatrix service stop\n```\n\n\u4e3b\u8981\u67092\u4e2a\u4f5c\u7528\n\n1. \u5173\u95ednatrixclient systemd\u670d\u52a1\n2. \u6e05\u9664natrixclient crontab\u5468\u671f\u6027\u547d\u4ee4\n\n### \u67e5\u770b\u72b6\u6001\n\n```\nnatrix service status\n```\n\n### \u8bbe\u7f6e\u5f00\u673a\u542f\u52a8\n\n```\nnatrix service enable\n```\n\n\u4e3b\u8981\u67092\u4e2a\u4f5c\u7528\n\n1. \u8bbe\u7f6enatrixclient systemd\u670d\u52a1\u5f00\u673a\u542f\u52a8\n2. \u8bbe\u7f6enatrixclient crontab\u5468\u671f\u6027\u547d\u4ee4\n\n### \u53d6\u6d88\u5f00\u673a\u542f\u52a8\n\n```\nnatrix service disable\n```\n\n\u4e3b\u8981\u67092\u4e2a\u4f5c\u7528\n\n1. \u53d6\u6d88natrixclient systemd\u670d\u52a1\u5f00\u673a\u542f\u52a8\n2. \u6e05\u9664natrixclient crontab\u5468\u671f\u6027\u547d\u4ee4\n\n## \u65e5\u5fd7\n\n\u65e5\u5fd7\u6587\u4ef6\u4f4d\u4e8e /var/log/natrix\n\n### console.log\n\n\u4f7f\u7528\u547d\u4ee4\u884c\u65b9\u5f0f\u8c03\u7528natrixclient\u751f\u6210\u7684\u65e5\u5fd7\n\n### api.log\n\n\u4f7f\u7528api\u65b9\u5f0f\u8c03\u7528\u7684\u65f6\u5019\u751f\u6210\u7684\u65e5\u5fd7\n\n### rabbitmq.log\n\n\u5f00\u542fsystemd\u670d\u52a1\uff0c\u4f7f\u7528rabbitmq\u65b9\u5f0f\u4ea4\u4e92\u751f\u6210\u7684\u65e5\u5fd7\n\n# \u4f7f\u7528\n\nnatrixclient \u652f\u63013\u79cd\u4f7f\u7528\u65b9\u5f0f\n\n- \u547d\u4ee4\u884c\u8c03\u7528\n- API\u8c03\u7528\n- RabbitMQ\u4ea4\u4e92\n\n## \u547d\u4ee4\u884c\n\nnatrix\u63d0\u4f9b\u53ef\u4ee5\u5355\u72ec\u4f7f\u7528\u7684\u547d\u4ee4\u884c\uff0c \u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u8bed\u53e5\u627e\u5bfb\u5e2e\u52a9\n\n```\n$ natrix -h\nusage: natrix [-h] [-d] [--log-file LOG_FILE]\n {ping,http,performance,dns,traceroute,check,keepalive} ...\n\nNatrix Command Line Interface\n\noptional arguments:\n -h, --help show this help message and exit\n\nNatrix Sub Commands:\n natrix sub commands.\n\n {ping,http,performance,dns,traceroute,check,keepalive}\n help information about the natrix sub commands\n ping natrix sub command - ping.\n http natrix sub command - http\n dns natrix sub command - dns.\n traceroute natrix sub command - traceroute.\n check natrix sub command - check\n report natrix sub command - report\n\nNatrix Command Line interface. \nThis tool is used to send network detective command such as ping, traceroute, dns and\netc.\n```\n\n```\n$ natrix http -h\nusage: natrix http [-h] [--http-version HTTP_VERSION] [-i INTERFACE]\n [-t TIMEOUT] [-R ALLOW_REDIRECTS] [-r MAX_REDIRECTS]\n [-a AUTHENTICATION_TYPE] [-c AUTHENTICATION_CONTENT]\n {get,post,put,delete} ... destination\n\npositional arguments:\n destination natrix http command destination, url or ip.\n\noptional arguments:\n -h, --help show this help message and exit\n --http-version HTTP_VERSION\n HTTP version, support 1.0 / 1.1 / 2.0\n -i INTERFACE, --interface INTERFACE\n user can use dedicated network interface.\n -t TIMEOUT, --timeout TIMEOUT\n Set an expiration time.\n -R ALLOW_REDIRECTS, --allow-redirects ALLOW_REDIRECTS\n Allow Redirects, Default is True.\n -r MAX_REDIRECTS, --max-redirects MAX_REDIRECTS\n Set Max Redirects. Default is 10\n -a AUTHENTICATION_TYPE, --authentication-type AUTHENTICATION_TYPE\n Authentication Type. support basic_auth /digest_auth /\n oauth1.0 / oauth2.0, if authentication-content is set,\n authentication-type is basic_auth\n -c AUTHENTICATION_CONTENT, --authentication-content AUTHENTICATION_CONTENT\n Authentication Content, for basic_auth, use\n username:password, like guest:guest\n\nNatrix HTTP Sub Commands:\n Natrix HTTP Sub Commands.\n\n {get,post,put,delete}\n Help Information About the Natrix HTTP sub commands\n get Natrix HTTP Sub Command - GET.\n post Natrix HTTP Sub Command - POST.\n put Natrix HTTP Sub Command - PUT.\n delete Natrix HTTP Sub Command - DELETE.\n```\n\n### \u547d\u4ee4\u5217\u8868\n\nnatrix\u5305\u542b\u5982\u4e0b\u5b50\u547d\u4ee4\n\n- ping\n\n \u76f8\u5173\u7684PING\u64cd\u4f5c\u547d\u4ee4\n\n- traceroute\n\n \u76f8\u5173\u7684\u8def\u7531\u547d\u4ee4\n\n- dns\n\n \u76f8\u5173\u7684DNS\u547d\u4ee4\n\n- http\n\n \u76f8\u5173HTTP\u534f\u8bae\u7684\u547d\u4ee4\uff0c\u4f8b\u5982 GET, PUT, POST, DELETE\u7b49\n\n- check\n\n \u68c0\u6d4b\u672c\u8bbe\u5907\u4fe1\u606f\u7684\u547d\u4ee4\n\n- report\n\n \u901a\u8fc7rabbitmq\u6c47\u62a5\u672c\u673a\u6570\u636e\u7ed9natrix server\n\n## API\n\n\u901a\u8fc7pip\u5b89\u88c5natrixclient\u5305\u4e4b\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7API\u5bf9\u5176\u529f\u80fd\u8fdb\u884c\u8c03\u7528\uff0c\u4f8b\u5982\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\n\nparameters = dict()\nparameters[\"count\"] = 1\nparameters[\"timeout\"] = 30\n\nresult = self.api.ping(destination=destination, parameters=parameters)\n```\n\n\u76f8\u5173\u7684\u53c2\u6570\u5b9a\u4e49\u8bf7\u53c2\u8003\u5177\u4f53\u7684\u547d\u4ee4\n\n## RabbitMQ\n\n\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u7aef\u901a\u8fc7RabbitMQ\u7b49\u8fdb\u884c\u4ea4\u6d41, \u9700\u8981\u8fdb\u884c\u76f8\u5173\u914d\u7f6e\n\n# PING\n\n## \u547d\u4ee4\u884c\n\n**natrix ping parameters destination**\n\n### destination\n\nurl or ip\n\n### parameters\n\n\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\n\nparameters = dict()\nparameters[\"count\"] = 1\nparameters[\"timeout\"] = 30\n\nresult = api.ping(destination=destination, parameters=parameters)\n```\n\nparameters\u9879\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## RabbitMQ\n\n### \u542f\u52a8\u670d\u52a1\n\n\n\n### producer_ping.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nimport time\nfrom natrixclient.common import const\nfrom natrixclient.common.config import NatrixConfig\nfrom natrixclient.command.check.network import NetInfo\n\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, int(port), vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\n\nmacs = NetInfo().get_macs()\nfor mac in macs:\n queue_name = const.QUEUE_COMMAND_PREFIX + mac.lower()\n print(queue_name)\n channel.queue_declare(queue=queue_name,\n durable=True,\n arguments={\n 'x-message-ttl': 120000,\n 'x-dead-letter-exchange': const.EXCHANGE_COMMAND_DEAD,\n 'x-dead-letter-routing-key': 'dead_command'\n })\n request = dict()\n request[\"generate_timestamp\"] = time.time()\n request[\"terminal\"] = mac.lower()\n request[\"uuid\"] = mac.lower()\n request[\"protocol\"] = \"PING\"\n request[\"destination\"] = \"www.baidu.com\"\n request_json = json.dumps(request)\n print(request_json)\n channel.basic_publish(exchange='', routing_key=queue_name, body=request_json)\n```\n\n### consumer_ping.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nfrom natrixclient.common.const import REQUEST_STORAGE_QUEUE_NAME\n\ndef callback(ch, method, properties, body):\n print(\"[x] Received: {}\".format(body))\n print(\"\")\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\nqueue_name = REQUEST_STORAGE_QUEUE_NAME\n\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, port, vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\nchannel.basic_consume(callback, queue=queue_name, no_ack=True)\n\ntry:\n channel.start_consuming()\nexcept KeyboardInterrupt:\n channel.stop_consuming()\nfinally:\n connection.close()\n```\n\nparameters\u9879\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## \u8f93\u5165\u53c2\u6570\n\n| console long key | console short key | api & rabbitmq parameter | type | comments | milestone |\n| ----------------- | ----------------- | ------------------------ | ------- | ---------------------------------------- | --------- |\n| --count | -c | count | int | ping\u7684\u6b21\u6570, Stop after sending count ECHO_REQUEST packets | |\n| --interface | -i | interface | string | interface is either an address, or an interface name. If interface is an address, it sets source address to specified interface address. If interface in an interface name, it sets source interface to specified interface | |\n| --timeout | -t | timeout | int | Time to wait for a response, in seconds. Default is five seconds. | 2 |\n| | | packet_size | | | 2 |\n| | | udp | | | 2 |\n| | | verbose | | | 2 |\n| --dns | -d | | string | \u6307\u5b9aDNS\u8fdb\u884cping | 2 |\n| --capture-packets | -C | | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u6293\u5305, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u6210pcap\u6587\u4ef6,\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 3 |\n| | | | | \u6307\u5b9a\u5305\u5927\u5c0f | 3 |\n\n## \u8fd4\u56de\u6570\u636e\n\n### \u6570\u636e\u683c\u5f0f\n\n```\n{\n 'command': {\n 'uuid': 'aaaaa', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n 'terminal': 'mac_address', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n }\n 'status': status_code,\n 'data': data_json,\n 'stamp': stamp_json\n}\n```\n\n### command\n\ncommand\u9879\u53ea\u662f rabbitmq \u624d\u6709\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| -------- | ------ | ---------------------- | ---- |\n| uuid | string | \u547d\u4ee4\u7684UUID | |\n| terminal | string | \u7ec8\u7aef\u7684\u552f\u4e00\u53f7, \u4e00\u822c\u662fmac address | |\n\n### status_code\n\nstatus_code\u6709\u5982\u4e0b\u503c\n\n| \u503c | \u8bf4\u660e |\n| ---- | ------ |\n| 0 | \u6b63\u786e\u8fd4\u56de\u6570\u636e |\n| 1 | \u72b6\u6001\u9519\u8bef |\n| | |\n\n### stamp_json\n\n```\n{\n \"server_request_generate_time\": 12345678,\n \"terminal_request_receive_time\": 123456,\n \"terminal_request_send_time\": 123456,\n \"terminal_response_receive_time\": 123456,\n \"terminal_response_return_time\": 123456,\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------------------ | ---- | ---------------------------------------- | ---- |\n| server_request_generate_time | time | \u670d\u52a1\u5668\u5411\u7ec8\u7aef\u53d1\u9001\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e)\u63a5\u6536\u5230\u670d\u52a1\u5668\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_send_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u5411 \u76ee\u7684\u5730\u5740 \u53d1\u8d77\u8bf7\u6c42\u7684\u65f6\u95f4 | |\n| terminal_response_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u76ee\u7684\u5730\u5740 response \u7684\u65f6\u95f4 | |\n| terminal_response_return_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u5904\u7406\u5b8cresponse, \u53d1\u9001\u7ed9 natrix\u670d\u52a1\u5668 \u7684\u65f6\u95f4 | |\n\n### data_json\n\ndata_json\u662f\u8fd4\u56de\u7684\u6570\u636e\u7c7b\u578b\uff0c\u6709\u6b63\u786e\u8fd4\u56de\u548c\u9519\u8bef\u8fd4\u56de2\u79cd\n\n### data_json\u6b63\u786e\u8fd4\u56de\n\n\u547d\u4ee4\u6b63\u786e\u6267\u884c\uff0c\u5f97\u5230\u6b63\u786e\u7684\u8fd4\u56de\u6570\u636e\n\n#### data_json\u683c\u5f0f\n\n```\n{\n\t\"destination\": \"www.baidu.com\",\n\t\"destination_ip\": \"10.10.10.13\"\uff0c\n\t\"destination_location\": location_info,\n\t\"packet_send\": 3,\n \"packet_receive\": 3,\n \"packet_loss\": 0,\n \"packet_size\": 1233456,\n \"avg_time\": 1233456\n \"max_time\": 1233456,\n \"min_time\": 1233456\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| -------------------- | ------ | --------- | ---- |\n| destination | string | \u76ee\u7684\u5730\u5740 | |\n| destination_ip | string | \u76ee\u7684\u5730\u5740IP | |\n| destination_location | json | \u76ee\u7684\u5730\u5740\u7684\u533a\u57df\u4fe1\u606f | |\n| packet_send | int | ping\u5305\u53d1\u9001\u6570\u91cf | |\n| packet_receive | int | ping\u5305\u63a5\u6536\u6570\u91cf | |\n| packet_loss | int | ping\u5305\u4e22\u5f03\u6570\u91cf | |\n| packet_size | int | ping\u5305\u5927\u5c0f | |\n| avg_time | time | \u5e73\u5747\u65f6\u95f4 | |\n| max_time | time | \u6700\u5927\u65f6\u95f4 | |\n| min_time | time | \u6700\u5c0f\u65f6\u95f4 | |\n\n#### location_json\u683c\u5f0f\n\n```\n{\n \"country\": \"\u4e2d\u56fd\",\n \"region\": \"\u534e\u5317\",\n \"province\": \"\u5317\u4eac\",\n \"city\": \"\u5317\u4eac\",\n \"county\": \"\u671d\u9633\u533a\",\n \"isp\": \"\u79fb\u52a8\"\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ---- |\n| country | string | \u56fd\u5bb6 |\n| region | string | \u533a\u57df |\n| province | string | \u7701 |\n| city | string | \u5e02 |\n| country | string | \u53bf |\n| isp | string | \u8fd0\u8425\u5546 |\n\n### data_json\u9519\u8bef\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n| \u5b57\u6bb5 | \u8bf4\u660e |\n| --------- | ---- |\n| errorcode | |\n| errorinfo | |\n| | |\n\n# Traceroute\n\n## \u547d\u4ee4\u884c\n\nnatrix traceroute parameters destination\n\n### destination\n\nurl or ip\n\n### parameters\n\n\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\nparameters = dict()\nparameters[\"protocol\"] = \"icmp\"\n\nresult = api.traceroute(destination=destination, parameters=parameters)\n```\n\nparameters \u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## RabbitMQ\n\n### \u542f\u52a8\u670d\u52a1\n\n\n\n### producer_traceroute.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nimport time\nfrom natrixclient.common import const\nfrom natrixclient.common.config import NatrixConfig\nfrom natrixclient.command.check.network import NetInfo\n\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, int(port), vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\n\nmacs = NetInfo().get_macs()\nfor mac in macs:\n queue_name = const.QUEUE_COMMAND_PREFIX + mac.lower()\n print(queue_name)\n channel.queue_declare(queue=queue_name,\n durable=True,\n arguments={\n 'x-message-ttl': 120000,\n 'x-dead-letter-exchange': const.EXCHANGE_COMMAND_DEAD,\n 'x-dead-letter-routing-key': 'dead_command'\n })\n request = dict()\n request[\"generate_timestamp\"] = time.time()\n request[\"terminal\"] = mac.lower()\n request[\"uuid\"] = mac.lower()\n request[\"protocol\"] = \"TRACEROUTE\"\n request[\"destination\"] = \"www.baidu.com\"\n request_json = json.dumps(request)\n print(request_json)\n channel.basic_publish(exchange='', routing_key=queue_name, body=request_json)\n```\n\n### consumer_traceroute.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nfrom natrixclient.common.const import REQUEST_STORAGE_QUEUE_NAME\n\ndef callback(ch, method, properties, body):\n print(\"[x] Received: {}\".format(body))\n print(\"\")\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\nqueue_name = REQUEST_STORAGE_QUEUE_NAME\n\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, port, vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\nchannel.basic_consume(callback, queue=queue_name, no_ack=True)\n\ntry:\n channel.start_consuming()\nexcept KeyboardInterrupt:\n channel.stop_consuming()\nfinally:\n connection.close()\n```\n\nparameters\u9879\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## \u8f93\u5165\u53c2\u6570\n\n| console long key | console short key | api & rabbitmq parameter | type | comments | milestone |\n| ----------------- | ----------------- | ------------------------ | ------- | ---------------------------------------- | --------- |\n| --interface | -i | interface | string | \u63a5\u53e3\u540d\u79f0 | 2 |\n| --icmp | -I | protocol=\"icmp\" | boolean | \u7f3a\u7701\u503c, Use ICMP ECHO for probes | |\n| --tcp | -T | protocol=\"tcp\" | boolean | Use TCP SYN for probes | |\n| --udp | -U | protocol=\"udp\" | boolean | Use UDP to particular destination port for tracerouting (instead of increasing the port per each probe). Default port is 53 (dns). | |\n| --max-hops | -m | max_hops | int | \u6700\u5927\u8df3\u6570 | |\n| --dns | -d | | DNS | \u4f7f\u7528\u6307\u5b9aDNS | 2 |\n| --capture packets | -C | | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u6293\u5305, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u6210pcap\u6587\u4ef6,\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 3 |\n\n## \u8fd4\u56de\u6570\u636e\n\n### \u6570\u636e\u683c\u5f0f\n\n```\n{\n 'command': {\n 'uuid': 'aaaaa', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n 'terminal': 'mac_address', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n }\n 'status': status_code,\n 'data': data_json\n}\n```\n\n### command\n\ncommand\u9879\u53ea\u662f rabbitmq \u624d\u6709\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------ | ------ | ---------------------- | ---- |\n| uuid | string | \u547d\u4ee4\u7684UUID | |\n| terminal | string | \u7ec8\u7aef\u7684\u552f\u4e00\u53f7, \u4e00\u822c\u662fmac address | |\n| generate_timestamp | int | \u547d\u4ee4\u751f\u6210\u65f6\u7684\u65f6\u95f4\u6233 | |\n\n### status_code\n\nstatus_code\u6709\u5982\u4e0b\u503c\n\n| \u503c | \u8bf4\u660e |\n| ---- | ------ |\n| 0 | \u6b63\u786e\u8fd4\u56de\u6570\u636e |\n| 1 | \u72b6\u6001\u9519\u8bef |\n| | |\n\n### stamp_json\n\n```\n{\n \"server_request_generate_time\": 12345678,\n \"terminal_request_receive_time\": 123456,\n \"terminal_request_send_time\": 123456,\n \"terminal_response_receive_time\": 123456,\n \"terminal_response_return_time\": 123456,\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------------------ | ---- | ---------------------------------------- | ---- |\n| server_request_generate_time | time | \u670d\u52a1\u5668\u5411\u7ec8\u7aef\u53d1\u9001\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e)\u63a5\u6536\u5230\u670d\u52a1\u5668\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_send_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u5411 \u76ee\u7684\u5730\u5740 \u53d1\u8d77\u8bf7\u6c42\u7684\u65f6\u95f4 | |\n| terminal_response_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u76ee\u7684\u5730\u5740 response \u7684\u65f6\u95f4 | |\n| terminal_response_return_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u5904\u7406\u5b8cresponse, \u53d1\u9001\u7ed9 natrix\u670d\u52a1\u5668 \u7684\u65f6\u95f4 | |\n\n### data_json\n\ndata_json\u662f\u8fd4\u56de\u7684\u6570\u636e\u7c7b\u578b\uff0c\u6709\u6b63\u786e\u8fd4\u56de\u548c\u9519\u8bef\u8fd4\u56de2\u79cd\n\n### data_json\u6b63\u786e\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n```\n{\n traceroute_list\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| --------------- | ---- | ------- | ---- |\n| traceroute_list | list | \u6bcf\u6b21\u8def\u7531\u9879\u5217\u8868 | |\n| | | | |\n\n#### traceroute_list\u683c\u5f0f\n\n```\n[\n traceroute_item1,\n traceroute_item2,\n traceroute_item3,\n ...\n]\n```\n\n#### traceroute_item\u683c\u5f0f\n\n```\n{\n\t\"seq\": 1,\n\t\"routes\": route_list\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| -------------- | ------ | ---- | ---- |\n| seq | int | \u5e8f\u5217\u53f7 | |\n| ip | string | IP | |\n| hostname | string | \u4e3b\u673a\u540d | |\n| location | json | \u4f4d\u7f6e\u4fe1\u606f | |\n| response_times | float | \u8fd4\u56de\u65f6\u95f4 | |\n\n#### route_list\u683c\u5f0f\n\n```\n[\n route_item1,\n route_item2,\n route_item3,\n]\n```\n\n#### route_item\u683c\u5f0f\n\n```\n{\n\t\"ip\": \"10.10.36.1\",\n\t\"hostname\": \"bogon\",\n\t\"location\": location_json,\n\t\"response_times\": 1.475\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| -------------- | ------ | ---- | ---- |\n| ip | string | IP | |\n| location | json | \u4f4d\u7f6e\u4fe1\u606f | |\n| hostname | string | \u4e3b\u673a\u540d | |\n| response_times | float | \u8fd4\u56de\u65f6\u95f4 | |\n\n#### location_json\u683c\u5f0f\n\n```\n{\n \"country\": \"\u4e2d\u56fd\",\n \"region\": \"\u534e\u5317\",\n \"province\": \"\u5317\u4eac\",\n \"city\": \"\u5317\u4eac\",\n \"county\": \"\u671d\u9633\u533a\",\n \"isp\": \"\u79fb\u52a8\"\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ---- |\n| country | string | \u56fd\u5bb6 |\n| region | string | \u533a\u57df |\n| province | string | \u7701 |\n| city | string | \u5e02 |\n| country | string | \u53bf |\n| isp | string | \u8fd0\u8425\u5546 |\n\n### data_json\u9519\u8bef\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n| \u5b57\u6bb5 | \u8bf4\u660e |\n| --------- | ---- |\n| errorcode | \u9519\u8bef\u4ee3\u7801 |\n| errorinfo | \u9519\u8bef\u4fe1\u606f |\n| | |\n\n# DNS\n\n## \u547d\u4ee4\u884c\n\nnatrix dns parameters destination\n\n### destination\n\nurl or ip\n\n### parameters\n\n\u8bf7\u53c2\u8003 \u53c2\u6570 \u5b9a\u4e49\n\n## API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\n\nparameters = dict()\nparameters[\"dns_method\"] = \"a\"\n\nresult = api.dns(destination=destination, parameters=parameters)\n```\n\nparameters \u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## RabbitMQ\n\n### \u542f\u52a8\u670d\u52a1\n\n\n\n### producer_dns.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nimport time\nfrom natrixclient.common import const\nfrom natrixclient.common.config import NatrixConfig\nfrom natrixclient.command.check.network import NetInfo\n\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, int(port), vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\n\nmacs = NetInfo().get_macs()\nfor mac in macs:\n queue_name = const.QUEUE_COMMAND_PREFIX + mac.lower()\n print(queue_name)\n channel.queue_declare(queue=queue_name,\n durable=True,\n arguments={\n 'x-message-ttl': 120000,\n 'x-dead-letter-exchange': const.EXCHANGE_COMMAND_DEAD,\n 'x-dead-letter-routing-key': 'dead_command'\n })\n request = dict()\n request[\"generate_timestamp\"] = time.time()\n request[\"terminal\"] = mac.lower()\n request[\"uuid\"] = mac.lower()\n request[\"protocol\"] = \"DNS\"\n request[\"destination\"] = \"www.baidu.com\"\n request_json = json.dumps(request)\n print(request_json)\n channel.basic_publish(exchange='', routing_key=queue_name, body=request_json)\n```\n\n### consumer_dns.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nfrom natrixclient.common.const import REQUEST_STORAGE_QUEUE_NAME\n\ndef callback(ch, method, properties, body):\n print(\"[x] Received: {}\".format(body))\n print(\"\")\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\nqueue_name = REQUEST_STORAGE_QUEUE_NAME\n\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, port, vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\nchannel.basic_consume(callback, queue=queue_name, no_ack=True)\n\ntry:\n channel.start_consuming()\nexcept KeyboardInterrupt:\n channel.stop_consuming()\nfinally:\n connection.close()\n```\n\nparameters\u9879\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## \u8f93\u5165\u53c2\u6570\n\n| console long key | console short key | api & rabbitmq parameter | type | comments | milestone |\n| ----------------- | ----------------- | ------------------------ | ------- | ---------------------------------------- | --------- |\n| --server | -s | dns_server | string | (optional) \u6307\u5b9adns server | |\n| --method | -m | dns_method | string | (optional) Change the type of the information query. default A | |\n| --timeout | -t | dns_timeout | int | (optional) The number of seconds to wait before the query times out. If None, the default, wait forever | |\n| --capture-packets | -C | | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u6293\u5305, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u6210pcap\u6587\u4ef6,\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 3 |\n\n### \u8f93\u5165\u53c2\u6570 - method\n\nmethod\u53d6\u503c\u5982\u4e0b\n\n| value | comments |\n| ----- | -------- |\n| a | \u5730\u5740\u8bb0\u5f55 |\n| cname | \u522b\u540d\u8bb0\u5f55 |\n| mx | \u90ae\u4ef6\u670d\u52a1\u5668\u8bb0\u5f55 |\n| ns | \u540d\u5b57\u670d\u52a1\u5668\u8bb0\u5f55 |\n| | |\n\n## \u8fd4\u56de\u6570\u636e\n\n### \u6570\u636e\u683c\u5f0f\n\n```\n{\n 'command': {\n 'uuid': 'aaaaa', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n 'terminal': 'mac_address', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n }\n 'status': status_code,\n 'data': data_json\n}\n```\n\n### command\n\ncommand\u9879\u53ea\u662f rabbitmq \u624d\u6709\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------ | ------ | ---------------------- | ---- |\n| uuid | string | \u547d\u4ee4\u7684UUID | |\n| terminal | string | \u7ec8\u7aef\u7684\u552f\u4e00\u53f7, \u4e00\u822c\u662fmac address | |\n| generate_timestamp | int | \u547d\u4ee4\u751f\u6210\u65f6\u7684\u65f6\u95f4\u6233 | |\n\n### status_code\n\nstatus_code\u6709\u5982\u4e0b\u503c\n\n| \u503c | \u8bf4\u660e |\n| ---- | ------ |\n| 0 | \u6b63\u786e\u8fd4\u56de\u6570\u636e |\n| 1 | \u72b6\u6001\u9519\u8bef |\n| | |\n\n### stamp_json\n\n```\n{\n \"server_request_generate_time\": 12345678,\n \"terminal_request_receive_time\": 123456,\n \"terminal_request_send_time\": 123456,\n \"terminal_response_receive_time\": 123456,\n \"terminal_response_return_time\": 123456,\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------------------ | ---- | ---------------------------------------- | ---- |\n| server_request_generate_time | time | \u670d\u52a1\u5668\u5411\u7ec8\u7aef\u53d1\u9001\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e)\u63a5\u6536\u5230\u670d\u52a1\u5668\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_send_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u5411 \u76ee\u7684\u5730\u5740 \u53d1\u8d77\u8bf7\u6c42\u7684\u65f6\u95f4 | |\n| terminal_response_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u76ee\u7684\u5730\u5740 response \u7684\u65f6\u95f4 | |\n| terminal_response_return_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u5904\u7406\u5b8cresponse, \u53d1\u9001\u7ed9 natrix\u670d\u52a1\u5668 \u7684\u65f6\u95f4 | |\n\n### data_json\n\ndata_json\u662f\u8fd4\u56de\u7684\u6570\u636e\u7c7b\u578b\uff0c\u6709\u6b63\u786e\u8fd4\u56de\u548c\u9519\u8bef\u8fd4\u56de2\u79cd\n\n### data_json\u6b63\u786e\u8fd4\u56de \n\n#### \u6570\u636e\u683c\u5f0f\n\n```\n{\n\t\"ips\": ips_list,\n\t\"destination\": \"www.baidu.com\",\n\t\"ptime\": 8.700132369995117,\n\t\"dns_server\": dns_server_json\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ----------- | ------ | ------------- | ---- |\n| ips | list | \u8fd4\u56de\u7684IP\u5217\u8868 | |\n| destination | string | \u8bf7\u6c42\u7684URL\u6216IP | |\n| ptime | float | dns\u89e3\u6790\u65f6\u95f4, \u5355\u4f4d\u6beb\u79d2 | |\n| dns_server | json | dns\u670d\u52a1\u5668IP | |\n\n#### ips_list\u683c\u5f0f\n\n```\n[\n ip_item,\n ip_item,\n ...\n]\n```\n\n#### ip_item\u683c\u5f0f\n\n```\n{\n\t\"ip\": \"220.181.112.244\",\n\t\"location\": location_json\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ----- |\n| ip | string | IP |\n| location | json | \u4f4d\u7f6e\u7b49\u4fe1\u606f |\n\n#### dns_server\u683c\u5f0f\n\n```\n{\n\t\"ip\": \"220.181.112.244\",\n\t\"location\": location_json\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ---- |\n| ip | string | IP |\n| location | json | \u4f4d\u7f6e\u4fe1\u606f |\n| | | |\n\n#### location_json\u683c\u5f0f\n\n```\n{\n \"country\": \"\u4e2d\u56fd\",\n \"region\": \"\u534e\u5317\",\n \"province\": \"\u5317\u4eac\",\n \"city\": \"\u5317\u4eac\",\n \"county\": \"\u671d\u9633\u533a\",\n \"isp\": \"\u79fb\u52a8\"\n}\n```\n\n\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ---- |\n| country | string | \u56fd\u5bb6 |\n| region | string | \u533a\u57df |\n| province | string | \u7701 |\n| city | string | \u5e02 |\n| country | string | \u53bf |\n| isp | string | \u8fd0\u8425\u5546 |\n\n\n\n#### data_json\u9519\u8bef\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n| \u5b57\u6bb5 | \u8bf4\u660e |\n| --------- | ---- |\n| errorcode | \u9519\u8bef\u4ee3\u7801 |\n| errorinfo | \u9519\u8bef\u4fe1\u606f |\n| | |\n\n# HTTP\n\n## \u547d\u4ee4\u884c\n\n**natrix http operation parameters destination**\n\n### destination\n\nurl or ip\n\n### operation\n\n| VALUE | COMMENTS | MILESTONE |\n| ------- | -------- | --------- |\n| get | GET | |\n| post | POST | |\n| put | PUT | |\n| delete | DELETE | |\n| head | HEAD | 2 |\n| patch | PATCH | 2 |\n| options | OPTIONS | 2 |\n\n### parameters\n\n\u8bf7\u53c2\u8003 \u53c2\u6570 \u5b9a\u4e49\n\n## API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\n\nresult = api.get(destination=destination)\n```\n\nparameters \u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## RabbitMQ\n\n### \u542f\u52a8\u670d\u52a1\n\n\n\n### producer_http.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nimport time\nfrom natrixclient.common import const\nfrom natrixclient.common.config import NatrixConfig\nfrom natrixclient.command.check.network import NetInfo\n\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, int(port), vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\n\nmacs = NetInfo().get_macs()\nfor mac in macs:\n queue_name = const.QUEUE_COMMAND_PREFIX + mac.lower()\n print(queue_name)\n channel.queue_declare(queue=queue_name,\n durable=True,\n arguments={\n 'x-message-ttl': 120000,\n 'x-dead-letter-exchange': const.EXCHANGE_COMMAND_DEAD,\n 'x-dead-letter-routing-key': 'dead_command'\n })\n request = dict()\n request[\"generate_timestamp\"] = time.time()\n request[\"terminal\"] = mac.lower()\n request[\"uuid\"] = mac.lower()\n request[\"protocol\"] = \"HTTP\"\n request[\"destination\"] = \"www.baidu.com\"\n request[\"parameters\"] = dict()\n request[\"parameters\"][\"operation\"] = \"get\"\n request_json = json.dumps(request)\n print(request_json)\n channel.basic_publish(exchange='', routing_key=queue_name, body=request_json)\n```\n\n### consumer_http.py\n\n```\n#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\nimport json\nimport pika\nfrom natrixclient.common.const import REQUEST_STORAGE_QUEUE_NAME\n\ndef callback(ch, method, properties, body):\n print(\"[x] Received: {}\".format(body))\n print(\"\")\n\nhost = \"rabbitmq.natrix.com\"\nport = 5672\nvhost = \"/natrix\"\nusername = \"natrix\"\npassword = \"natrix\"\nqueue_name = REQUEST_STORAGE_QUEUE_NAME\n\ncredentials = pika.PlainCredentials(username, password)\nparameters = pika.ConnectionParameters(host, port, vhost, credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\nchannel.basic_consume(callback, queue=queue_name, no_ack=True)\n\ntry:\n channel.start_consuming()\nexcept KeyboardInterrupt:\n channel.stop_consuming()\nfinally:\n connection.close()\n```\n\nparameters\u9879\u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## \u53c2\u6570\n\n\u901a\u8fc7\u547d\u4ee4\u884c\u6267\u884c\u7684\u65f6\u5019\u9700\u8981\u90a3\u4e9b\u8f93\u5165\u53c2\u6570\n\n| console long key | console short key | api & rabbitmq parameter | type | comments | milestone |\n| ---------------------- | ----------------- | ------------------------ | ------- | ---------------------------------------- | --------- |\n| | | operation | string | (required) http\u534f\u8bae, get/post/put/delete | |\n| --interface | -i | interface | string | (optional) \u63a5\u53e3, \u5141\u8bb8\u7528\u6237\u6307\u5b9a\u7f51\u7edc\u63a5\u53e3 | |\n| --allow-redirects | | allow_redirects | boolean | (optional) \u662f\u5426\u5141\u8bb8\u91cd\u5b9a\u5411, \u9ed8\u8ba4\u5141\u8bb8\u3002\u4f7f\u7528\u8303\u56f4 GET / HEAD / POST / PUT / OPTIONS / PATCH / DELETE | |\n| --max-redirects | | max_redirects | int | (optional) \u6700\u5927\u91cd\u5b9a\u5411\u6570 | |\n| --timeout | -t | timeout | float | (optional) \u8d85\u65f6\u65f6\u95f4, Timeout for the entire request. \u8d85\u65f6\u65f6\u95f4, \u7ecf\u8fc7\u4ee5 `timeout` \u53c2\u6570\u8bbe\u5b9a\u7684\u79d2\u6570\u65f6\u95f4\u4e4b\u540e\u505c\u6b62\u7b49\u5f85\u54cd\u5e94. `timeout` \u4ec5\u5bf9\u8fde\u63a5\u8fc7\u7a0b\u6709\u6548\uff0c\u4e0e\u54cd\u5e94\u4f53\u7684\u4e0b\u8f7d\u65e0\u5173\u3002 `timeout` \u5e76\u4e0d\u662f\u6574\u4e2a\u4e0b\u8f7d\u54cd\u5e94\u7684\u65f6\u95f4\u9650\u5236\uff0c\u800c\u662f\u5982\u679c\u670d\u52a1\u5668\u5728 `timeout` \u79d2\u5185\u6ca1\u6709\u5e94\u7b54\uff0c\u5c06\u4f1a\u5f15\u53d1\u4e00\u4e2a\u5f02\u5e38\uff08\u66f4\u7cbe\u786e\u5730\u8bf4\uff0c\u662f\u5728 `timeout` \u79d2\u5185\u6ca1\u6709\u4ece\u57fa\u7840\u5957\u63a5\u5b57\u4e0a\u63a5\u6536\u5230\u4efb\u4f55\u5b57\u8282\u7684\u6570\u636e\u65f6\uff09 **\u8fde\u63a5**\u8d85\u65f6\u6307\u7684\u662f\u5728\u4f60\u7684\u5ba2\u6237\u7aef\u5b9e\u73b0\u5230\u8fdc\u7aef\u673a\u5668\u7aef\u53e3\u7684\u8fde\u63a5\u65f6\uff08\u5bf9\u5e94\u7684\u662f`connect()`_\uff09\uff0cRequest \u4f1a\u7b49\u5f85\u7684\u79d2\u6570. **\u8bfb\u53d6**\u8d85\u65f6\u6307\u7684\u5c31\u662f\u5ba2\u6237\u7aef\u7b49\u5f85\u670d\u52a1\u5668\u53d1\u9001\u8bf7\u6c42\u7684\u65f6\u95f4. \u547d\u4ee4\u884c\u53ea\u652f\u6301\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\uff0c\u4e0d\u652f\u6301\u5355\u72ec\u8bbe\u7f6e\u8fde\u63a5\u8d85\u65f6\u548c\u8bfb\u53d6\u8d85\u65f6 | |\n| --connect-timeout | | connect_timeout | int | (optional) \u8fde\u63a5\u8d85\u65f6\u65f6\u95f4 | |\n| --dns-cache-timeout | | dns_cache_timeout | int | (optional) DNS\u4fe1\u606f\u4fdd\u5b58\u65f6\u95f4 | |\n| --fresh-connect | | fresh_connect | bool | (optional) \u5f3a\u5236\u83b7\u53d6\u65b0\u7684\u8fde\u63a5\uff0c\u5373\u66ff\u4ee3\u7f13\u5b58\u4e2d\u7684\u8fde\u63a5, \u7f3a\u7701\u662f0, \u4ee3\u8868\u53ef\u4ee5\u4f7f\u7528\u8001\u7684\u8fde\u63a5, natrix\u9ed8\u8ba4\u6bcf\u6b21\u5f3a\u5236\u83b7\u53d6\u65b0\u8fde\u63a5 | |\n| --auth-type | -a | auth_type | string | (optional) \u5b89\u5168\u9a8c\u8bc1\u7c7b\u578b, \u76ee\u524d\u652f\u6301basic | |\n| --auth-user | -u | auth_user | String | (optional) \u5b89\u5168\u9a8c\u8bc1\u5185\u5bb9, \u652f\u6301\u5b89\u5168\u9a8c\u8bc1\uff0c\u683c\u5f0f\u6839\u636e\u7c7b\u578b\u4e0d\u540c\u800c\u4e0d\u540c, \u4ee5basic_auth\u6765\u8bf4, guest:guest | |\n| --dns-servers | | | string | (optional) DNS\u670d\u52a1\u5668, servers \u6309\u7167\u9017\u53f7\u5206\u5272\uff0c\u6309\u7167\u987a\u5e8f\u4f7f\u7528dns server | 2 |\n| --capture-packets | | | boolean | (optional) \u662f\u5426\u6293\u5305, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u6210pcap\u6587\u4ef6,\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 3 |\n| --protocol | | | string | (optional) \u534f\u8bae\u7c7b\u578b, \u652f\u6301HTTP\u91cc\u7684\u5404\u79cd\u534f\u8bae, \u4f8b\u5982HTTP, HTTPS\uff0c FTP\uff0cRTSP\uff0c RTSPU\uff0c \u9ed8\u8ba4HTTP | 3 |\n| --http-version | | | string | (optional) HTTP\u7248\u672c\uff0c \u5bf9\u4e8eHTTP\u6765\u8bf4\uff0c\u6709HTTP 1.0/HTTP 1.1/HTTP 2.0 | 2 |\n| --use-cookies | | | boolean | (optional) \u662f\u5426\u4f7f\u7528\u7f13\u5b58 | 3 |\n| --cookies | | | json | (optional) \u7f13\u5b58\u5185\u5bb9 | 3 |\n| --http-header | -H | http_header | string | (optional) \u5934\u90e8\u4fe1\u606f\u652f\u6301, \u4fe1\u606f\u53c2\u8003\u6587\u6863 parameters-header | |\n| --http-body | -D | http_body | string | (optional) body | |\n| --save-response-header | | save_response_header | boolean | (optional) \u8fd4\u56de\u7ed3\u679c\u662f\u5426\u5305\u542bresponse_header\u4fe1\u606f, \u9ed8\u8ba4false | |\n| --save-response-body | | save_response_body | boolean | (optional) \u8fd4\u56de\u7ed3\u679c\u662f\u5426\u5305\u542bresponse_body\u4fe1\u606f, \u9ed8\u8ba4false | |\n\n### parameters - header\n\n| \u540d\u79f0 | \u8bf4\u660e | Sample |\n| ------------ | ---- | ---------------- |\n| Accept | | application/json |\n| Content-Type | | application/json |\n| charset | | UTF-8 |\n## \u793a\u4f8b\n\n### GET\n\n#### CURL\n\n```\n$ curl -i -u guest:guest http://localhost:15672/api/vhosts\nHTTP/1.1 200 OK\ncache-control: no-cache\ncontent-length: 77\ncontent-security-policy: default-src 'self'\ncontent-type: application/json\ndate: Tue, 22 Jan 2019 03:25:58 GMT\nserver: Cowboy\nvary: accept, accept-encoding, origin\n\n[{\"cluster_state\":{\"rabbit@localhost\":\"running\"},\"name\":\"/\",\"tracing\":false}]\n```\n\n#### Natrix\u547d\u4ee4\u884c\n\n```\n$ natrix http -u guest:guest get http://localhost:15672/api/vhosts\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/vhosts\", \"last_url\": \"http://localhost:15672/api/vhosts\", \"status_code\": 200, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 6.225, \"period_nslookup\": 5.197, \"period_tcp_connect\": 0.25099999999999945, \"period_ssl_connect\": 0, \"period_request\": 0.03700000000000081, \"period_response\": 0.7139999999999995, \"period_transfer\": 0.0259999999999998, \"header_size\": 233, \"size_upload\": 0.0, \"size_download\": 77.0, \"speed_upload\": 0.0, \"speed_download\": 12369.0}}\n======================================================\n```\n\n```\n$ natrix http -u guest:guest --save-response-header --save-response-body get http://localhost:15672/api/vhosts\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/vhosts\", \"last_url\": \"http://localhost:15672/api/vhosts\", \"status_code\": 200, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 6.759, \"period_nslookup\": 5.125, \"period_tcp_connect\": 0.3489999999999993, \"period_ssl_connect\": 0, \"period_request\": 0.3210000000000006, \"period_response\": 0.9260000000000002, \"period_transfer\": 0.038000000000000256, \"header_size\": 233, \"size_upload\": 0.0, \"size_download\": 77.0, \"speed_upload\": 0.0, \"speed_download\": 11392.0}, \"response_header\": \"HTTP/1.1 200 OK\\r\\ncache-control: no-cache\\r\\ncontent-length: 77\\r\\ncontent-security-policy: default-src 'self'\\r\\ncontent-type: application/json\\r\\ndate: Tue, 22 Jan 2019 03:28:32 GMT\\r\\nserver: Cowboy\\r\\nvary: accept, accept-encoding, origin\\r\\n\\r\\n\", \"response_body\": \"[{\\\"cluster_state\\\":{\\\"rabbit@localhost\\\":\\\"running\\\"},\\\"name\\\":\\\"/\\\",\\\"tracing\\\":false}]\"}\n======================================================\n```\n\n#### Natrix API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"www.baidu.com\"\n\nresult = api.get(destination=destination)\n```\n\n\n\n#### Natrix RabbitMQ\n\n```\nimport json\nimport pika\n\nqueue_name = \"natrix_request_xxxxxxxxxxxx\"\ncredentials = pika.PlainCredentials(\"natrix\", \"natrix\")\nparameters = pika.ConnectionParameters(\"127.0.0.1\", 5672, \"/natrix\", credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\n\nrequest = dict()\nrequest[\"generate_timestamp\"] = \"222222\"\nrequest[\"terminal\"] = \"080027683719\"\nrequest[\"uuid\"] = \"333333\"\nrequest[\"protocol\"] = \"HTTP\"\nrequest[\"destination\"] = \"www.baidu.com\"\nrequest[\"parameters\"] = dict()\nrequest[\"parameters\"][\"operation\"] = \"get\"\n\nchannel.basic_publish(exchange='', routing_key=queue_name, body=json.dumps(request))\n\n```\n\n\n\n### PUT\n\n#### CURL\n\n```\n$ curl -i -u guest:guest -H \"content-type:application/json\" -XPUT http://localhost:15672/api/vhosts/foo\nHTTP/1.1 201 Created\ncontent-length: 0\ncontent-security-policy: default-src 'self'\ndate: Tue, 22 Jan 2019 03:31:20 GMT\nserver: Cowboy\nvary: accept, accept-encoding, origin\n\n```\n\n```\n$ curl -i -u guest:guest -H \"content-type:application/json\" -XPUT -d'{\"type\":\"direct\",\"durable\":true}' http://localhost:15672/api/exchanges/foo/my-new-exchange\nHTTP/1.1 201 Created\ncontent-length: 0\ncontent-security-policy: default-src 'self'\ndate: Tue, 22 Jan 2019 06:58:05 GMT\nserver: Cowboy\nvary: accept, accept-encoding, origin\n\n```\n\n#### Natrix\u547d\u4ee4\u884c\n\n```\n$ natrix http -u guest:guest -H \"content-type:application/json\" put http://localhost:15672/api/vhosts/foo2\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/vhosts/foo2\", \"last_url\": \"http://localhost:15672/api/vhosts/foo2\", \"status_code\": 201, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 177.95, \"period_nslookup\": 5.176, \"period_tcp_connect\": 0.20999999999999996, \"period_ssl_connect\": 0, \"period_request\": 0.28300000000000036, \"period_response\": 172.25799999999998, \"period_transfer\": 0.022999999999996135, \"header_size\": 180, \"size_upload\": 0.0, \"size_download\": 0.0, \"speed_upload\": 0.0, \"speed_download\": 0.0}}\n======================================================\n```\n\n```\n$ natrix http -u guest:guest -H \"content-type:application/json\" -D '{\"type\":\"direct\",\"durable\":true}' put http://localhost:15672/api/exchanges/foo/my-new-exchange2\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange2\", \"last_url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange2\", \"status_code\": 201, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 17.46, \"period_nslookup\": 4.432, \"period_tcp_connect\": 0.1979999999999995, \"period_ssl_connect\": 0, \"period_request\": 0.04900000000000038, \"period_response\": 12.758999999999999, \"period_transfer\": 0.022000000000002018, \"header_size\": 180, \"size_upload\": 32.0, \"size_download\": 0.0, \"speed_upload\": 1832.0, \"speed_download\": 0.0}}\n======================================================\n```\n\n#### Natrix API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"http://localhost:15672/api/vhosts/foo6\"\n\nparameters = dict()\nparameters[\"auth_user\"] = \"guest:guest\"\nparameters[\"http_header\"] = \"content-type:application/json\"\n\nresult = api.put(destination=destination, parameters=parameters)\n```\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"http://localhost:15672/api/vhosts/foo7\"\n\nparameters = dict()\nparameters[\"auth_user\"] = \"guest:guest\"\nparameters[\"http_header\"] = \"content-type:application/json\"\nparameters[\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\n\nresult = api.put(destination=destination, parameters=parameters)\n```\n\n\n\n#### Natrix RabbitMQ\n\n```\nimport json\nimport pika\n\nqueue_name = \"natrix_request_xxxxxxxxxxxx\"\ncredentials = pika.PlainCredentials(\"natrix\", \"natrix\")\nparameters = pika.ConnectionParameters(\"127.0.0.1\", 5672, \"/natrix\", credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\n\nrequest = dict()\nrequest[\"generate_timestamp\"] = \"222222\"\nrequest[\"terminal\"] = \"080027683719\"\nrequest[\"uuid\"] = \"333333\"\nrequest[\"protocol\"] = \"HTTP\"\nrequest[\"destination\"] = \"http://localhost:15672/api/vhosts/foo8\"\nrequest[\"parameters\"] = dict()\nrequest[\"parameters\"][\"operation\"] = \"put\"\nrequest[\"parameters\"][\"auth_user\"] = \"guest:guest\"\nrequest[\"parameters\"][\"http_header\"] = \"content-type:application/json\"\nrequest[\"parameters\"][\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\n\nchannel.basic_publish(exchange='', routing_key=queue_name, body=json.dumps(request))\n\n```\n\n### POST\n\n#### CURL\n\n```\n$ curl -i -u guest:guest -H \"content-type:application/json\" -XPOST -d'{\"properties\":{},\"routing_key\":\"my key\",\"payload\":\"my body\",\"payload_encoding\":\"string\"}' http://localhost:15672/api/exchanges/foo/my-new-exchange/publish\nHTTP/1.1 200 OK\ncache-control: no-cache\ncontent-length: 16\ncontent-security-policy: default-src 'self'\ncontent-type: application/json\ndate: Wed, 23 Jan 2019 02:01:42 GMT\nserver: Cowboy\nvary: accept, accept-encoding, origin\n\n{\"routed\":false}\n```\n\n#### Natrix\u547d\u4ee4\u884c\n\n```\n$ natrix http -u guest:guest -H \"content-type:application/json\" -d '{\"properties\":{},\"routing_key\":\"my key\",\"payload\":\"my body\",\"payload_encoding\":\"string\"}' post http://localhost:15672/api/exchanges/foo/my-new-exchange/publish\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange/publish\", \"last_url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange/publish\", \"status_code\": 200, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 8.468, \"period_nslookup\": 5.221, \"period_tcp_connect\": 0.1980000000000004, \"period_ssl_connect\": 0, \"period_request\": 0.04299999999999926, \"period_response\": 2.9810000000000016, \"period_transfer\": 0.02499999999999858, \"header_size\": 233, \"size_upload\": 88.0, \"size_download\": 16.0, \"speed_upload\": 10392.0, \"speed_download\": 1889.0}}\n======================================================\n```\n\n#### Natrix API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"http://localhost:15672/api/vhosts/foo7\"\n\nparameters = dict()\nparameters[\"auth_user\"] = \"guest:guest\"\nparameters[\"http_header\"] = \"content-type:application/json\"\nparameters[\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\n\nresult = api.post(destination=destination, parameters=parameters)\n```\n\n\n\n#### Natrix RabbitMQ\n\n```\nimport json\nimport pika\n\nqueue_name = \"natrix_request_xxxxxxxxxxxx\"\ncredentials = pika.PlainCredentials(\"natrix\", \"natrix\")\nparameters = pika.ConnectionParameters(\"127.0.0.1\", 5672, \"/natrix\", credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\n\nrequest = dict()\nrequest[\"generate_timestamp\"] = \"222222\"\nrequest[\"terminal\"] = \"080027683719\"\nrequest[\"uuid\"] = \"333333\"\nrequest[\"protocol\"] = \"HTTP\"\nrequest[\"destination\"] = \"http://localhost:15672/api/vhosts/foo8\"\nrequest[\"parameters\"] = dict()\nrequest[\"parameters\"][\"operation\"] = \"post\"\nrequest[\"parameters\"][\"auth_user\"] = \"guest:guest\"\nrequest[\"parameters\"][\"http_header\"] = \"content-type:application/json\"\nrequest[\"parameters\"][\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\n\nchannel.basic_publish(exchange='', routing_key=queue_name, body=json.dumps(request))\n```\n\n### DELETE\n\n#### CURL\n\n```\n$ curl -i -u guest:guest -H \"content-type:application/json\" -XDELETE http://localhost:15672/api/exchanges/foo/my-new-exchange\nHTTP/1.1 204 No Content\ncontent-security-policy: default-src 'self'\ndate: Tue, 22 Jan 2019 08:26:54 GMT\nserver: Cowboy\nvary: accept, accept-encoding, origin\n```\n\n#### Natrix\u547d\u4ee4\u884c\n\n```\n$ natrix http -u guest:guest -H \"content-type:application/json\" delete http://localhost:15672/api/exchanges/foo/my-new-exchange1\n==================HTTP EXECUTE========================\n{\"status\": 0, \"data\": {\"url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange1\", \"last_url\": \"http://localhost:15672/api/exchanges/foo/my-new-exchange1\", \"status_code\": 204, \"redirect_count\": 0, \"redirect_time\": 0.0, \"remote_ip\": \"127.0.0.1\", \"remote_port\": 15672, \"local_ip\": \"127.0.0.1\", \"local_port\": \"127.0.0.1\", \"total_time\": 47.851, \"period_nslookup\": 4.64, \"period_tcp_connect\": 0.18799999999999972, \"period_ssl_connect\": 0, \"period_request\": 0.038000000000000256, \"period_response\": 42.961, \"period_transfer\": 0.02400000000000091, \"header_size\": 164, \"size_upload\": 0.0, \"size_download\": 0.0, \"speed_upload\": 0.0, \"speed_download\": 0.0}}\n======================================================\n```\n\n#### Natrix API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\n\ndestination = \"http://localhost:15672/api/vhosts/foo7\"\n\nparameters = dict()\nparameters[\"auth_user\"] = \"guest:guest\"\nparameters[\"http_header\"] = \"content-type:application/json\"\nparameters[\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\n\nresult = api.delete(destination=destination, parameters=parameters)\n```\n\n\n\n#### Natrix RabbitMQ\n\n```\nimport json\nimport pika\n\nqueue_name = \"natrix_request_xxxxxxxxxxxx\"\ncredentials = pika.PlainCredentials(\"natrix\", \"natrix\")\nparameters = pika.ConnectionParameters(\"127.0.0.1\", 5672, \"/natrix\", credentials=credentials)\nconnection = pika.BlockingConnection(parameters)\nchannel = connection.channel()\nqueue = channel.queue_declare(queue=queue_name, auto_delete=True)\n\nrequest = dict()\nrequest[\"generate_timestamp\"] = \"222222\"\nrequest[\"terminal\"] = \"080027683719\"\nrequest[\"uuid\"] = \"333333\"\nrequest[\"protocol\"] = \"HTTP\"\nrequest[\"destination\"] = \"http://localhost:15672/api/vhosts/foo8\"\nrequest[\"parameters\"] = dict()\nrequest[\"parameters\"][\"operation\"] = \"delete\"\nrequest[\"parameters\"][\"auth_user\"] = \"guest:guest\"\nrequest[\"parameters\"][\"http_header\"] = \"content-type:application/json\"\nrequest[\"parameters\"][\"http_body\"] = '{\"type\":\"direct\",\"durable\":true}'\nrequest[\"parameters\"][\"save_response_header\"] = True\nrequest[\"parameters\"][\"save_response_body\"] = True\n\nchannel.basic_publish(exchange='', routing_key=queue_name, body=json.dumps(request))\n```\n\n## \u8fd4\u56de\u6570\u636e\n\n### \u6570\u636e\u683c\u5f0f\n\n```\n{\n 'command': {\n 'uuid': 'aaaaa', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n 'terminal': 'mac_address', //\u6765\u81ea\u7ec8\u7aef\u63a5\u6536\u5230\u7684command\u4fe1\u606f\n }\n 'status': status_code,\n 'data': data_json\n}\n```\n\n### command\n\ncommand\u9879\u53ea\u662f rabbitmq \u624d\u6709\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------ | ------ | ---------------------- | ---- |\n| uuid | string | \u547d\u4ee4\u7684UUID | |\n| terminal | string | \u7ec8\u7aef\u7684\u552f\u4e00\u53f7, \u4e00\u822c\u662fmac address | |\n| generate_timestamp | int | \u547d\u4ee4\u751f\u6210\u65f6\u7684\u65f6\u95f4\u6233 | |\n\n### status_code\n\nstatus_code\u6709\u5982\u4e0b\u503c\n\n| \u503c | \u8bf4\u660e |\n| ---- | ------ |\n| 0 | \u6b63\u786e\u8fd4\u56de\u6570\u636e |\n| 1 | \u72b6\u6001\u9519\u8bef |\n| | |\n\n### stamp_json\n\n```\n{\n \"server_request_generate_time\": 12345678,\n \"terminal_request_receive_time\": 123456,\n \"terminal_request_send_time\": 123456,\n \"terminal_response_receive_time\": 123456,\n \"terminal_response_return_time\": 123456,\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e | \u5907\u6ce8 |\n| ------------------------------ | ---- | ---------------------------------------- | ---- |\n| server_request_generate_time | time | \u670d\u52a1\u5668\u5411\u7ec8\u7aef\u53d1\u9001\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e)\u63a5\u6536\u5230\u670d\u52a1\u5668\u8bf7\u6c42\u7684\u65f6\u95f4\u6233 | |\n| terminal_request_send_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u5411 \u76ee\u7684\u5730\u5740 \u53d1\u8d77\u8bf7\u6c42\u7684\u65f6\u95f4 | |\n| terminal_response_receive_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u76ee\u7684\u5730\u5740 response \u7684\u65f6\u95f4 | |\n| terminal_response_return_time | time | \u7ec8\u7aef(\u6811\u8393\u6d3e) \u63a5\u6536\u5230 \u5904\u7406\u5b8cresponse, \u53d1\u9001\u7ed9 natrix\u670d\u52a1\u5668 \u7684\u65f6\u95f4 | |\n\n\n\n### data_json\n\ndata_json\u662f\u8fd4\u56de\u7684\u6570\u636e\u7c7b\u578b\uff0c\u6709\u6b63\u786e\u8fd4\u56de\u548c\u9519\u8bef\u8fd4\u56de2\u79cd\n\n### data_json\u6b63\u786e\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n```\n{\n\t\"url\": \"http://localhost:15672/api/vhosts\",\n\t\"last_url\": \"http://localhost:15672/api/vhosts\",\n\t\"status_code\": 200,\n\t\"redirect_count\": 0,\n\t\"redirect_time\": 0.0,\n\t\"remote_ip\": \"127.0.0.1\",\n\t\"remote_location\": location_json,\n\t\"remote_port\": 15672,\n\t\"local_ip\": \"127.0.0.1\",\n\t\"local_location\": location_json,\n\t\"local_port\": \"127.0.0.1\",\n\t\"total_time\": 6.759,\n\t\"period_nslookup\": 5.125,\n\t\"period_tcp_connect\": 0.3489999999999993,\n\t\"period_ssl_connect\": 0,\n\t\"period_request\": 0.3210000000000006,\n\t\"period_response\": 0.9260000000000002,\n\t\"period_transfer\": 0.038000000000000256,\n\t\"header_size\": 233,\n\t\"size_upload\": 0.0,\n\t\"size_download\": 77.0,\n\t\"speed_upload\": 0.0,\n\t\"speed_download\": 11392.0,\n\t\"response_header\": \"HTTP/1.1 404 Not Found\\r\\nserver: Cowboy\\r\\ndate: Thu, 14 Mar 2019 08:47:04 GMT\\r\\ncontent-length: 49\\r\\ncontent-type: application/json\\r\\nvary: accept, accept-encoding, origin\\r\\n\\r\\n\",\n\t\"response_body\": \"{\\\"error\\\":\\\"Object Not Found\\\",\\\"reason\\\":\\\"Not Found\\\"}\"\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| ------------------ | ------ | --------------- |\n| url | string | \u8bf7\u6c42URL |\n| last_url | string | \u6700\u540e\u4e00\u6b21\u8bf7\u6c42\u7684URL |\n| status_code | int | HTTP \u54cd\u5e94\u4ee3\u7801 |\n| redirect_count | int | \u91cd\u5b9a\u5411\u6b21\u6570 |\n| redirect_time | float | \u91cd\u5b9a\u5411\u6240\u6d88\u8017\u7684\u65f6\u95f4 |\n| remote_ip | string | \u6700\u540e\u4e00\u6b21\u8fde\u63a5\u7684\u8fdc\u7a0bIP\u5730\u5740 |\n| remote_location | json | \u8fdc\u7a0bIP\u7684\u4f4d\u7f6e\u4fe1\u606f |\n| remote_port | int | \u6700\u540e\u4e00\u6b21\u8fde\u63a5\u7684\u8fdc\u7a0b\u7aef\u53e3\u53f7 |\n| local_ip | string | \u6700\u540e\u4e00\u6b21\u8fde\u63a5\u7684\u672c\u5730IP\u5730\u5740 |\n| local_location | json | \u672c\u5730IP\u7684\u4f4d\u7f6e\u4fe1\u606f |\n| local_port | int | \u6700\u540e\u4e00\u6b21\u8fde\u63a5\u7684\u672c\u5730\u7aef\u53e3\u53f7 |\n| total_time | float | \u8bf7\u6c42\u603b\u7684\u65f6\u95f4 |\n| namelookup_time | float | DNS\u89e3\u6790\u6240\u6d88\u8017\u7684\u65f6\u95f4 |\n| period_tcp_connect | float | TCP\u8fde\u63a5\u8017\u65f6 |\n| period_ssl_connect | float | SSL\u8fde\u63a5\u8017\u65f6 |\n| period_request | float | Request\u8bf7\u6c42\u8017\u65f6 |\n| period_response | float | Response\u5904\u7406\u8017\u65f6 |\n| period_transfer | float | Response\u4f20\u8f93\u8017\u65f6 |\n| size_upload | float | \u4e0a\u4f20\u6570\u636e\u5305\u5927\u5c0f |\n| size_download | float | \u4e0b\u8f7d\u6570\u636e\u5305\u5927\u5c0f |\n| speed_upload | float | \u4e0a\u4f20\u901f\u5ea6 |\n| speed_download | float | \u4e0b\u8f7d\u901f\u5ea6 |\n| response_header | string | response\u5934\u90e8\u4fe1\u606f |\n| response_body | string | response body\u4fe1\u606f |\n\n#### location_json\u683c\u5f0f\n\n```\n{\n \"country\": \"\u4e2d\u56fd\",\n \"region\": \"\u534e\u5317\",\n \"province\": \"\u5317\u4eac\",\n \"city\": \"\u5317\u4eac\",\n \"county\": \"\u671d\u9633\u533a\",\n \"isp\": \"\u79fb\u52a8\"\n}\n```\n\n| \u5b57\u6bb5 | \u7c7b\u578b | \u8bf4\u660e |\n| -------- | ------ | ---- |\n| country | string | \u56fd\u5bb6 |\n| region | string | \u533a\u57df |\n| province | string | \u7701 |\n| city | string | \u5e02 |\n| country | string | \u53bf |\n| isp | string | \u8fd0\u8425\u5546 |\n\n#### data_json\u9519\u8bef\u8fd4\u56de\n\n#### data_json\u683c\u5f0f\n\n| \u5b57\u6bb5 | \u8bf4\u660e |\n| --------- | ---- |\n| errorcode | \u9519\u8bef\u4ee3\u7801 |\n| errorinfo | \u9519\u8bef\u4fe1\u606f |\n| | |\n\n# Check\n\n## \u547d\u4ee4\u884c\n\nnatrix check type\n\ntype\u6709\u5982\u4e0b\u51e0\u79cd\n\n| \u7c7b\u578b | \u5907\u6ce8 |\n| -------- | ------------------------------- |\n| basic | \u57fa\u7840\u4e0a\u62a5\u529f\u80fd |\n| advance | \u6240\u6709\u7684\u4fe1\u606f\u90fd\u4e0a\u62a5 |\n| hardware | \u786c\u4ef6\u4fe1\u606f |\n| network | \u7f51\u7edc\u4fe1\u606f |\n| system | \u7cfb\u7edf\u4fe1\u606f, \u5305\u542b\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f, natrixclient\u7684\u4fe1\u606f |\n\n## API\n\n```\nfrom natrixclient.api import NatrixClientAPI\n\napi = NatrixClientAPI()\nparameters = dict()\nparameters[\"type\"] = \"system\"\nresult = api.check(parameters)\n```\n\nparameters \u8bf7\u53c2\u8003 \u53c2\u6570 \u7ae0\u8282\n\n## RabbitMQ\n\n\u65e0\n\n## \u8fd4\u56de\u6570\u636e\n\n### \u9ad8\u7ea7\u8fd4\u56de\u4fe1\u606f advanced_information\n\ncheck the current client information, the result information including\n\u9700\u8981\u5305\u542b\u5982\u4e0b\u4fe1\u606f\uff1a\n\n\u91c7\u7528 json \u683c\u5f0f\n\n```\n{\n \"system\": system_json,\n \"hardware\": hardware_json,\n \"networks\": network_json,\n \"heartbeat\": 1234567,\n}\n```\n\nheatbeat\u5c5e\u4e8e\u5fc3\u8df3\u65f6\u95f4, \u662f\u4ece\u5ba2\u6237\u7aef\u53d1\u51fa\u7684\u65f6\u95f4\n\n#### \u7cfb\u7edf\u4fe1\u606f system_json\n\n```\n{\n\t\"operating\": operating_json,\n\t\"natrixclient\": natrixclient_json,\n},\n```\n\n##### \u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f operating_json\n\n\n\n| \u540d\u79f0 | \u7c7b\u578b | \u5907\u6ce8 | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| ------------------------- | ------ | ---------------------------------------- | ---- | ---- | ---- |\n| type | string | \u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b, \u4f8b\u5982Linux\u6216Windows | Y | N | |\n| series | string | \u64cd\u4f5c\u7cfb\u7edf\u7cfb\u5217, \u4f8b\u5982debian\u6216redhat | Y | N | |\n| name | string | \u64cd\u4f5c\u7cfb\u7edf\u540d\u79f0\uff0c\u4f8b\u5982ubuntu\u6216centos\u6216raspbian | Y | N | |\n| codename | string | \u64cd\u4f5c\u7cfb\u7edf\u53d1\u884c\u4ee3\u53f7, \u4f8b\u5982strech\u6216'Bionic Beaver' | Y | N | |\n| major_version | string | \u64cd\u4f5c\u7cfb\u7edf\u4e3b\u7248\u672c\u53f7 | Y | N | |\n| minor_version | string | \u64cd\u4f5c\u7cfb\u7edf\u6b21\u7248\u672c\u53f7, \u53ef\u4ee5\u4e3a\u7a7a\u6216\u7a7a\u503c | Y | N | |\n| kernel_version | string | \u64cd\u4f5c\u7cfb\u7edf\u5185\u6838\u7248\u672c\u4fe1\u606f, \u4f8b\u5982linux kernel\u7684\u7248\u672c\u4fe1\u606f | Y | N | |\n| architecture | string | \u64cd\u4f5c\u7cfb\u7edf\u67b6\u6784\u4fe1\u606f, 32bit \u6216 64bit | Y | N | |\n| platform | string | \u7efc\u5408\u5e73\u53f0\u4fe1\u606f\uff0c\u4f8b\u5982 'Linux-4.15.0-42-generic-x86_64-with-Ubuntu-18.04-bionic' | Y | N | |\n| python_version | string | \u9ed8\u8ba4python\u7248\u672c | Y | N | |\n| python2_version | string | python2\u7684\u7248\u672c | | | 2 |\n| python3_version | string | python3\u7684\u7248\u672c | | | 2 |\n| desktop_version | string | \u684c\u9762\u7248\u672c\u4fe1\u606f | Y | N | |\n| selenium_version | string | selenium\u7248\u672c\u4fe1\u606f, 0\u4ee3\u8868\u672a\u5b89\u88c5 | Y | N | |\n| chrome_version | string | chrome\u7248\u672c\u4fe1\u606f, 0\u4ee3\u8868\u672a\u5b89\u88c5 | Y | N | |\n| chrome_webdriver_path | string | chrome webdriver\u8def\u5f84\u4fe1\u606f, \u7a7a\u4ee3\u8868\u672a\u627e\u5230 | Y | Y | |\n| chrome_webdriver_version | string | chrome webdriver\u7248\u672c\u4fe1\u606f, 0\u4ee3\u8868\u672a\u5b89\u88c5 | Y | N | |\n| firefox_version | string | firefox\u7248\u672c\u4fe1\u606f, 0\u4ee3\u8868\u672a\u5b89\u88c5 | Y | N | |\n| firefox_webdriver_path | string | firefox webdriver\u8def\u5f84\u4fe1\u606f, \u7a7a\u4ee3\u8868\u672a\u627e\u5230 | Y | Y | |\n| firefox_webdriver_version | string | firefox webdriver\u7248\u672c\u4fe1\u606f, 0\u4ee3\u8868\u672a\u5b89\u88c5 | Y | N | |\n\n##### natrixclient\u8f6f\u4ef6\u4fe1\u606f natrixclient_json\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| -------------------- | ------ | ----------------- | ---- | ---- | ---- |\n| natrixclient_version | string | natrixclient\u7684\u7248\u672c\u4fe1\u606f | Y | N | |\n\n#### \u786c\u4ef6\u4fe1\u606f hardware_json\n\n\u786c\u4ef6\u4fe1\u606f\u4e3b\u8981\u5305\u542b\u5982\u4e0b\u5185\u5bb9\n\n```\n{\n\t\"sn\": \"xxxxxxx\",\n\t\"hostname\": \"pi-xxxxxx\",\n\t\"product\": \"Raspberry Pi 3 Model B Rev 1.2\",\n\t\"boot_time\": 113456,\n\t\"cpu_info\": cpu_json,\n\t\"memory_info\": memory_json,\n\t\"disk_info\": disk_json,\n},\n```\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| ----------- | ------ | ----- | ---- | ---- | ---- |\n| sn | sting | \u5e8f\u5217\u53f7 | Y | N | |\n| hostname | string | \u4e3b\u673a\u540d | Y | N | |\n| product | string | \u4ea7\u54c1\u578b\u53f7 | Y | N | |\n| boot_time | float | \u5f00\u673a\u65f6\u957f | Y | N | |\n| cpu_info | json | cpu\u4fe1\u606f | Y | N | |\n| memory_info | json | \u5185\u5b58\u4fe1\u606f | Y | N | |\n| disk_info | json | \u78c1\u76d8\u4fe1\u606f | Y | N | |\n\n\n\n##### sn\n\n\u7ec8\u7aef\u8bbe\u5907\u7684\u5e8f\u5217\u53f7\n\n\u5bf9\u4e8e\u6811\u6885\u6d3e\u8bbe\u5907, \u4f7f\u7528cpu serial number\n\n```\ncat /proc/cpuinfo | grep -i Serial | cut -d ' ' -f 2\n```\n\n\u5bf9\u4e8eubuntu\u8bbe\u5907\n\n```\nsudo dmidecode -t system | grep -i serial | cut -d ':' -f 2\n```\n\nif serial number is 0, using\n\n```\nsudo dmidecode -t system | grep uuid\n```\n\n##### hostname\n\n\u4e3b\u673a\u540d\n\n##### product\n\n\u7ec8\u7aef\u8bbe\u5907\u7684\u4ea7\u54c1\u578b\u53f7\u4fe1\u606f\n\n\u5bf9\u4e8elinux\u7ec8\u7aef\u8bbe\u5907\n\n```\nsudo dmidecode -t system | grep \"Product Name\" \n```\n\n\u5bf9\u4e8eraspbian\u7ec8\u7aef\u8bbe\u5907\n\n```\ncat /sys/firmware/devicetree/base/model\n```\n\n##### boot_time\n\n\u542f\u52a8\u65f6\u95f4\n\n##### cpu_json\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| ----------- | ------ | ----------------------- | ---- | ---- | ---- |\n| cpu_model | string | CPU\u578b\u53f7 | Y | N | |\n| cpu_core | int | CPU\u6838\u6570 | Y | N | |\n| cpu_percent | float | CPU\u4f7f\u7528\u7387, \u9ed8\u8ba4\u662f\u4e00\u79d2\u949f\u7684\u4f7f\u7528\u7387, \u767e\u5206\u6bd4 | Y | N | |\n\n##### memory _info\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| -------------- | ----- | ---------- | ---- | ---- | ---- |\n| memory_total | float | \u603b\u7684\u5185\u5b58 | Y | N | |\n| memory_used | float | \u5df2\u7ecf\u4f7f\u7528\u7684\u5185\u5b58 | Y | N | |\n| memory_percent | float | \u5185\u5b58\u4f7f\u7528\u7387, \u767e\u5206\u6bd4 | Y | N | |\n| | | | | | |\n\n##### disk_info\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| ------------ | ----- | ----- | ---- | ---- | ---- |\n| disk_percent | float | \u78c1\u76d8\u4f7f\u7528\u7387 | Y | N | |\n\n#### \u7f51\u7edc\u4fe1\u606f network_json\n\n##### \u6240\u6709\u7f51\u7edc\u63a5\u53e3\u4fe1\u606f interfaces_json\n\n\u7f51\u7edc\u63a5\u53e3\u4fe1\u606f\u662f\u4e00\u4e2a\u5217\u8868\u4fe1\u606f, \u91cc\u9762\u7684\u4fe1\u606f\u5982\u4e0b\n\n```\n{\n\t\"eth0\": interface_json, \n\t\"wlan0\": interface_json\n}\n```\n\n##### \u5355\u4e2a\u7f51\u7edc\u63a5\u53e3\u4fe1\u606f interface_json\n\n```\n{\n \"type\": \"wired\",\n \"name\": \"eth0\",\n \"macaddress\": \"xxxxxxxxx\",\n \"localip\": \"10.10.10.10\",\n \"netmask\": \"255.255.255.0\",\n \"braodcast\": \"10.10.10.255\",\n \"gateway\": \"10.10.10.1,\n \"is_default\": true,\n \"public_ip\": \"10.10.10.10\",\n \"location_info\": location_json,\n \"access_intranet\": true,\n \"access_coporate\": true,\n \"access_internet\": true\n}\n```\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| --------------- | ------- | -------------------- | ---- | ---- | ---- |\n| type | string | \u7f51\u5361\u7c7b\u578b(\u6709\u7ebf,\u65e0\u7ebf,4G) | Y | N | |\n| name | string | \u7f51\u5361\u540d\u79f0, \u4f8b\u5982eth0\u7b49 | Y | N | |\n| macaddress | string | MACADDRESS, \u7f51\u5361\u7269\u7406\u5730\u5740 | Y | Y | |\n| local_ip | string | \u672c\u5730IP\u5730\u5740 | Y | Y | |\n| local_location | json | location_json | Y | Y | |\n| netmask | string | \u5b50\u7f51\u63a9\u7801 | Y | Y | |\n| broadcast | string | \u5e7f\u64ad\u5730\u5740 | Y | Y | |\n| gateway | string | \u7f51\u5173 | Y | Y | |\n| is_default | boolean | \u662f\u5426\u662f\u7f3a\u7701\u4f7f\u7528\u7684\u7f51\u5361, \u9ed8\u8ba4\u662ffalse | Y | Y | |\n| | | | | | |\n| public_ip | string | \u68c0\u6d4b\u516c\u7f51IP | Y | Y | |\n| public_location | json | location_json | Y | Y | |\n| | | | | | |\n| access_intranet | boolean | \u662f\u5426\u80fd\u8bbf\u95ee\u5c40\u57df\u7f51, \u9ed8\u8ba4False | Y | N | |\n| access_coporate | boolean | \u662f\u5426\u80fd\u8bbf\u95ee\u4f01\u4e1a\u7f51, \u9ed8\u8ba4False | Y | N | |\n| access_internet | boolean | \u662f\u5426\u80fd\u8bbf\u95ee\u4e92\u8054\u7f51, \u9ed8\u8ba4\u4e3aFalse | Y | N | |\n| | | | | | |\n\n\u5bf9\u4e8e\u4e00\u4e2a\u63a5\u53e3\u6765\u8bf4\uff0c\u6709\u53ef\u80fd\u5b58\u5728\u597d\u51e0\u4e2aIP\u5730\u5740\u7684\u60c5\u51b5, \u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cneed to throw exception, natrix do not support this situation\n\n##### \u5730\u57df\u4e0e\u8fd0\u8425\u5546\u4fe1\u606f location_json\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u5fc5\u987b | \u7a7a\u503c | \u91cc\u7a0b\u7891 |\n| -------- | ------ | ---------- | ---- | ---- | ---- |\n| country | string | \u56fd\u5bb6 | Y | N | |\n| region | string | \u533a\u57df, 0\u4ee3\u8868\u6ca1\u6709 | Y | N | |\n| province | string | \u7701, 0\u4ee3\u8868\u6ca1\u6709 | Y | N | |\n| city | string | \u57ce\u5e02, 0\u4ee3\u8868\u6ca1\u6709 | Y | N | |\n| isp | string | \u8fd0\u8425\u5546, 0\u4ee3\u8868\u6ca1\u6709 | Y | N | |\n| | | | | | |\n\n\n\n### \u57fa\u7840\u8fd4\u56de\u4fe1\u606f basic_infomation\n\ncheck the current client information, the result information including\n\u9700\u8981\u5305\u542b\u5982\u4e0b\u4fe1\u606f\uff1a\n\n\u91c7\u7528 json \u683c\u5f0f\n\n```\n{\n \"system\": system_basic_json,\n \"hardware\": hardware_basic_json,\n \"networks\": network_json,\n \"heartbeat\": 1234567,\n}\n```\n\nheatbeat\u5c5e\u4e8e\u5fc3\u8df3\u65f6\u95f4, \u662f\u4ece\u5ba2\u6237\u7aef\u53d1\u51fa\u7684\u65f6\u95f4\n\n#### \u7cfb\u7edf\u7b80\u5355\u4fe1\u606f system_basic_json\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u91cc\u7a0b\u7891 |\n| ------------------------------ | ------ | --------------------------- | ---- |\n| natrixclient_version | string | natrixclient\u7684\u7248\u672c\u4fe1\u606f | |\n| natrixclient_crontab_version | string | natrixclient crontab\u7684\u7248\u672c\u4fe1\u606f | |\n| natrixclient_dashboard_version | string | natrixclient dashboard\u7684\u7248\u672c\u4fe1\u606f | |\n| | | | |\n| | | | |\n| | | | |\n| | | | |\n\n#### \u786c\u4ef6\u7b80\u5355\u4fe1\u606f hardware_simple_json\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e | \u91cc\u7a0b\u7891 |\n| -------------- | ------ | ----------------------- | ---- |\n| sn | string | | |\n| hostname | string | | |\n| cpu_percent | float | CPU\u4f7f\u7528\u7387, \u9ed8\u8ba4\u662f\u4e00\u79d2\u949f\u7684\u4f7f\u7528\u7387, \u767e\u5206\u6bd4 | |\n| memory_percent | float | \u5185\u5b58\u4f7f\u7528\u7387, \u767e\u5206\u6bd4 | |\n| disk_percent | float | \u78c1\u76d8\u4f7f\u7528\u7387, \u767e\u5206\u6bd4 | |\n| | | | |\n| | | | |\n| | | | |\n| | | | |\n\n#### \u7f51\u7edc\u4fe1\u606f network_json\n\n\u540c\u9ad8\u7ea7\u8fd4\u56de\u4fe1\u606f\u4e2d\u7684network_json\n\n# Report\n\nreport\u547d\u4ee4\u7528\u6765\u624b\u52a8\u8fdb\u884c\u4fe1\u606f\u4e0a\u62a5\n\n## \u547d\u4ee4\u884c\n\nnatrix report type \n\ntype\u5305\u542b\u5982\u4e0b2\u79cd\u7c7b\n\n| \u7c7b\u578b | \u8bf4\u660e |\n| ------- | ------------------------- |\n| basic | \u57fa\u7840\u4fe1\u606f\u4e0a\u62a5, \u5177\u4f53\u53c2\u8003 check basic |\n| advance | \u9ad8\u7ea7\u4fe1\u606f\u4e0a\u62a5\uff0c\u5177\u4f53\u53c2\u8003 check advance |\n| | |\n\n## API\n\n\u4e0d\u652f\u6301\n\n## RabbitMQ\n\n\u4e0d\u652f\u6301\n\n\n# Performance(In progressing...)\n\n**natrix performance parameters destination**\n\n## \u547d\u4ee4\u884c\n\n### destination\n\nurl or ip\n\n## \u8f93\u5165\u53c2\u6570\n\n| long key | short key | value | comments | milestone |\n| ----------------- | --------- | ----------- | ---------------------------------------- | --------- |\n| --browser | -b | web browser | \u6d4f\u89c8\u5668\u9009\u62e9, the webbrowser, values curl/firefox/chrome, by default is curl | |\n| --dns-server | -d | dns-server | dns server | |\n| --snapshot | -S | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u4fdd\u5b58\u5feb\u7167, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u8fd4\u56dehtml, \u4ee5\u6587\u4ef6\u5f62\u5f0f\u5b58\u5728, \u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 2 |\n| --capture packets | -C | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u6293\u5305, \u9ed8\u8ba4false, \u5982\u679ctrue, \u4fdd\u5b58\u6210pcap\u6587\u4ef6,\u91c7\u7528\u5bf9\u8c61\u5b58\u50a8 | 3 |\n| --keep-alive | -K | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u4fdd\u6301\u5e38\u8fde\u63a5 | 2 |\n| --cache | -C | boolean | (\u73b0\u9636\u6bb5\u4e0d\u652f\u6301)\u662f\u5426\u4f7f\u7528\u7f13\u5b58 | 2 |\n\n## \u8fd4\u56de\u6570\u636e\n\n```\n{\n \"timing\": {},\n \"resources\": {}\n}\n```\n\n| \u540d\u79f0 | \u7c7b\u578b | \u8bf4\u660e |\n| --------- | ---- | ------- |\n| timing | json | \u65f6\u95f4\u4fe1\u606f |\n| resources | json | \u8d44\u6e90\u7684\u8fd4\u56de\u5217\u8868 |\n\n#### timing\n\n| name | \u540d\u79f0 | \u8bf4\u660e | \u663e\u793a |\n| -------------------------- | ----------- | ---------------------------------------- | -------- |\n| statusCode | \u72b6\u6001\u7801 | \u6682\u65f6\u5f97\u4e0d\u5230\u76f8\u5173\u4fe1\u606f | |\n| resourceSize | \u8d44\u6e90\u5927\u5c0f | \u6682\u65f6\u5f97\u4e0d\u5230\u76f8\u5173\u4fe1\u606f | |\n| navigationStart | \u5f00\u59cb\u65f6\u95f4 | \u51c6\u5907\u52a0\u8f7d\u65b0\u9875\u9762\u7684\u8d77\u59cb\u65f6\u95f4 | |\n| redirectStart | \u91cd\u5b9a\u5411\u5f00\u59cb\u65f6 | \u5982\u679c\u53d1\u751f\u4e86HTTP\u91cd\u5b9a\u5411\uff0c\u5e76\u4e14\u4ece\u5bfc\u822a\u5f00\u59cb\uff0c\u4e2d\u95f4\u7684\u6bcf\u6b21\u91cd\u5b9a\u5411\uff0c\u90fd\u548c\u5f53\u524d\u6587\u6863\u540c\u57df\u7684\u8bdd\uff0c\u5c31\u8fd4\u56de\u5f00\u59cb\u91cd\u5b9a\u5411\u7684timing.fetchStart\u7684\u503c\u3002\u5176\u4ed6\u60c5\u51b5\uff0c\u5219\u8fd4\u56de0 | |\n| redirectEnd | \u91cd\u5b9a\u5411\u7ed3\u675f\u65f6\u95f4 | \u5982\u679c\u53d1\u751f\u4e86HTTP\u91cd\u5b9a\u5411\uff0c\u5e76\u4e14\u4ece\u5bfc\u822a\u5f00\u59cb\uff0c\u4e2d\u95f4\u7684\u6bcf\u6b21\u91cd\u5b9a\u5411\uff0c\u90fd\u548c\u5f53\u524d\u6587\u6863\u540c\u57df\u7684\u8bdd\uff0c\u5c31\u8fd4\u56de\u6700\u540e\u4e00\u6b21\u91cd\u5b9a\u5411\uff0c\u63a5\u6536\u5230\u6700\u540e\u4e00\u4e2a\u5b57\u8282\u6570\u636e\u540e\u7684\u90a3\u4e2a\u65f6\u95f4.\u5176\u4ed6\u60c5\u51b5\u5219\u8fd4\u56de0 | |\n| fetchStart | \u8d44\u6e90\u83b7\u53d6\u5f00\u59cb\u65f6\u95f4 | \u5982\u679c\u4e00\u4e2a\u65b0\u7684\u8d44\u6e90\u83b7\u53d6\u88ab\u53d1\u8d77\uff0c\u5219 fetchStart\u5fc5\u987b\u8fd4\u56de\u7528\u6237\u4ee3\u7406\u5f00\u59cb\u68c0\u67e5\u5176\u76f8\u5173\u7f13\u5b58\u7684\u90a3\u4e2a\u65f6\u95f4\uff0c\u5176\u4ed6\u60c5\u51b5\u5219\u8fd4\u56de\u5f00\u59cb\u83b7\u53d6\u8be5\u8d44\u6e90\u7684\u65f6\u95f4 | |\n| domainLookupStart | \u57df\u540d\u89e3\u6790\u5f00\u59cb\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u5bf9\u5f53\u524d\u6587\u6863\u6240\u5c5e\u57df\u8fdb\u884cDNS\u67e5\u8be2\u5f00\u59cb\u7684\u65f6\u95f4\u3002\u5982\u679c\u6b64\u8bf7\u6c42\u6ca1\u6709DNS\u67e5\u8be2\u8fc7\u7a0b\uff0c\u5982\u957f\u8fde\u63a5\uff0c\u8d44\u6e90cache,\u751a\u81f3\u662f\u672c\u5730\u8d44\u6e90\u7b49\u3002 \u90a3\u4e48\u5c31\u8fd4\u56de fetchStart\u7684\u503c | |\n| domainLookupEnd | \u57df\u540d\u68c0\u6d4b\u7ed3\u675f\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u5bf9\u7ed3\u675f\u5bf9\u5f53\u524d\u6587\u6863\u6240\u5c5e\u57df\u8fdb\u884cDNS\u67e5\u8be2\u7684\u65f6\u95f4\u3002\u5982\u679c\u6b64\u8bf7\u6c42\u6ca1\u6709DNS\u67e5\u8be2\u8fc7\u7a0b\uff0c\u5982\u957f\u8fde\u63a5\uff0c\u8d44\u6e90cache\uff0c\u751a\u81f3\u662f\u672c\u5730\u8d44\u6e90\u7b49\u3002\u90a3\u4e48\u5c31\u8fd4\u56de fetchStart\u7684\u503c | |\n| connectStart | \u8fde\u63a5\u5f00\u59cb\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u5411\u670d\u52a1\u5668\u670d\u52a1\u5668\u8bf7\u6c42\u6587\u6863\uff0c\u5f00\u59cb\u5efa\u7acb\u8fde\u63a5\u7684\u90a3\u4e2a\u65f6\u95f4\uff0c\u5982\u679c\u6b64\u8fde\u63a5\u662f\u4e00\u4e2a\u957f\u8fde\u63a5\uff0c\u53c8\u6216\u8005\u76f4\u63a5\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u8d44\u6e90\uff08\u5373\u6ca1\u6709\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5\uff09\u3002\u5219\u8fd4\u56dedomainLookupEnd\u7684\u503c | |\n| secureConnectionStart | \u5b89\u5168\u8fde\u63a5\u5f00\u59cb\u65f6\u95f4 | \u53ef\u9009\u7279\u6027\u3002\u7528\u6237\u4ee3\u7406\u5982\u679c\u6ca1\u6709\u5bf9\u5e94\u7684\u4e1c\u4e1c\uff0c\u5c31\u8981\u628a\u8fd9\u4e2a\u8bbe\u7f6e\u4e3aundefined\u3002\u5982\u679c\u6709\u8fd9\u4e2a\u4e1c\u4e1c\uff0c\u5e76\u4e14\u662fHTTPS\u534f\u8bae\uff0c\u90a3\u4e48\u5c31\u8981\u8fd4\u56de\u5f00\u59cbSSL\u63e1\u624b\u7684\u90a3\u4e2a\u65f6\u95f4\u3002 \u5982\u679c\u4e0d\u662fHTTPS\uff0c \u90a3\u4e48\u5c31\u8fd4\u56de0 | HTTPS\u624d\u7edf\u8ba1 |\n| connectEnd | \u8fde\u63a5\u7ed3\u675f\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u5411\u670d\u52a1\u5668\u670d\u52a1\u5668\u8bf7\u6c42\u6587\u6863\uff0c\u5efa\u7acb\u8fde\u63a5\u6210\u529f\u540e\u7684\u90a3\u4e2a\u65f6\u95f4\uff0c\u5982\u679c\u6b64\u8fde\u63a5\u662f\u4e00\u4e2a\u957f\u8fde\u63a5\uff0c\u53c8\u6216\u8005\u76f4\u63a5\u4ece\u7f13\u5b58\u4e2d\u83b7\u53d6\u8d44\u6e90\uff08\u5373\u6ca1\u6709\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5\uff09\u3002\u5219\u8fd4\u56dedomainLookupEnd\u7684\u503c | |\n| requestStart | \u8bf7\u6c42\u5f00\u59cb\u65f6\u95f4 | \u8fd4\u56de\u4ece\u670d\u52a1\u5668\u3001\u7f13\u5b58\u3001\u672c\u5730\u8d44\u6e90\u7b49\uff0c\u5f00\u59cb\u8bf7\u6c42\u6587\u6863\u7684\u65f6\u95f4 | |\n| responseStart | \u56de\u590d\u5f00\u59cb\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u4ece\u670d\u52a1\u5668\u3001\u7f13\u5b58\u3001\u672c\u5730\u8d44\u6e90\u4e2d\uff0c\u63a5\u6536\u5230\u7b2c\u4e00\u4e2a\u5b57\u8282\u6570\u636e\u7684\u65f6\u95f4 | |\n| responseEnd | \u56de\u590d\u7ed3\u675f\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u63a5\u6536\u5230\u6700\u540e\u4e00\u4e2a\u5b57\u7b26\u7684\u65f6\u95f4\uff0c\u548c\u5f53\u524d\u8fde\u63a5\u88ab\u5173\u95ed\u7684\u65f6\u95f4\u4e2d\uff0c\u66f4\u65e9\u7684\u90a3\u4e2a\u3002\u540c\u6837\uff0c\u6587\u6863\u53ef\u80fd\u6765\u81ea\u670d\u52a1\u5668\u3001\u7f13\u5b58\u3001\u6216\u672c\u5730\u8d44\u6e90 | |\n| domLoading | DOM\u5f00\u59cb\u65f6\u95f4 | \u5f00\u59cb\u6e32\u67d3dom\u7684\u65f6\u95f4 , \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u628a\u5176\u6587\u6863\u7684 \"current document readiness\" \u8bbe\u7f6e\u4e3a \"loading\"\u7684\u65f6\u5019 | |\n| domInteractive | DOM\u4ea4\u4e92\u65f6\u95f4 | \u5f00\u59cb\u53ef\u4ee5\u8fdb\u884cdom\u4ea4\u4e92\u7684\u65f6\u95f4\uff0c\u8fd4\u56de\u7528\u6237\u4ee3\u7406\u628a\u5176\u6587\u6863\u7684 \"current document readiness\" \u8bbe\u7f6e\u4e3a \"interactive\"\u7684\u65f6\u5019. | |\n| domContentLoadedEventStart | DOM\u5185\u5bb9\u52a0\u8f7d\u5f00\u59cb\u65f6\u95f4 | \u8fd4\u56de\u6587\u6863\u53d1\u751f DOMContentLoaded \u4e8b\u4ef6\u7684\u65f6\u95f4 | |\n| domContentLoadedEventEnd | DOM\u5185\u5bb9\u52a0\u8f7d\u7ed3\u675f\u65f6\u95f4 | \u8fd4\u56de\u6587\u6863 DOMContentLoaded \u4e8b\u4ef6\u7684\u7ed3\u675f\u65f6\u95f4 | |\n| domComplete | DOM\u7ed3\u675f\u65f6\u95f4 | \u8fd4\u56de\u7528\u6237\u4ee3\u7406\u628a\u5176\u6587\u6863\u7684 \"current document readiness\" \u8bbe\u7f6e\u4e3a \"complete\"\u7684\u65f6\u5019 | |\n| loadEventStart | LOAD\u5f00\u59cb\u65f6\u95f4 | \u6587\u6863\u89e6\u53d1load\u4e8b\u4ef6\u7684\u65f6\u95f4\u3002\u5982\u679cload\u4e8b\u4ef6\u6ca1\u6709\u89e6\u53d1\uff0c\u90a3\u4e48\u8be5\u63a5\u53e3\u5c31\u8fd4\u56de0 | |\n| loadEventEnd | LOAD\u7ed3\u675f\u65f6\u95f4 | \u6587\u6863\u89e6\u53d1load\u4e8b\u4ef6\u7ed3\u675f\u540e\u7684\u65f6\u95f4\u3002\u5982\u679cload\u4e8b\u4ef6\u6ca1\u6709\u89e6\u53d1\uff0c\u90a3\u4e48\u8be5\u63a5\u53e3\u5c31\u8fd4\u56de0 | |\n\n#### timing \u8ba1\u7b97\u516c\u5f0f\n\n\u5ba2\u6237\u7aef\u53ea\u8fd4\u56de\u539f\u59cb\u7684\u6570\u636e\uff0c\u670d\u52a1\u5668\u7aef\u5bf9\u7ed3\u679c\u8fdb\u884c\u8ba1\u7b97\uff0c\u5e76\u5b58\u50a8\u5230ES\u4e2d\n\n| \u65f6\u95f4 | \u8ba1\u7b97\u516c\u5f0f | \u8bf4\u660e |\n| -------- | ------------------------------------- | ---------------------------------------- |\n| \u603b\u65f6\u95f4 | loadEventEnd - navigationStart | |\n| \u91cd\u5b9a\u5411\u65f6\u95f4 | redirectEnd - redirectStart | |\n| \u57df\u540d\u89e3\u6790\u65f6\u95f4 | domainLookupEnd - domainLookupStart | |\n| TCP\u8fde\u63a5\u65f6\u95f4 | connectEnd - connectStart | |\n| SSL\u8fde\u63a5\u65f6\u95f4 | connectEnd - secureConnectionStart | \u53ea\u5bf9HTTTPS\u6709\u6548 |\n| \u8bf7\u6c42\u65f6\u95f4 | responseStart - requestStart | |\n| \u56de\u590d\u65f6\u95f4 | responseEnd - responseStart | |\n| DOM\u89e3\u6790\u65f6\u95f4 | domContentLoadedEventEnd - domLoading | |\n| LOAD\u4e8b\u4ef6\u65f6\u95f4 | loadEventEnd - loadEventStart | |\n| | | |\n| \u9996\u5b57\u8282\u65f6\u95f4 | responseStart - navigationStart | TTFB \u5373 Time To First Byte \u7684\u610f\u601d, \u8bfb\u53d6\u9875\u9762\u7b2c\u4e00\u4e2a\u5b57\u8282\u7684\u65f6\u95f4, \u4e5f\u53eb\u505a\u767d\u5c4f\u65f6\u95f4 |\n\n##### \u7518\u7279\u56fe\u8bf4\u660e\n\n\u603b\u65f6\u95f4 = \u91cd\u5b9a\u5411\u65f6\u95f4 + \u57df\u540d\u89e3\u6790\u65f6\u95f4 + TCP\u8fde\u63a5\u65f6\u95f4 + \u8bf7\u6c42\u65f6\u95f4 + \u56de\u590d\u65f6\u95f4 + DOM\u89e3\u6790\u65f6\u95f4 + LOAD\u4e8b\u4ef6\u65f6\u95f4\n\n#### resources\n\n\u8fd4\u56de\u6240\u6709\u7684\u8d44\u6e90\u4fe1\u606f\uff0c\u683c\u5f0f\u5f0fjson\uff0c\u5b9a\u4e49\u5982\u4e0b\n\n```\n{\n \"resource1\": {},\n \"resource2\": {},\n ...\n}\n```\n\n\u6bcf\u4e2a\u5355\u72ec\u7684\u8d44\u6e90\u4fe1\u606f\u5982\u4e0b\n\n| name | \u540d\u79f0 | \u8bf4\u660e | \u663e\u793a |\n| --------------------- | -------- | ---------------------------------------- | --------- |\n| statusCode | \u72b6\u6001\u7801 | \u6682\u65f6\u5f97\u4e0d\u5230\u76f8\u5173\u4fe1\u606f | |\n| initiatorType | \u8d44\u6e90\u7c7b\u578b | \u4ee3\u8868\u4e86\u8d44\u6e90\u7c7b\u578b | |\n| startTime | \u5f00\u59cb\u65f6\u95f4 | \u83b7\u53d6\u8d44\u6e90\u7684\u5f00\u59cb\u65f6\u95f4 | |\n| fetchStart | \u5f00\u59cb\u65f6\u95f4 | \u4e0estartTime\u76f8\u540c | |\n| redirectStart | \u91cd\u5b9a\u5411\u5f00\u59cb\u65f6\u95f4 | | |\n| redirectEnd | \u91cd\u5b9a\u5411\u7ed3\u675f\u65f6\u95f4 | | |\n| domainLookupStart | \u57df\u540d\u89e3\u6790\u5f00\u59cb\u65f6\u95f4 | | |\n| domainLookupEnd | \u57df\u540d\u89e3\u6790\u7ed3\u675f\u65f6\u95f4 | | |\n| connectStart | \u8fde\u63a5\u5f00\u59cb\u65f6\u95f4 | \u6d4f\u89c8\u5668\u5f00\u59cb\u548c\u670d\u52a1\u5668\u5efa\u7acb\u8fde\u63a5\u7684\u65f6\u95f4 | |\n| secureConnectionStart | \u5b89\u5168\u8fde\u63a5\u5f00\u59cb\u65f6\u95f4 | \u6d4f\u89c8\u5668\u5728\u5f53\u524d\u8fde\u63a5\u4e0b\uff0c\u5f00\u59cb\u4e0e\u670d\u52a1\u5668\u5efa\u7acb\u5b89\u5168\u63e1\u624b\u7684\u65f6\u95f4 | \u4ec5\u5bf9HTTPS\u6709\u6548 |\n| requestStart | \u8bf7\u6c42\u5f00\u59cb\u65f6\u95f4 | | |\n| responseStart | \u56de\u590d\u5f00\u59cb\u65f6\u95f4 | | |\n| responseEnd | \u56de\u590d\u7ed3\u675f\u65f6\u95f4 | | |\n| transferSize | \u8d44\u6e90\u5927\u5c0f | \u83b7\u53d6\u8d44\u6e90\u7684\u5927\u5c0f(\u91c7\u7528\u516b\u8fdb\u5236, \u8bf7\u6ce8\u610f\u8f6c\u6362), \u5927\u5c0f\u5305\u542b\u4e86response\u5934\u90e8\u548c\u5b9e\u4f53 | |\n| encodedBodySize | | \u8868\u793a\u4ece HTTP \u7f51\u7edc\u6216\u7f13\u5b58\u4e2d\u63a5\u6536\u5230\u7684\u6709\u6548\u5185\u5bb9\u4e3b\u4f53 (Payload Body) \u7684\u5927\u5c0f(\u5728\u5220\u9664\u6240\u6709\u5e94\u7528\u5185\u5bb9\u7f16\u7801\u4e4b\u524d) | |\n| decodedBodySize | | \u8868\u793a\u4ece HTTP \u7f51\u7edc\u6216\u7f13\u5b58\u4e2d\u63a5\u6536\u5230\u7684\u6d88\u606f\u4e3b\u4f53 (Message Body) \u7684\u5927\u5c0f(\u5728\u5220\u9664\u6240\u6709\u5e94\u7528\u5185\u5bb9\u7f16\u7801\u4e4b\u540e) | |\n\n##### resource \u8ba1\u7b97\u516c\u5f0f\n\n\u5ba2\u6237\u7aef\u53ea\u8fd4\u56de\u539f\u59cb\u7684\u6570\u636e\uff0c\u670d\u52a1\u5668\u7aef\u5bf9\u7ed3\u679c\u8fdb\u884c\u8ba1\u7b97\uff0c\u5e76\u5b58\u50a8\u5230ES\u4e2d\n\n| \u65f6\u95f4 | \u8ba1\u7b97\u516c\u5f0f | \u8bf4\u660e |\n| ------- | ----------------------------------- | ----------- |\n| \u603b\u65f6\u95f4 | responseEnd- navigationStart | \u6216\u8005 duration |\n| \u91cd\u5b9a\u5411\u65f6\u95f4 | redirectEnd - redirectStart | |\n| \u57df\u540d\u89e3\u6790\u65f6\u95f4 | domainLookupEnd - domainLookupStart | |\n| TCP\u8fde\u63a5\u65f6\u95f4 | connectEnd - connectStart | |\n| SSL\u8fde\u63a5\u65f6\u95f4 | connectEnd - secureConnectionStart | \u53ea\u5bf9HTTTPS\u6709\u6548 |\n| \u8bf7\u6c42\u65f6\u95f4 | responseStart - requestStart | |\n| \u56de\u590d\u65f6\u95f4 | responseEnd - responseStart | |\n| | | |\n\n##### \u7518\u7279\u56fe\u8bf4\u660e\n\n\u603b\u65f6\u95f4 = \u91cd\u5b9a\u5411\u65f6\u95f4 + \u57df\u540d\u89e3\u6790\u65f6\u95f4 + TCP\u8fde\u63a5\u65f6\u95f4 + \u8bf7\u6c42\u65f6\u95f4 + \u56de\u590d\u65f6\u95f4\n\n", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/creditease-natrix/natrixclient", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/creditease-natrix/natrixclient", "keywords": "", "license": "", "maintainer": "JamesZOU", "maintainer_email": "zouzhicheng@foxmail.com", "name": "natrixclient", "package_url": "https://pypi.org/project/natrixclient/", "platform": "RedHat", "project_url": "https://pypi.org/project/natrixclient/", "project_urls": { "Download": "https://github.com/creditease-natrix/natrixclient", "Homepage": "https://github.com/creditease-natrix/natrixclient" }, "release_url": "https://pypi.org/project/natrixclient/0.1.3/", "requires_dist": [ "requests (>=2.18.4)", "selenium (>=3.14.0)", "pika (>=0.12.0)", "python-hosts (>=0.4.5)", "apscheduler (>=3.5.3)", "dnspython (>=1.15.0)", "psutil (>=5.4.8)", "netifaces (>=0.10.7)", "distro (>=1.3.0)", "pycurl (>=7.43.0.2)", "python-crontab (>=2.3.6)", "enum34 (>=1.1.6)" ], "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "summary": "Client For Natrix - An Open Source Cloud Automation Testing Project", "version": "0.1.3" }, "last_serial": 5355350, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "0bacff7b4b6eefa193486009367806e8", "sha256": "16dfee8022054fcafae14f26958e85c665a1526e99a4eb2d9a0b1b8b4a43ee76" }, "downloads": -1, "filename": "natrixclient-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0bacff7b4b6eefa193486009367806e8", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 3151161, "upload_time": "2019-04-02T10:05:22", "url": "https://files.pythonhosted.org/packages/8b/a8/b265d6594b62b82541b8a314301642254e97e848c34884eff4f61850ed1e/natrixclient-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "043fb44d3b25a80cabf389772e769e6c", "sha256": "bdde48e81ac2bdd84d7513f94b619d6858228cbcac0defdf5ffd33a0bf14c54f" }, "downloads": -1, "filename": "natrixclient-0.1.2.tar.gz", "has_sig": false, "md5_digest": "043fb44d3b25a80cabf389772e769e6c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", "size": 3005690, "upload_time": "2019-04-02T10:05:36", "url": "https://files.pythonhosted.org/packages/da/06/2cc04a1e6aa39f2131f07b1d13f4610bf76e6e9a737f04c5c7f1e29f98ed/natrixclient-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c7b10b64592eb11b1c37d7668ffd0226", "sha256": "c09111d08e5d51460b2f5cb630e870bde0b342a78c0b2c549fcf85ffb17b74be" }, "downloads": -1, "filename": "natrixclient-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "c7b10b64592eb11b1c37d7668ffd0226", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 3006174, "upload_time": "2019-04-12T03:04:24", "url": "https://files.pythonhosted.org/packages/04/92/cbd96038378e045fcfa853bb9b43a5623d12a06f6f6f06efe2e1cd8b1405/natrixclient-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "40f9d04269adee60953c376fe2d1ce5d", "sha256": "f17659d1474b05fb00e8c93aecdbe3e24fe2c84eeeeda2ff7caea02de7f68249" }, "downloads": -1, "filename": "natrixclient-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "40f9d04269adee60953c376fe2d1ce5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 2990136, "upload_time": "2019-04-12T03:05:42", "url": "https://files.pythonhosted.org/packages/aa/a6/9d6dc57a2729563cd360246d47ad530bd637a037138510f6ccabc805ec70/natrixclient-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f493a5b7827c71f30c9f4c02a66c8e25", "sha256": "bcb6d4e594605a8dca586c33faecb564cd2ab27a9e8380006a8dc55b4f551dd9" }, "downloads": -1, "filename": "natrixclient-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f493a5b7827c71f30c9f4c02a66c8e25", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 3007094, "upload_time": "2019-04-12T03:05:59", "url": "https://files.pythonhosted.org/packages/46/f5/454bb16c4e19e890cbcf75ff74aaf9204609b4d29fa906e1b6b43f3d235e/natrixclient-0.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c7b10b64592eb11b1c37d7668ffd0226", "sha256": "c09111d08e5d51460b2f5cb630e870bde0b342a78c0b2c549fcf85ffb17b74be" }, "downloads": -1, "filename": "natrixclient-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "c7b10b64592eb11b1c37d7668ffd0226", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 3006174, "upload_time": "2019-04-12T03:04:24", "url": "https://files.pythonhosted.org/packages/04/92/cbd96038378e045fcfa853bb9b43a5623d12a06f6f6f06efe2e1cd8b1405/natrixclient-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "40f9d04269adee60953c376fe2d1ce5d", "sha256": "f17659d1474b05fb00e8c93aecdbe3e24fe2c84eeeeda2ff7caea02de7f68249" }, "downloads": -1, "filename": "natrixclient-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "40f9d04269adee60953c376fe2d1ce5d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 2990136, "upload_time": "2019-04-12T03:05:42", "url": "https://files.pythonhosted.org/packages/aa/a6/9d6dc57a2729563cd360246d47ad530bd637a037138510f6ccabc805ec70/natrixclient-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f493a5b7827c71f30c9f4c02a66c8e25", "sha256": "bcb6d4e594605a8dca586c33faecb564cd2ab27a9e8380006a8dc55b4f551dd9" }, "downloads": -1, "filename": "natrixclient-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f493a5b7827c71f30c9f4c02a66c8e25", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7,!=3.0.*,!=3.1.*", "size": 3007094, "upload_time": "2019-04-12T03:05:59", "url": "https://files.pythonhosted.org/packages/46/f5/454bb16c4e19e890cbcf75ff74aaf9204609b4d29fa906e1b6b43f3d235e/natrixclient-0.1.3.tar.gz" } ] }