Esempio n. 1
0
 def test_url(self, endpoint, exec_fn, **kwargs):
     for host in ADHOC_HOSTS:
         expected_url = '{}{}'.format(host[:-1], endpoint)
         c = tsdb.tsdb_connection(host)
         _exec_fn = getattr(c, exec_fn)
         mock_return_value = _exec_fn(**kwargs)
         self.assertTrue(mock_return_value[-1] == expected_url)
Esempio n. 2
0
 def setUp(self):
     self._host = 'mockhttp://localhost:5896/'
     self._c = tsdb.tsdb_connection(self._host)
Esempio n. 3
0
 def __init__(self, server, batch_size, **kwargs):
     self._logger = logging.getLogger(OpenTsdbHttpImporter.__name__)
     self._server = server
     self._batch_size = batch_size
     self._session = requests.Session()
     self._tsdb_connector = tsdb.tsdb_connection(host=self._server)
Esempio n. 4
0
import unittest
from datetime import datetime
import time

from pyopentsdb import tsdb

SLEEP_TIME = 15
HOST = "http://*****:*****@unittest.skipIf(not ping(), "no tsdb running at localhost:4242")
class TsdbIntegrationTestCase(unittest.TestCase):
    __SINGLE_METRIC_NAME__ = "integration_test_metric.sys.cpu.nice"
    __MULTIPLE_METRIC_NAME__ = "integration_test_metric.sys.mem.size"
    __DELETE_METRIC_NAME__ = "integration_test_metric.sys.hdd.left"

    __TEST_PUT_SINGLE__ = {
        "metric": __SINGLE_METRIC_NAME__,
        "timestamp": 1514764800,
        "value": 18,
        "tags": {
            "host": "web01",
Esempio n. 5
0
def get_tsdb_connetion():
    return tsdb.tsdb_connection(host=config.TSDB_SERVER)
Esempio n. 6
0
else:
    raise LookupError("Couldn't resolve configuration file. To define it \n "
                      "  - Set the environment variable SKVO_CONFIG, or \n "
                      "  - add conf/skvo.ini under your virtualenv root\n")

config = ConfigParser(defaults={
    'config': '',
})
logger.info("Parse config file: {}".format(venv_config))
config.read(config_file)

SKVO_BASE_PATH = config.get("general", "base_path")
SKVO_EXPORT_PATH = config.get("general", "export_path")

OPENTSDB_SERVER = config.get("opentsdb", "server")
TSDB_CONNECTOR = tsdb.tsdb_connection(host=OPENTSDB_SERVER)


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECRET_KEY = '(yty%gzc4x7(12$h@tnzgv(fb-3_cp*r0y%6i3uis^b61g+ppy'

SECRET_KEY = config.get('secret', 'secret_key')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = config.get('django', 'debug').lower() == 'true'

if DEBUG:
    ALLOWED_HOSTS = []
else: