# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
#     def _parse_loadaverage(self, data):
#     def get(self):
#     def sshGet(self):
#     def __init__(self, *a, **kw):
#     def _parse_stats(self, stats):
#     def sshGet(self):
#     def _getstats(self):
#     def get(self):
#     def __init__(self, *a):
#     def _read_proc_stat(self):
#     def _calculate_metrics(self, stat):
#     def _transpose_metrics(self, metrics):
#     def sshGet(self):
#     def get(self):
#     def _parse_stats(self, mem):
#     def get(self):
#     def sshGet(self):
#     def get(self):
#     def _parse_stats(self, stats):
#     def _readStats(self):
#     def sshGet(self):
#     def get(self):
# 
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
#     def get(self):
#     def get(self):
# 
# Path: tensor/sources/riak.py
# class RiakStats(Source):
#     def _get_stats_from_node(self):
#     def get(self):
# 
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
#     def _parse_nginx_stats(self, stats):
#     def get(self):
#     def __init__(self, *a):
#     def _aggregate_fields(self, row, b, field, fil=None):
#     def dumpEvents(self, ts):
#     def got_line(self, line):
#     def get(self):
#     def __init__(self, *a):
#     def got_eventlog(self, event):
#     def _parser_proxy(self, line):
#     def get(self):
# 
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
#     def get(self):
#     def get(self):


import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network
            '   1       0 ram0 0 0 0 0 0 0 0 0 0 0 0',
            '   7       0 loop0 0 0 0 0 0 0 0 0 0 0 0',
            ' 202       2 xvda2 2 0 4 64 0 0 0 0 0 64 64',
            ' 202      32 xvdc 576 10 3739 748 144 0 4497 18080 0 8616 18828',
            ' 202      33 xvdc1 423 0 2435 264 144 0 4497 18080 0 8132 18344',
        ]

        s._getstats = lambda: stats
        events = s.get()

        self.assertEqual(events[0].metric, 32)
        self.assertEqual(events[1].metric, 2)

    def test_basic_memory(self):
        self.skip_if_no_hostname()
        s = basic.Memory(
            {'interval': 1.0, 'service': 'mem', 'ttl': 60}, self._qb, None)

        s.get()

    def test_basic_load(self):
        self.skip_if_no_hostname()
        s = basic.LoadAverage(
            {'interval': 1.0, 'service': 'mem', 'ttl': 60}, self._qb, None)

        s.get()

    @defer.inlineCallbacks
    def test_process_count(self):
        self.skip_if_no_hostname()

# Path: tensor/sources/linux/basic.py
# class LoadAverage(Source):
# class DiskIO(Source):
# class CPU(Source):
# class Memory(Source):
# class DiskFree(Source):
# class Network(Source):
#     def _parse_loadaverage(self, data):
#     def get(self):
#     def sshGet(self):
#     def __init__(self, *a, **kw):
#     def _parse_stats(self, stats):
#     def sshGet(self):
#     def _getstats(self):
#     def get(self):
#     def __init__(self, *a):
#     def _read_proc_stat(self):
#     def _calculate_metrics(self, stat):
#     def _transpose_metrics(self, metrics):
#     def sshGet(self):
#     def get(self):
#     def _parse_stats(self, mem):
#     def get(self):
#     def sshGet(self):
#     def get(self):
#     def _parse_stats(self, stats):
#     def _readStats(self):
#     def sshGet(self):
#     def get(self):
# 
# Path: tensor/sources/linux/process.py
# class ProcessCount(Source):
# class ProcessStats(Source):
#     def get(self):
#     def get(self):
# 
# Path: tensor/sources/riak.py
# class RiakStats(Source):
#     def _get_stats_from_node(self):
#     def get(self):
# 
# Path: tensor/sources/nginx.py
# class Nginx(Source):
# class NginxLogMetrics(Source):
# class NginxLog(Source):
#     def _parse_nginx_stats(self, stats):
#     def get(self):
#     def __init__(self, *a):
#     def _aggregate_fields(self, row, b, field, fil=None):
#     def dumpEvents(self, ts):
#     def got_line(self, line):
#     def get(self):
#     def __init__(self, *a):
#     def got_eventlog(self, event):
#     def _parser_proxy(self, line):
#     def get(self):
# 
# Path: tensor/sources/network.py
# class HTTP(Source):
# class Ping(Source):
#     def get(self):
#     def get(self):


# Path: tensor/tests/test_sources.py
import json
import socket
from twisted.trial import unittest
from twisted.internet import defer, endpoints, reactor
from twisted.web import server, static
from tensor.sources.linux import basic, process
from tensor.sources import riak, nginx, network

            '   1       0 ram0 0 0 0 0 0 0 0 0 0 0 0',
            '   7       0 loop0 0 0 0 0 0 0 0 0 0 0 0',
            ' 202       2 xvda2 2 0 4 64 0 0 0 0 0 64 64',
            ' 202      32 xvdc 576 10 3739 748 144 0 4497 18080 0 8616 18828',
            ' 202      33 xvdc1 423 0 2435 264 144 0 4497 18080 0 8132 18344',
        ]

        s._getstats = lambda: stats
        events = s.get()

        self.assertEqual(events[0].metric, 32)
        self.assertEqual(events[1].metric, 2)

    def test_basic_memory(self):
        self.skip_if_no_hostname()
        s = basic.Memory(
            {'interval': 1.0, 'service': 'mem', 'ttl': 60}, self._qb, None)

        s.get()

    def test_basic_load(self):
        self.skip_if_no_hostname()
        s = basic.LoadAverage(
            {'interval': 1.0, 'service': 'mem', 'ttl': 60}, self._qb, None)

        s.get()

    @defer.inlineCallbacks
    def test_process_count(self):
        self.skip_if_no_hostname()

        s = process.ProcessCount(