All pastes #179050 Raw Edit

Untitled

public text v1 · immutable
#179050 ·published 2006-09-21 21:08 UTC
rendered paste body
def biProbe():
  PROBE = "Bi File Check"
  for f in filelist:
    if sizeCheck(f, BI_INFO):
      LEVEL = "INFO"
      value = sizeCheck(f, BI_INFO)
    elif sizeCheck(f, BI_WARN):
      LEVEL = "WARN"
      value = sizeCheck(f, BI_WARN)
    else:
      LEVEL = "CRIT"
      value = sizeCheck(f, BI_WARN)
    MESSAGE = "%s : %s bytes" %(f,value)
  print TIMESTAMP + " | " + PROBE + " | " + LEVEL
  print MESSAGE

def sizeCheck(file, level):
  """Check size of file in bytes and compare against threshold; return True if value is less than the threshold"""
  level = level * (1024*1024) # Convert to bytes
  #size = os.path.getsize(file)
  size = silly[file]
  if size < level:
    return size