#!/usr/bin/env python import sys, time, json from rubriker import Rubriker from config import rubrik_locations print "This will add the provided VM to the selected SLA." location_names = rubrik_locations.keys() index = 1 if len(sys.argv) > 1: location_name = sys.argv[1] quiet = True else: location_names = rubrik_locations.keys() index = 1 for location_name in location_names: print "%d. %s" % (index, location_name) index += 1 index = int(raw_input("Choose a Rubrik cluster: ")) - 1 location_name = location_names[index] config_dict = rubrik_locations[location_name] rubriker = Rubriker(location_name, config_dict["rubrik_user"], config_dict["rubrik_pass"], config_dict["rubrik_url"]) vm_names = [] if len(sys.argv) > 3: vm_names = sys.argv[3:] else: vm_names[0] = raw_input("Enter VM name: ")
# These API calls fail, probably new or deprecated feature #send_singleton_stat("replication.managed_physical_storage", "stats/replicated/managedPhysicalStorage") #send_singleton_stat("replication.used_physical_storage", "stats/replicated/physicalStorage") send_storage_stats(rubriker) send_cross_compression_stats(rubriker) send_storage_and_compression_stats(rubriker) send_sla_stats(rubriker) send_replication_storage_stats(rubriker) send_archival_storage_stats(rubriker) send_organization_stats(rubriker) print datetime.now() for location in rubrik_locations.keys(): try: config_dict = rubrik_locations[location] rubrik_user = config_dict["rubrik_user"] rubrik_pass = config_dict["rubrik_pass"] rubrik_url = config_dict["rubrik_url"] rubriker = Rubriker(location, rubrik_user, rubrik_pass, rubrik_url) send_all_data(rubriker) except: print "Failed to gather data for location %s" % location finally: try: rubriker.logout_of_api() except: print "Failed to log out of Rubrik at %s" % location