def __init__(self): """ Init the libstatgrab and process to the first update """ # Init libstatgrab if not statgrab.sg_init(): print "Error: Can not init the libstatgrab library.\n" # Do the first update self.__update__()
def __init__(self): """ Init the libstatgrab and process to the first update """ # Init libstatgrab if not statgrab.sg_init(): print "Error: Can not init the libstatgrab library.\n" # Init the interfac fs stats self.glancesgrabfs = glancesGrabFs() # Do the first update self.__update__()
def __init__(self): """ Init the libstatgrab and process to the first update """ # Init libstatgrab if not statgrab.sg_init(): print _("Error: Can not init the libstatgrab library.\n") # Init the fs stats try: self.glancesgrabfs = glancesGrabFs() except: self.glancesgrabfs = {} # Do the first update self.__update__()
sg_get_error_errno() sg_get_fs_stats() #Return infos about filesystem (bugged), free_blocks, total .. sg_get_host_info() #Return basically the same than uname -a sg_get_load_stats() #Return the average since 1 minute, 5 minutes and 15 minutes sg_get_mem_stats() #Return total, free, cache and used of the RAM sg_get_network_iface_stats() #Retur network interfaces and theirs status sg_get_network_io_stats() #Return input ouput in bytes on each interfaces (and errors..) sg_get_network_io_stats_diff() #Return the difference with the last io_stats() sg_get_page_stats() sg_get_page_stats_diff() sg_get_process_count() #Return informations about processes sg_get_process_stats() #Return informations about all process sg_get_swap_stats() #Same as mem_stats but not with cache sg_get_user_stats() # ? if not stg.sg_init(): sys.exit(1) res = stg.sg_get_cpu_percents() #The problem is the object returned is a Result class you can loop trough items knowing #in advance all the keys. ex: for k in ('kernel','iowait','idle','swap','nice','user'): #time_taken .. print k,": ",res[k],"%" ''' kernel : 0.531929373741 % iowait : 0.00408129952848 % idle : 97.5757064819 % swap : 0.0 % nice : 0.0 % user : 1.8923625946 %
def setUp(self): statgrab.sg_init()