#!/usr/bin/env python3

import sys
import psutil

def print_CPU_metrics():
    print("system.cpu.idle", psutil.cpu_times().idle)
    print("system.cpu.user", psutil.cpu_times().user)
    print("system.cpu.guest", psutil.cpu_times().guest)
    print("system.cpu.iowait", psutil.cpu_times().iowait)
    print("system.cpu.stolen", psutil.cpu_times().steal)
    print("system.cpu.system", psutil.cpu_times().system)

def print_RAM_metrics():
    print("virtual total", psutil.virtual_memory().total)
    print("virtual used", psutil.virtual_memory().used)
    print("virtual free", psutil.virtual_memory().free)
    print("virtual shared", psutil.virtual_memory().shared)
    print("swap total", psutil.swap_memory().total)
    print("swap used", psutil.swap_memory().used)
    print("swap free", psutil.swap_memory().free)

if __name__ == "__main__":
    args = sys.argv[1]
    if (args == "cpu"):
        print_CPU_metrics()
    if (args == "mem"):
        print_RAM_metrics()
