diff --git a/README.md b/README.md index 6a8ad7d..29046cc 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ bin/kafka-topics.sh \ --create \ --zookeeper zookeeper-node1:2181,zookeeper-node2:2181,zookeeper-node3:2181 \ --replication-factor 3 \ - --partitions 1 \ + --partitions 6 \ --topic yao ``` diff --git a/agent.py b/agent.py index 2c536ea..28f3619 100644 --- a/agent.py +++ b/agent.py @@ -22,6 +22,9 @@ ClientHost = os.getenv('ClientHost', "localhost") ClientExtHost = os.getenv('ClientExtHost', "localhost") KafkaBrokers = os.getenv('KafkaBrokers', 'localhost:9092').split(',') +RackID = os.getenv('RackID', "default") +DomainID = os.getenv('DomainID', "default") + PORT = int(os.getenv('Port', 8000)) HeartbeatInterval = int(os.getenv('HeartbeatInterval', 5)) @@ -350,6 +353,8 @@ def report_msg(stats): mem = psutil.virtual_memory() post_fields = { 'id': ClientID, + 'rack': RackID, + 'domain': DomainID, 'host': ClientHost, 'status': stats, 'cpu_num': multiprocessing.cpu_count(), diff --git a/mock.py b/mock.py index 3c8d760..92a65a8 100644 --- a/mock.py +++ b/mock.py @@ -90,7 +90,7 @@ def report(ClientID): stats = [] for i in range(0, 4): stat = { - 'uuid': 'UUID-' + str(i), + 'uuid': 'UUID-' + ClientID + '-' + str(i), 'product_name': 'K80', 'performance_state': 'P0', 'memory_total': 11260, @@ -106,6 +106,8 @@ def report(ClientID): post_fields = { 'id': ClientID, + 'rack': ClientHost, + 'domain': ClientHost, 'host': ClientHost, 'status': stats, 'cpu_num': 64,