3 # Restarts NM if NM does not respond to periodic probes.
5 # Faiyaz Ahmed <faiyaza@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
8 # $Id: nm_mom.py,v 1.2 2006/08/17 20:12:09 faiyaza Exp $
30 bwlimit.run("/etc/init.d/pl_nm stop")
33 nmpid = bwlimit.run("/bin/ps -e -o pid,cmd | grep nm.py")[0].split(" ")[0]
34 os.kill(int(nmpid), 9)
36 print "NM %s forcefully killed." %nmpid
38 print "NM %s killed." %nmpid
39 bwlimit.run("/etc/init.d/pl_nm restart")
44 except Exception, err:
45 print "Warning: Exception received while restarting NM: %s" % err
49 syslog.openlog("nm_mom")
50 sys.stdout = sys.stderr = Logger()
55 # Query something. If it doesnt come back...
56 vals = nm.query("pl_netflow", [('nm_net_max_rate', last_maxrate)])
58 except Exception, err:
59 print "Warning: Exception received while querying NM:", err
62 if __name__ == '__main__':