Example #1
0
    os.chdir(opts.baseLoc)

    logging.basicConfig(
                        level = 50 - (opts.verboseCount * 10),
                        filename = opts.logFile,
                        # TODO: Support file modes other than append
                        # TODO: Support both stdout and log files
                        # TODO: Support auto file rotation and compression
                        )
    log.warn("Starting www monitor tool")
    
    log.debug("Reading config file")
    # TODO: Wrap in a try/except for friendlier error messages
    # TODO: Add in options for created a nice default config file
    opts.cfg = ConfigObj(opts.configLoc)

    log.debug("Creating Zabbix server")
    server = ZabbixServer(config = opts.cfg)

    log.debug("Starting sender thread")
    server.start()
    log.debug("Started")

    m = WWWDiscoveryMetric(domainsCSV = '/root/monitor/DomainDownloadList-196756955.csv')
    server.queueMetric(m)

    log.debug("Stopping")
    server.stopRunning()

    log.warn("www monitor tool is exiting")