Ejemplo n.º 1
0
def send_temperatures(values):
  """Send a list of temperatures to the metricfire API.

  This maps the temperatures to names in the config['sensors'] list.
  """
  for name, temp in zip(config['sensors'], values):
    # Send the value
    logging.debug("Sending temperature: %s" % temp)
    metricfire.send(name, temp)
Ejemplo n.º 2
0
import time
import psutil
import metricfire

# send key to server
# add key here in the form of /key
metricfire.init("")

# cpu
cputimes = psutil.cpu_times()
#print type(cputimes),dir(cputimes)
cpus = ['user', 'nice', 'system', 'idle', 'iowait', 'irq', 'softirq']

for cpu in cpus:
    metric = getattr(cputimes, cpu)
    metricfire.send("cpu." + cpu, str(metric))

# memory
phymemusage = psutil.phymem_usage()
virtmemusage = psutil.virtmem_usage()
mems = ['total', 'used', 'free', 'percent']

for mem in mems:
    metric = getattr(phymemusage, mem)
    metricfire.send("phymem." + mem, str(metric))
    metric = getattr(virtmemusage, mem)
    metricfire.send("virtmem." + mem, str(metric))

disks = psutil.disk_usage('/')
partitions = ['total', 'used', 'free', 'percent']
Ejemplo n.º 3
0
import time
import psutil
import metricfire

# send key to server
# add key here in the form of /key
metricfire.init("")

# cpu
cputimes =  psutil.cpu_times()
#print type(cputimes),dir(cputimes)
cpus= ['user', 'nice', 'system', 'idle', 'iowait', 'irq', 'softirq']

for cpu in cpus:
	metric = getattr(cputimes,cpu)
   	metricfire.send("cpu." + cpu, str(metric))
	
# memory
phymemusage = psutil.phymem_usage()
virtmemusage = psutil.virtmem_usage()
mems = ['total', 'used', 'free', 'percent' ]

for mem in mems:
	metric = getattr(phymemusage,mem)
   	metricfire.send("phymem." + mem, str(metric))
	metric = getattr(virtmemusage,mem)
   	metricfire.send("virtmem." + mem, str(metric))

disks = psutil.disk_usage('/')
partitions = ['total', 'used', 'free', 'percent' ]
Ejemplo n.º 4
0
 def send(self, metric, value):
   metricfire.send(metric, value)