X-Git-Url: http://git.onelab.eu/?p=mom.git;a=blobdiff_plain;f=swapmon.py;h=edc00a3df22c4f472d552c2ceef2a355e3dd0fda;hp=ac133fba955f3dc52e1e38a3e2b2039d4916d511;hb=a7ab53cbaf3037b67fbda98fed3887c905d93e96;hpb=84d010124e01c6d71f2778daabb3e5adf66437c9 diff --git a/swapmon.py b/swapmon.py index ac133fb..edc00a3 100755 --- a/swapmon.py +++ b/swapmon.py @@ -10,8 +10,6 @@ # Faiyaz Ahmed # 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)) @@ -190,7 +192,10 @@ def slicestat(names = None): # 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