# arguments:
        # local object referring to the Resource in IoTCC on which the metric should be associated
        # metric name
        # unit = An SI Unit (work needed here)
        # sampling_interval = the interval in seconds between called to the user function to obtain the next value for the metric
        # aggregation_size = the number of values collected in a cycle before publishing to DCC
        # value = user defined function to obtain the next value from the device associated with this metric
        cpu_utilization_metric = Metric(
            name="CPU Utilization",
            unit=None,
            interval=10,
            aggregation_size=2,
            sampling_function=read_cpu_utilization
        )
        reg_cpu_utilization_metric = iotcc.register(cpu_utilization_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_utilization_metric)
        # call to start collecting values from the device or system and sending to the data center component
        reg_cpu_utilization_metric.start_collecting()

        cpu_procs_metric = Metric(
            name="CPU Process",
            unit=None,
            interval=6,
            aggregation_size=8,
            sampling_function=read_cpu_procs
        )
        reg_cpu_procs_metric = iotcc.register(cpu_procs_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_procs_metric)
        reg_cpu_procs_metric.start_collecting()

        disk_usage_metric = Metric(
예제 #2
0
        # ---------- Create metrics 'on' the Resource in IoTCC representing the IoT System
        # arguments:
        # local object referring to the Resource in IoTCC on which the metric should be associated
        # metric name
        # unit = An SI Unit (work needed here)
        # sampling_interval = the interval in seconds between called to the user function to obtain the next value for the metric
        # aggregation_size = the number of values collected in a cycle before publishing to DCC
        # value = user defined function to obtain the next value from the device associated with this metric
        cpu_utilization_metric = Metric(name="CPU Utilization",
                                        unit=None,
                                        interval=10,
                                        aggregation_size=2,
                                        sampling_function=read_cpu_utilization)
        reg_cpu_utilization_metric = iotcc.register(cpu_utilization_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_utilization_metric)
        # call to start collecting values from the device or system and sending to the data center component
        reg_cpu_utilization_metric.start_collecting()

        cpu_procs_metric = Metric(name="CPU Process",
                                  unit=None,
                                  interval=6,
                                  aggregation_size=8,
                                  sampling_function=read_cpu_procs)
        reg_cpu_procs_metric = iotcc.register(cpu_procs_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_procs_metric)
        reg_cpu_procs_metric.start_collecting()

        disk_usage_metric = Metric(name="Disk Usage Stats",
                                   unit=None,
                                   interval=6,
        # ---------- Create metrics 'on' the Resource in IoTCC representing the IoT System
        # arguments:
        # local object referring to the Resource in IoTCC on which the metric should be associated
        # metric name
        # unit = An SI Unit (work needed here)
        # sampling_interval = the interval in seconds between called to the user function to obtain the next value for the metric
        # aggregation_size = the number of values collected in a cycle before publishing to DCC
        # value = user defined function to obtain the next value from the device associated with this metric
        cpu_utilization_metric = Metric(name="CPU Utilization",
                                        unit=None,
                                        interval=10,
                                        aggregation_size=2,
                                        sampling_function=read_cpu_utilization)
        reg_cpu_utilization_metric = iotcc.register(cpu_utilization_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_utilization_metric)
        # call to start collecting values from the device or system and sending to the data center component
        reg_cpu_utilization_metric.start_collecting()

        cpu_procs_metric = Metric(name="CPU Process",
                                  unit=None,
                                  interval=6,
                                  aggregation_size=8,
                                  sampling_function=read_cpu_procs)
        reg_cpu_procs_metric = iotcc.register(cpu_procs_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_procs_metric)
        reg_cpu_procs_metric.start_collecting()

        disk_usage_metric = Metric(name="Disk Usage Stats",
                                   unit=None,
                                   interval=6,
예제 #4
0
        # argument is the name of this Edge System
        edge_system = Dk300EdgeSystem(config['EdgeSystemName'])

        # resister the Edge System with the IoTCC instance
        # this call creates a representation (a Resource) in IoTCC for this IoT System with the name given
        reg_edge_system = iotcc.register(edge_system)

        # these call set properties on the Resource representing the IoT System
        # properties are a key:value store
        reg_edge_system.set_properties(config['SystemPropList'])

        # create the device object and register it on IoTCC
        thermistor_model = ThermistorSimulated(name=config['DeviceName'], ureg=ureg)

        reg_thermistor_model = iotcc.register(thermistor_model)
        iotcc.create_relationship(reg_edge_system, reg_thermistor_model)

        reg_thermistor_model.set_properties(config['DevicePropList'])

        metric_name = "model.thermistor.temperature"
        thermistor_temper = Metric(
            name=metric_name,
            unit=ureg.degC,
            interval=5,
            sampling_function=get_thermistor_temperature
        )
        reg_thermistor_temper = iotcc.register(thermistor_temper)
        iotcc.create_relationship(reg_thermistor_model, reg_thermistor_temper)
        reg_thermistor_temper.start_collecting()

    except RegistrationFailure:
        # arguments:
        # local object referring to the Resource in IoTCC on which the metric should be associated
        # metric name
        # unit = An SI Unit (work needed here)
        # sampling_interval = the interval in seconds between called to the user function to obtain the next value for the metric
        # aggregation_size = the number of values collected in a cycle before publishing to DCC
        # value = user defined function to obtain the next value from the device associated with this metric
        cpu_utilization_metric = Metric(
            name="CPU Utilization",
            unit=None,
            interval=10,
            aggregation_size=2,
            sampling_function=read_cpu_utilization
        )
        reg_cpu_utilization_metric = iotcc.register(cpu_utilization_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_utilization_metric)
        # call to start collecting values from the device or system and sending to the data center component
        reg_cpu_utilization_metric.start_collecting()

        cpu_procs_metric = Metric(
            name="CPU Process",
            unit=None,
            interval=6,
            aggregation_size=8,
            sampling_function=read_cpu_procs
        )
        reg_cpu_procs_metric = iotcc.register(cpu_procs_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_procs_metric)
        reg_cpu_procs_metric.start_collecting()

        disk_usage_metric = Metric(
예제 #6
0
        edge_system = Dk300EdgeSystem(config['EdgeSystemName'])

        # resister the Edge System with the IoTCC instance
        # this call creates a representation (a Resource) in IoTCC for this IoT System with the name given
        reg_edge_system = iotcc.register(edge_system)

        # these call set properties on the Resource representing the IoT System
        # properties are a key:value store
        reg_edge_system.set_properties(config['SystemPropList'])

        # create the device object and register it on IoTCC
        thermistor_model = ThermistorSimulated(name=config['DeviceName'],
                                               ureg=ureg)

        reg_thermistor_model = iotcc.register(thermistor_model)
        iotcc.create_relationship(reg_edge_system, reg_thermistor_model)

        reg_thermistor_model.set_properties(config['DevicePropList'])

        metric_name = "model.thermistor.temperature"
        thermistor_temper = Metric(
            name=metric_name,
            unit=ureg.degC,
            interval=5,
            sampling_function=get_thermistor_temperature)
        reg_thermistor_temper = iotcc.register(thermistor_temper)
        iotcc.create_relationship(reg_thermistor_model, reg_thermistor_temper)
        reg_thermistor_temper.start_collecting()

    except RegistrationFailure:
        print "Registration to IOTCC failed"
예제 #7
0
    try:

        # Register Edge System with IoT control center
        reg_edge_system = iotcc.register(edge_system)

        # these call set properties on the Resource representing the IoT System
        # properties are a key:value store
        reg_edge_system.set_properties(config['SystemPropList'])

        # Create kitchen device object and register it on IoTCC
        # Add two device names in the configurations as DeviceName1 and DeviceName2
        kitchen_temperature_device = SimulatedDevice(name=config['DeviceName1'])
        reg_kitchen_temperature_device = iotcc.register(kitchen_temperature_device)

        iotcc.create_relationship(reg_edge_system, reg_kitchen_temperature_device)
        reg_kitchen_temperature_device.set_properties(config['DevicePropList'])

        # Metric Name
        metric_name_kitchen_temperature = "temperature.kitchen"

        # Create metric for kitchen temperature
        kitchen_temperature = Metric(
            name=metric_name_kitchen_temperature,
            unit=ureg.degC,
            interval=0,
            sampling_function=lambda: get_value(kitchen_temperature_data)
        )

        reg_kitchen_temp = iotcc.register(kitchen_temperature)
        iotcc.create_relationship(reg_kitchen_temperature_device, reg_kitchen_temp)
예제 #8
0
        # argument is the name of this Edge System
        edge_system = Dk300EdgeSystem(config['EdgeSystemName'])

        # resister the Edge System with the IoTCC instance
        # this call creates a representation (a Resource) in IoTCC for this IoT System with the name given
        reg_edge_system = iotcc.register(edge_system)

        # these call set properties on the Resource representing the IoT System
        # properties are a key:value store
        reg_edge_system.set_properties(config['SystemPropList'])

        # create the device object and register it on IoTCC
        bike_model = BikeSimulated(name=config['DeviceName'], ureg=ureg)

        reg_bike_model = iotcc.register(bike_model)
        iotcc.create_relationship(reg_edge_system, reg_bike_model)

        reg_bike_model.set_properties(config['DevicePropList'])

        # Publish bike speed metrics to IoTCC
        metric_name_bike_speed = "model.bike.speed"
        bike_speed = Metric(
            name=metric_name_bike_speed,
            unit=(ureg.m / ureg.sec),
            interval=5,
            sampling_function=get_bike_speed
        )
        reg_bike_speed = iotcc.register(bike_speed)
        iotcc.create_relationship(reg_bike_model, reg_bike_speed)
        reg_bike_speed.start_collecting()
        reg_edge_system = iotcc.register(edge_system)

        # these call set properties on the Resource representing the IoT System
        # properties are a key:value store
        reg_edge_system.set_properties(config['SystemPropList'])

        # Operational metrics of EdgeSystem
        cpu_utilization_metric = Metric(
            name="CPU Utilization",
            unit=None,
            interval=10,
            aggregation_size=2,
            sampling_function=read_cpu_utilization
        )
        reg_cpu_utilization_metric = iotcc.register(cpu_utilization_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_utilization_metric)
        # call to start collecting values from the device or system and sending to the data center component
        reg_cpu_utilization_metric.start_collecting()

        cpu_procs_metric = Metric(
            name="CPU Process",
            unit=None,
            interval=6,
            aggregation_size=8,
            sampling_function=read_cpu_procs
        )
        reg_cpu_procs_metric = iotcc.register(cpu_procs_metric)
        iotcc.create_relationship(reg_edge_system, reg_cpu_procs_metric)
        reg_cpu_procs_metric.start_collecting()

        mem_free_metric = Metric(