#!/usr/bin/python # Copyright 2008-2009 Innominet """Records Average CPU usage for each minute""" import time import atexit import signal from Events import CpuUsage import EventLogging EventLogging.open_logs("/mnt/logs/cpu/cpu_events.out") #time inbetween each collection point- the cpu usage is also averaged over this time period INTERVAL = 60 #INTERVAL = 1 signal.signal(signal.SIGHUP, signal.SIG_IGN) print 'Recording average cpu usage every %s seconds' % (INTERVAL) def done(): EventLogging.close_logs() print 'all done' atexit.register(done) def get_times(): f = open("/proc/stat", "rb")
#!/usr/bin/python #Copyright 2008-2009 Innominet """Periodically pings servers to see if any are offline""" #TODO: does not properly detect whether the SVN server is running because that is on a VM behind VMWare Server, which acts as a software NAT import time import atexit import signal import socket from Events import ServerDown import EventLogging EventLogging.open_logs("/mnt/logs/ping/ping_events.out") #TODO: move to a reactor so that we can lower this interval to a minute. Currently not possible because the TCP connection timeout is too long and there are too many servers INTERVAL = 60 * 60 #INTERVAL = 10 signal.signal(signal.SIGHUP, signal.SIG_IGN) print 'Pinging servers every %s seconds' % (INTERVAL) def done(): EventLogging.close_logs() print 'all done' atexit.register(done) def is_reachable(url): """See if we can connect to a given host:port. Just want to know that the service is alive and reachable.""" try:
#!/usr/bin/python # Copyright 2008-2009 Innominet """Records Average CPU usage for each minute""" import time import atexit import signal from Events import CpuUsage import EventLogging EventLogging.open_logs("/mnt/logs/cpu/cpu_events.out") #time inbetween each collection point- the cpu usage is also averaged over this time period INTERVAL = 60 #INTERVAL = 1 signal.signal(signal.SIGHUP, signal.SIG_IGN) print 'Recording average cpu usage every %s seconds' % (INTERVAL) def done(): EventLogging.close_logs() print 'all done' atexit.register(done) def get_times(): f = open("/proc/stat", "rb") line = f.readline() f.close() data = line.split(" ") data.pop(0)
#!/usr/bin/python #Copyright 2008-2009 Innominet """Periodically pings servers to see if any are offline""" #TODO: does not properly detect whether the SVN server is running because that is on a VM behind VMWare Server, which acts as a software NAT import time import atexit import signal import socket from Events import ServerDown import EventLogging EventLogging.open_logs("/mnt/logs/ping/ping_events.out") #TODO: move to a reactor so that we can lower this interval to a minute. Currently not possible because the TCP connection timeout is too long and there are too many servers INTERVAL = 60 * 60 #INTERVAL = 10 signal.signal(signal.SIGHUP, signal.SIG_IGN) print 'Pinging servers every %s seconds' % (INTERVAL) def done(): EventLogging.close_logs() print 'all done' atexit.register(done)