def execute(args):
    logger.setup(0)

    try:
        if args.command == "init-monitor":
            init_monitor_cfg_file(args.monitor_name, args.force)
            print("Monitor configuration initialized.")

            if edit_monitor(args.monitor_name):
                check_monitor_cfg_loop(args.monitor_name, False)

        elif args.command == "check-monitor":
            if args.silent:
                if check_monitor_cfg(args.monitor_name, args.verbose):
                    return 0
                else:
                    return 1
            else:
                check_monitor_cfg_loop(args.monitor_name, args.verbose)

        elif args.command == "edit-monitor":
            edit_monitor(args.monitor_name, ask=False)
            check_monitor_cfg_loop(args.monitor_name, args.verbose)

        else:
            raise NotImplementedError()
    except KeyboardInterrupt:
        pass
def execute(args):
    logger.setup(0)

    try:
        if args.command == "init-monitor":
            init_monitor_cfg_file(args.monitor_name, args.force)
            print("Monitor configuration initialized.")

            if edit_monitor(args.monitor_name):
                check_monitor_cfg_loop(args.monitor_name, False)

        elif args.command == "check-monitor":
            if args.silent:
                if check_monitor_cfg(args.monitor_name, args.verbose):
                    return 0
                else:
                    return 1
            else:
                check_monitor_cfg_loop(args.monitor_name, args.verbose)

        elif args.command == "edit-monitor":
            edit_monitor(args.monitor_name, ask=False)
            check_monitor_cfg_loop(args.monitor_name, args.verbose)

        else:
            raise NotImplementedError()
    except KeyboardInterrupt:
        pass
Exemplo n.º 3
0
import unittest
import re
import sys


from .data import *
from pierky.ripeatlasmonitor.Helpers import IPCache
from pierky.ipdetailscache import IPDetailsCache
from pierky.ripeatlasmonitor.Logging import logger, CustomLogger, LOG_LVL_RESULT
from pierky.ripeatlasmonitor.Monitor import Monitor
from ripe.atlas.cousteau import Measurement
from ripe.atlas.cousteau.request import AtlasLatestRequest, AtlasRequest


log_output = ""
logger.setup(0)

class TestBasicUnit(unittest.TestCase):

    def setUp(self):
        global last_msm_id
        last_msm_id = None

        self.cfg = {}

        self.debug = False

        self.ip_cache_mocked = False

        def msm_fetch_meta_data(self):
            self.meta_data = deepcopy(MSMS[str(self.id)]["meta_data"])
Exemplo n.º 4
0
import mock
from time import time
import unittest
import re
import sys

from .data import *
from pierky.ripeatlasmonitor.Helpers import IPCache
from pierky.ipdetailscache import IPDetailsCache
from pierky.ripeatlasmonitor.Logging import logger, CustomLogger, LOG_LVL_RESULT
from pierky.ripeatlasmonitor.Monitor import Monitor
from ripe.atlas.cousteau import Measurement
from ripe.atlas.cousteau.request import AtlasLatestRequest, AtlasRequest

log_output = ""
logger.setup(0)


class TestBasicUnit(unittest.TestCase):
    def setUp(self):
        global last_msm_id
        last_msm_id = None

        self.cfg = {}

        self.debug = False

        self.ip_cache_mocked = False

        def msm_fetch_meta_data(self):
            self.meta_data = deepcopy(MSMS[str(self.id)]["meta_data"])