Beispiel #1
0
from himlarcli import utils as himutils

himutils.is_virtual_env()

# Load parser config from config/parser/*
parser = Parser()
options = parser.parse_args()

ksclient = Keystone(options.config, debug=options.debug)
ksclient.set_domain('Dataporten')
logger = ksclient.get_logger()
printer = Printer(options.format)

# Regions
regions = himutils.load_region_config('config/stats',
                                      region=ksclient.region,
                                      log=logger)
""" ACTIONS """

def project():
    stats = {'demo': 0,
             'personal': 0,
             'research': 0,
             'education': 0,
             'admin': 0,
             'test': 0,
             'total': 0}
    for name in sorted(regions['regions'].iterkeys()):
        logger.debug('=> count region %s' % name)
        novaclient = Nova(options.config, debug=options.debug, log=logger, region=name)
        instances = novaclient.get_instances()
Beispiel #2
0
from himlarcli import utils as himutils

himutils.is_virtual_env()

# Load parser config from config/parser/*
parser = Parser()
options = parser.parse_args()

ksclient = Keystone(options.config, debug=options.debug)
ksclient.set_domain('Dataporten')
logger = ksclient.get_logger()
printer = Printer(options.format)

# Regions
regions = himutils.load_region_config('config/stats',
                                      region=ksclient.region,
                                      log=logger)
""" ACTIONS """


def project():
    stats = {
        'demo': 0,
        'personal': 0,
        'research': 0,
        'education': 0,
        'admin': 0,
        'test': 0,
        'hpc': 0,
        'total': 0
    }
Beispiel #3
0
options = utils.get_options(desc, hosts=False, debug=True)

# Himmlar config
config = himutils.get_config(options.config)
region = config.get('openstack', 'region')
logger = himutils.get_logger(__name__, config, options.debug)

# statsd
statsd_server = config.get('statsd', 'server')
statsd_port = config.get('statsd', 'port')
prefix = 'uh-iaas.%s.checks' % region
statsd = statsd.StatsClient(statsd_server, statsd_port, prefix=prefix)

# Services to check
services = himutils.load_region_config('config/checks',
                                       region=region,
                                       log=logger)

for name, check in sorted(services['checks'].iteritems()):
    if 'timeout' in check:
        timeout = check['timeout']
    else:
        timeout = 10
    if check['ssl']:
        c = httplib.HTTPSConnection(check['host'], timeout=timeout)
    else:
        c = httplib.HTTPConnection(check['host'], timeout=timeout)
    try:
        c.request("HEAD", check['url'])
        response = c.getresponse()
        status = response.status