import time
import logging
import xml
import argparse
import signal

from cloud_monitor_settings import *
from monitor import ThreadPoolMonitor
from common.log import getlogger

from rpc_send import instance_queue
from rpc_send import loadbalanceNotify
from rpc_send import MonitorReceiver
from rpc_send import MonitorSender

logger = getlogger("CloudMonitor")

try:
    import web as _web
except (ImportError, ImportWarning) as e:
    logger.debug("Can not find python-webpy, \
           in ubuntu just run \"sudo apt-get install python-webpy\".")
    raise e

try:
    import libvirt as _libvirt
except (ImportError, ImportWarning) as e:
    logger.debug("Can not find python-libvirt, \
            in ubuntu just run \"sudo apt-get install python-libvirt\".")
    raise e
Example #2
0
# -*- coding: utf-8 -*-
from websocket import create_connection
import gzip
import time
import json
import os
from multiprocessing import Process
import _thread as thread
from common import log
from common import conf
from analizer import controller
from alarm import sendemail

conf = conf.getconf()
LOG = log.getlogger()

sendemail("hello")
timeHistory = conf.getint("default", "saveCount")
LOG.info(timeHistory)


def nows():
    return int(time.time())


def nowts():
    return int(round(time.time() * 1000))


buyList = {"elf": 1.2686}
coinList = [
import time
import logging
import xml
import argparse
import signal

from cloud_monitor_settings import *
from monitor import ThreadPoolMonitor
from common.log import getlogger

from rpc_send import instance_queue
from rpc_send import loadbalanceNotify
from rpc_send import MonitorReceiver
from rpc_send import MonitorSender

logger = getlogger("CloudMonitor")

try:
    import web as _web
except (ImportError, ImportWarning) as e:
    logger.debug(
        'Can not find python-webpy, \
           in ubuntu just run "sudo apt-get install python-webpy".'
    )
    raise e

try:
    import libvirt as _libvirt
except (ImportError, ImportWarning) as e:
    logger.debug(
        'Can not find python-libvirt, \
Example #4
0
import signal
import argparse

import pika
from pika.adapters import select_connection

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)), os.path.pardir))
from common.log import getlogger
from common.exceptions import *
from common.driver import NginxDriver

import settings

node_id = "Sunny"
logger = getlogger(node_id)


class AgentSender(threading.Thread):
    def __init__(self, queue):
        super(AgentSender, self).__init__()
        self.queue = queue
        self.connect()

    def connect(self):
        parameters = pika.ConnectionParameters(
            virtual_host=settings.virtual_host,
            credentials=pika.PlainCredentials(settings.username,
                                              settings.password),
            frame_max=settings.frame_max_size,
            host=settings.rabbitmq_server)
import Queue
import signal
import argparse

import pika
from pika.adapters import select_connection

sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),os.path.pardir))
from common.log import getlogger
from common.exceptions import *
from common.driver import NginxDriver

import settings

node_id = "Sunny"
logger = getlogger(node_id)


class AgentSender(threading.Thread):
    def __init__(self, queue):
        super(AgentSender,self).__init__()
        self.queue = queue
        self.connect()
    
    def connect(self):
        parameters = pika.ConnectionParameters(virtual_host=settings.virtual_host,
                        credentials=pika.PlainCredentials(settings.username,settings.password),
                        frame_max=settings.frame_max_size,
                        host=settings.rabbitmq_server)
        
        select_connection.POLLER_TYPE = 'epoll'
import os
import sys

from keystoneclient.v2_0 import client as keystone_client
from keystoneclient.v2_0 import tokens

sys.path.append(
    os.path.join(os.path.dirname(os.path.realpath(__file__)),
                 os.path.join(os.path.pardir, os.path.pardir)))

import settings

from common.log import getlogger

LOG = getlogger('MasterServer')


def _keystoneclient(username=None,
                    password=None,
                    endpoint=None,
                    tenant_id=None,
                    token_id=None,
                    auth_url=None):

    c = keystone_client.Client(username=username,
                               password=password,
                               token=token_id,
                               tenant_id=tenant_id,
                               auth_url=auth_url
                               or settings.OPENSTACK_KEYSTONE_URL,
                               endpoint=endpoint)
import os
import sys

from keystoneclient.v2_0 import client as keystone_client
from keystoneclient.v2_0 import tokens

sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),
                             os.path.join(os.path.pardir,os.path.pardir)))

import settings

from common.log import getlogger

LOG = getlogger('MasterServer')


def _keystoneclient(username=None, password=None, endpoint=None,
                    tenant_id=None, token_id=None, auth_url=None):
    
    c = keystone_client.Client(username=username, 
                               password=password,
                               token=token_id,
                               tenant_id=tenant_id,
                               auth_url=auth_url or settings.OPENSTACK_KEYSTONE_URL,
                               endpoint=endpoint)
    return c


def _keystoneclient_admin(service_token=settings.SERVICE_TOKEN, 
                          service_endpoint=settings.SERVICE_ENDPOINT):
    """