コード例 #1
0
 def __get_arithmos_entity_id(self, arithmos_entity_type, primary_entity):
     """
 Gets the arithmos specific entity id based on arithmos_entity_type and
 primary_entity
 Args:
   arithmos_entity_type(str): arithmos_entity_type
   primary_entity(str): primary_entity
 Returns:
   entity_id(str)
 """
     entity_proto = DataExchangeProto.EntityProto()
     entity_proto.type = arithmos_entity_type
     identifier = entity_proto.identifiers.add()
     identifier.key_name = primary_entity.member_name
     if safe_has_field(primary_entity.member_value, "bool_value"):
         identifier.bool_value = primary_entity.member_value.bool_value
     if safe_has_field(primary_entity.member_value, "int64_value"):
         identifier.int_value = primary_entity.member_value.int64_value
     if safe_has_field(primary_entity.member_value, "string_value"):
         identifier.string_value = primary_entity.member_value.string_value
     log.INFO(entity_proto)
     entity_id = (HealthServerGlobals().get_arithmos_interface().
                  get_entity_id(entity_proto))
     return entity_id
コード例 #2
0
import util.ncc.config_module.config as config

from util.ncc.data_access.data_interface import *

from util.ncc.config_module.config import *
from util.ncc.ncc_utils.globals import HealthServerGlobals
from serviceability.interface.plugin_schema_pb2 import *
from google.protobuf import text_format
import datetime
import time
import math
import copy
import os
import json

hglobals = HealthServerGlobals()
idf = hglobals.get_insights_da()
options = {"create_entity": True}

print "begin writing capacity data"

current_time = int(round(time.time()))
april_25 = "04/25/2019"
time_delta = int(
    round(time.time()) -
    time.mktime(datetime.datetime.strptime(april_25, "%m/%d/%Y").timetuple()))

all_files = {}

for entity_type, _, entity_files in os.walk(".", topdown=False):
    if entity_type == "." or "xfit" in entity_type or "vm" in entity_type: