コード例 #1
0
ファイル: cpu.py プロジェクト: wallydz/BitBlinder
#!/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")
コード例 #2
0
ファイル: ping.py プロジェクト: clawplach/BitBlinder
#!/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:
コード例 #3
0
ファイル: cpu.py プロジェクト: clawplach/BitBlinder
#!/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)
コード例 #4
0
ファイル: ping.py プロジェクト: wallydz/BitBlinder
#!/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)