Skip to content

Commit

Permalink
Merge "Use configured IP to fetch UVEs from the Analytics API" into R…
Browse files Browse the repository at this point in the history
…2.21.x
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 17, 2016
2 parents 62bed29 + 0b86515 commit ca32fe5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/opserver/analytics_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,15 +325,15 @@ def db_purge(self, purge_cutoff, purge_id):
return (total_rows_deleted, purge_error_details)
# end db_purge

def get_dbusage_info(self, rest_api_port):
def get_dbusage_info(self, rest_api_ip, rest_api_port):
"""Collects database usage information from all db nodes
Returns:
A dictionary with db node name as key and db usage in % as value
"""

to_return = {}
try:
uve_url = "http://127.0.0.1:" + str(rest_api_port) + "/analytics/uves/database-nodes?cfilt=DatabaseUsageInfo"
uve_url = "http://" + rest_api_ip + ":" + str(rest_api_port) + "/analytics/uves/database-nodes?cfilt=DatabaseUsageInfo"
node_dburls = json.loads(urllib2.urlopen(uve_url).read())

for node_dburl in node_dburls:
Expand Down
4 changes: 3 additions & 1 deletion src/opserver/opserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,9 @@ def _auto_purge(self):
# continuously monitor and purge
while True:
trigger_purge = False
db_node_usage = self._analytics_db.get_dbusage_info(self._args.rest_api_port)
db_node_usage = self._analytics_db.get_dbusage_info(
self._args.rest_api_ip,
self._args.rest_api_port)
self._logger.info("node usage:" + str(db_node_usage) )
self._logger.info("threshold:" + str(self._args.db_purge_threshold))

Expand Down

0 comments on commit ca32fe5

Please sign in to comment.