Setting tag mom-2.3-5
[mom.git] / swapmon.py
index 1076261..edc00a3 100755 (executable)
@@ -10,8 +10,6 @@
 # Faiyaz Ahmed <faiyaza@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id$
-#
 
 import syslog
 import os
@@ -23,7 +21,7 @@ import socket
 import time
 
 # bwlimit exports a few useful functions like run(), get_xid(), and get_slice()
-import bwlimit
+import plnode.bwlimit as bwlimit
 
 # Utility functions
 from pl_mom import *
@@ -32,6 +30,7 @@ from pl_mom import *
 debug = False
 verbose = 0
 DATAFILE = "/var/lib/misc/swapmon.dat"
+# xxx fixme - this is broken under git
 VERSION = "$Id$"
 # Seconds between process analysis
 period = 30
@@ -171,7 +170,10 @@ def slicestat(names = None):
         # Represent process as a dict of fields
         values = line.split(None, len(fields) - 1)
         if len(values) != len(fields):
-            print "slicestat: failed to parse line:", line
+            if "ERR" in line:
+                pass # ignore spurious error message from vps
+            else:
+                print "slicestat: failed to parse line: " + line
             continue
         proc = dict(zip(fields, values))
 
@@ -185,12 +187,15 @@ def slicestat(names = None):
                 except ValueError:
                     pass
 
-        # vps sometimes prints ERR or the name of the slice 
+        # vps sometimes prints ERR or the name of the slice
             # instead of a context ID if it
         # cannot identify the context of an orphaned (usually dying)
         # process. Skip these processes.
         if (type(proc['xid']) != int) or (type(proc['vsize']) !=int):
-            print "slicestat: failed to parse line:", line
+            if "ERR" in line:
+                pass # ignore spurious error message from vps
+            else:
+                print "slicestat: failed to parse line: " + line
             continue
 
         # Assign (pl_)sshd processes to slice instead of root