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
32 bwlimit.run("/etc/init.d/pl_nm stop")
34 nmpid = bwlimit.run("/bin/ps -e -o pid,cmd | grep nm.py")[0].split(" ")[0]
35 os.kill(int(nmpid), 9)
37 print "NM %s forcefully killed." %nmpid
39 print "NM %s killed." %nmpid
40 bwlimit.run("/etc/init.d/pl_nm restart")
45 except Exception, err:
46 print "Warning: Exception received while restarting NM: %s" % err
50 syslog.openlog("nm_mom")
51 sys.stdout = sys.stderr = Logger()
56 # Query something. If it doesnt come back...
57 vals = nm.query("pl_netflow", [('nm_net_max_rate', last_maxrate)])
59 except Exception, err:
60 print "Warning: Exception received while querying NM:", err
63 if __name__ == '__main__':