+ import logging
+ logger = logging.getLogger("monitor")
+ logger.setLevel(logging.DEBUG)
+ fh = logging.FileHandler("monitor.log", mode = 'a')
+ fh.setLevel(logging.DEBUG)
+ formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
+ fh.setFormatter(formatter)
+ logger.addHandler(fh)
+ from monitor import parser as parsermodule
+ parser = parsermodule.getParser()
+ parser.set_defaults(nodelist=None,
+ increment=False,
+ pcuid=None,
+ pcuselect=None,
+ site=None,
+ dbname="findbadpcus",
+ cachenodes=False,
+ refresh=False,
+ )
+ parser.add_option("-f", "--nodelist", dest="nodelist", metavar="FILE",
+ help="Provide the input file for the node list")
+ parser.add_option("", "--site", dest="site", metavar="FILE",
+ help="Get all pcus associated with the given site's nodes")
+ parser.add_option("", "--pcuselect", dest="pcuselect", metavar="FILE",
+ help="Query string to apply to the findbad pcus")
+ parser.add_option("", "--pcuid", dest="pcuid", metavar="id",
+ help="Provide the id for a single pcu")
+
+ parser.add_option("", "--cachenodes", action="store_true",
+ help="Cache node lookup from PLC")
+ parser.add_option("", "--dbname", dest="dbname", metavar="FILE",
+ help="Specify the name of the database to which the information is saved")
+ parser.add_option("", "--refresh", action="store_true", dest="refresh",
+ help="Refresh the cached values")
+ parser.add_option("-i", "--increment", action="store_true", dest="increment",
+ help="Increment round number to force refresh or retry")
+ parser = parsermodule.getParser(['defaults'], parser)
+ config = parsermodule.parse_args(parser)