Пример #1
0
    ## cores: RAPL_ENERGY_PKG and/or RAPL_ENERGY_CORES
    ## dram: RAPL_ENERGY_DRAM
    ## integrated gpu: RAPL_ENERGY_GPU
    ## -e TSC -e APERF -e MPERF
    e = Energy(sensors=roles['calibrate'],
               mongos=roles['calibrate'],
               formulas=roles['calibrate'],
               influxdbs=roles['calibrate'],
               grafana=roles['calibrate'],
               monitor={
                   'dram': True,
                   'cores': False,
                   'gpu': False
               })

    e.deploy()

    ## #B check if everything has deployed well
    local_sensor_logs = './_tmp_enos_/sensor-logs'
    remote_sensor_logs = 'tmp/sensor-logs'
    ## #1 remove outdated data

    localDirLogs = Path(f"{local_sensor_logs}/{roles['calibrate'][0].address}")

    if localDirLogs.exists() and localDirLogs.is_dir():
        shutil.rmtree(localDirLogs)

    ## #2 retrieve new data
    with play_on(pattern_hosts='calibrate', roles=roles) as p:
        p.shell(
            f'sudo docker container logs powerapi-sensor > /{remote_sensor_logs}'
Пример #2
0
roles, networks = provider.init()

roles = discover_networks(roles, networks)

## #A deploy the energy monitoring stack
m = Energy(sensors=roles['compute'],
           mongos=roles['control'],
           formulas=roles['control'],
           influxdbs=roles['control'],
           grafana=roles['control'],
           monitor={
               'dram': True,
               'cores': True
           })

m.deploy()

ui_address = roles['control'][0].extra['my_network_ip']
print("Grafana is available at http://%s:3000" % ui_address)
print("user=admin, password=admin")

## #B deploy a service
with play_on(pattern_hosts='compute', roles=roles) as p:
    p.docker_image(  #source='load', # Added in ansible 2.8
        name='meow-world',
        tag='latest',
        load_path='/home/brnedelec/meow-world_latest.tar'
    )  ## (TODO) automatic or configurable

with play_on(pattern_hosts='compute',
             roles=roles,