Exemplo n.º 1
0
#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN    #
#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)    #
#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF     #
#  THE POSSIBILITY OF SUCH DAMAGE.                                            #
# ----------------------------------------------------------------------------#

from linux_metrics import cpu_stat, disk_stat, net_stat

from liota.core.package_manager import LiotaPackage
from liota.lib.utilities.utility import get_default_network_interface, get_disk_name

dependencies = ["graphite"]

# Getting edge_system's network interface and disk name
network_interface = get_default_network_interface()
disk_name = get_disk_name()

#---------------------------------------------------------------------------
# User defined methods


def read_cpu_procs():
    return cpu_stat.procs_running()


def read_cpu_utilization(sample_duration_sec=1):
    cpu_pcts = cpu_stat.cpu_percents(sample_duration_sec)
    return round((100 - cpu_pcts['idle']), 2)


def read_disk_usage_stats():
# ----------------------------------------------------------------------------#

from linux_metrics import cpu_stat, disk_stat, net_stat

from liota.core.package_manager import LiotaPackage
<<<<<<< HEAD
from liota.lib.utilities.utility import get_default_network_interface, get_disk_name
=======
from liota.lib.utilities.utility import get_default_network_interface, get_disk_name, read_user_config
>>>>>>> vmware/master

dependencies = ["graphite"]

# Getting edge_system's network interface and disk name
network_interface = get_default_network_interface()
disk_name = get_disk_name()

#---------------------------------------------------------------------------
# User defined methods


def read_cpu_procs():
    return cpu_stat.procs_running()


def read_cpu_utilization(sample_duration_sec=1):
    cpu_pcts = cpu_stat.cpu_percents(sample_duration_sec)
    return round((100 - cpu_pcts['idle']), 2)
    

def read_disk_usage_stats():