expects the 'interfaces' key in GetSlivers - review logs to always mention module
[nodemanager.git] / bwmon.py
index 91a79f3..2b13d6f 100644 (file)
--- a/bwmon.py
+++ b/bwmon.py
@@ -1,5 +1,8 @@
 #!/usr/bin/python
 #
+# $Id$
+# $URL$
+#
 # Average bandwidth monitoring script. Run periodically via NM db.sync to
 # enforce a soft limit on daily bandwidth usage for each slice. If a
 # slice is found to have transmitted 80% of its daily byte limit usage,
 # Faiyaz Ahmed <faiyaza@cs.princeton.edu>
 # Copyright (C) 2004-2008 The Trustees of Princeton University
 #
-# $Id$
-#
 
 import os
 import sys
 import time
 import pickle
 import socket
-import logger
 import copy
 import threading
-import tools
 
+import logger
+import tools
 import bwlimit
 import database
 
@@ -579,7 +580,7 @@ def sync(nmdbcopy):
         if newslice != None and live[newslice].has_key('_rspec') == True:
             # Check to see if we recently deleted this slice.
             if live[newslice]['name'] not in deaddb.keys():
-                logger.log( "bwmon: New Slice %s" % live[newslice]['name'] )
+                logger.log( "bwmon: new slice %s" % live[newslice]['name'] )
                 # _rspec is the computed rspec:  NM retrieved data from PLC, computed loans
                 # and made a dict of computed values.
                 slices[newslice] = Slice(newslice, live[newslice]['name'], live[newslice]['_rspec'])
@@ -687,7 +688,7 @@ def allOff():
     default_xid = bwlimit.get_xid("default")
     kernelhtbs = gethtbs(root_xid, default_xid)
     if len(kernelhtbs):
-        logger.log("bwlimit:  Disabling all running HTBs.")
+        logger.log("bwmon:  Disabling all running HTBs.")
         for htb in kernelhtbs.keys(): bwlimit.off(htb) 
 
 
@@ -709,11 +710,12 @@ def run():
                 # class show to check if net:InitNodeLimit:bwlimit.init has run.
                 sync(nmdbcopy)
             else: logger.log("bwmon:  BW limits DISABLED.")
-        except: logger.log_exc()
+        except: logger.log_exc("bwmon failed")
         lock.clear()
 
 def start(*args):
     tools.as_daemon_thread(run)
 
 def GetSlivers(*args):
+    logger.verbose ("bwmon: triggering dummy GetSlivers") 
     pass