X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=swapmon.py;h=3f6304ec8109eab639db5bd1bf040e7d2d9e69b2;hb=254323e542400e059bd67369fdacee6ae33f4b92;hp=af89ef905e29eeb10c31c3531b9795081de5375f;hpb=493e557afb272871dc030bcd5ac56f18bd85e3e9;p=mom.git diff --git a/swapmon.py b/swapmon.py index af89ef9..3f6304e 100755 --- a/swapmon.py +++ b/swapmon.py @@ -9,7 +9,7 @@ # Andy Bavier # Copyright (C) 2004-2006 The Trustees of Princeton University # -# $Id: swapmon.py,v 1.2 2006/04/28 19:32:18 mlhuang Exp $ +# $Id: swapmon.py,v 1.4 2006/05/02 17:23:14 mlhuang Exp $ # import syslog @@ -180,6 +180,12 @@ def slicestat(names = None): except ValueError: pass + # vps sometimes prints ERR 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: + continue + # Assign (pl_)sshd processes to slice instead of root m = re.search(r"sshd: ([a-zA-Z_]+)", proc['cmd']) if m is not None: @@ -343,7 +349,7 @@ def main(): (version, slices) = pickle.load(f) f.close() # Check version of data file - if version != "$Id: swapmon.py,v 1.2 2006/04/28 19:32:18 mlhuang Exp $": + if version != "$Id: swapmon.py,v 1.4 2006/05/02 17:23:14 mlhuang Exp $": print "Not using old version '%s' data file %s" % (version, datafile) raise Exception @@ -360,7 +366,7 @@ def main(): # Delete data file os.unlink(datafile) except Exception: - version = "$Id: swapmon.py,v 1.2 2006/04/28 19:32:18 mlhuang Exp $" + version = "$Id: swapmon.py,v 1.4 2006/05/02 17:23:14 mlhuang Exp $" slices = {} # Query process table every 30 seconds, or when a large change in