Пример #1
0
async def main(argv):

  # execution state from args
  short_options = "hvd"
  long_options = ["help", "verbose", "debug"]
  full_cmd_arguments = sys.argv
  argument_list = full_cmd_arguments[1:]
  try:
    arguments, values = getopt.getopt(argument_list, short_options, long_options)
  except getopt.error as err:
    print (str(err))

  for current_argument, current_value in arguments:

    if current_argument in ("-h", "--help"):
      print("------------------------------------------------------------------------------------------------------------------------------------------")
      print("HELP for monitor.py")
      print("------------------------------------------------------------------------------------------------------------------------------------------")
      print("")
      print("  BASIC PARAMETERS...")
      print("")
      print("  -h or --help - Print out this Help Information")
      print("  -v or --verbose - Debug Mode with lots of Data will be Output to Assist with Debugging")
      print("  -d or --debug - Debug Mode with lots of DEBUG Data will be Output to Assist with Tracing and Debugging")
      print("------------------------------------------------------------------------------------------------------------------------------------------")
      return

    if current_argument in ("-v", "--verbose"):
      Log.basicConfig(format="%(levelname)s: %(message)s", level = Log.INFO)
      Log.info("Verbose Logging Mode...")
    else:
      Log.basicConfig(format="%(levelname)s: %(message)s")

    if current_argument in ("-d", "--debug"):
      Log.basicConfig(format="%(levelname)s: %(message)s", level = Log.DEBUG)
      Log.info("Debug Logging Mode...")
    else:
      Log.basicConfig(format="%(levelname)s: %(message)s")

  # Configure
  bbq_monitor = Monitor(Log)
  await setup_bbq_monitor(bbq_monitor)
  Log.info("[SERVER] Instance Info (bbq_monitor): %s" % bbq_monitor)

  # Load the meta-data and map OPC-UA to IoTC Interfaces
  await load_nodes_from_devicecache(bbq_monitor)

  # Start the loop
  await run_bbq_monitor(bbq_monitor)
Пример #2
0
def main():
    log = Logger('main').log

    log('starting monitor')

    with open('sites.txt') as sitelist:
        sites = sitelist.read().splitlines()
    log('loaded {} sites to monitor'.format(len(sites)))

    with open('proxies.txt') as proxylist:
        proxies = proxylist.read().splitlines()
    log('loaded {} proxies to monitor with'.format(len(proxies)))

    i = 0
    monitors = []
    for site in sites:
        monitors.append(Monitor(site))
        monitors[i].start()
        i += 1
Пример #3
0
    def init_gui(self):
        """Separate function for GUI initialization"""
        self._init_sizing(width=350)

        self.element_state_notifier = StateNotifier()
        monitor = Monitor(self.element_state_notifier)

        element_list = self._init_scroll_list()

        self._init_layout(
            [
                monitor,
                element_list
            ],
            margins=(5, 5, 5, 5),
            spacing=5
        )

        self._init_palette({
            qtg.QPalette.Window: qtg.QColor("#374B4A")
        })
Пример #4
0
from classes.arguments import Arguments
from classes.yolo import YOLO
from classes.image import Image
from classes.detector import Detector
from classes.monitor import Monitor

if __name__ == '__main__':

    # yolo = YOLO()

    # image = Image(yolo, './prueba/30.png')

    # detector = Detector(yolo, image)

    # print(detector.detect())

    monitor = Monitor()

    monitor.capture()
Пример #5
0
        # filename='debug.log'
    )

    logging.info('\n' * 5)
    logging.info('*' * 10 + 'ACTIVE LEARNING' + '*' * 10)
    logging.info('Starting Application...')

    # Initialize Threads

    streamer = Streamer(credentials=credentials['coll_1'], data=data)

    text_processor = TextProcessor(data)
    annotator = Annotator(train_threshold=n_before_train, data=data)
    classifier = Classifier(data)
    monitor = Monitor(streamer=streamer,
                      classifier=classifier,
                      annotator=annotator,
                      data=data)
    trainer = Trainer(data=data,
                      streamer=streamer,
                      clf=SGDClassifier(loss='log', penalty='elasticnet'))

    threads = [streamer, text_processor, monitor, classifier, trainer]
    check = True

    for t in threads:
        logging.info('Starting {t.name}...')
        logging.info('*' * 10 + 'THREAD STARTING' + '*' * 10)
        if (t.isAlive() == False):
            t.start()
        else:
            t.resume()
Пример #6
0
from classes.monitor import Monitor
import json

if __name__ == '__main__':
    try:
        config = json.load(open('config.json'))

        monitor = Monitor(model=config['model'],
                          condition=config['condition'],
                          colour=config['colour'],
                          delay_in_seconds=int(config['refresh_delay']),
                          webhooks=config['webhooks'])
        monitor.run()

    except FileNotFoundError:
        print("FATAL ERROR: Could not find config file")

    # case where config file is not valid json
    except json.decoder.JSONDecodeError:
        print("FATAL ERROR: Could not read config file, invalid JSON")

    # case where we don't know the cause of the exception
    except Exception as e:
        print("Unknown error: " + str(e))