X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nm.py;h=36d121bc581f0208b88e6522fc2550c2b64ca782;hb=9eb77020a24ba1e921f0375a10ab3faab9665178;hp=a2b6a4d260cd1926eb469370b85dfa3307aa3293;hpb=c757f1511ff413440cd66ee73209d73ee9bf60d6;p=nodemanager.git diff --git a/nm.py b/nm.py index a2b6a4d..36d121b 100755 --- a/nm.py +++ b/nm.py @@ -1,4 +1,13 @@ #!/usr/bin/python + +# +# Useful information can be found at https://svn.planet-lab.org/wiki/NodeManager +# + +# Faiyaz Ahmed +# Copyright (C) 2008 The Trustees of Princeton University + + """Node Manager""" import optparse @@ -30,12 +39,19 @@ parser.add_option('-k', '--session', action='store', dest='session', default='/e parser.add_option('-p', '--period', action='store', dest='period', default=600, help='Polling interval (sec)') parser.add_option('-r', '--random', action='store', dest='random', default=301, help='Range for additional random polling interval (sec)') parser.add_option('-v', '--verbose', action='store_true', dest='verbose', default=False, help='more verbose log') +parser.add_option('-P', '--path', action='store', dest='path', default='/usr/share/NodeManager/plugins', help='Path to plugins directory') parser.add_option('-m', '--module', action='store', dest='module', default='', help='run a single module among '+' '.join(known_modules)) (options, args) = parser.parse_args() +# Deal with plugins directory +if os.path.exists(options.path): + sys.path.append(options.path) + known_modules += [i[:-3] for i in os.listdir(options.path) if i.endswith(".py") and (i[:-3] not in known_modules)] + modules = [] def GetSlivers(plc): + '''Run call backs defined in modules''' try: logger.log("Syncing w/ PLC") data = plc.GetSlivers()