示例#1
0
 def AddPartition(self):
     """
     将分区信息添加到字典表,组合成一个完成的所有分区的信息表,分区使用信息结果为MB:
     {'/root':{'total':1234,'used':21212,'free':2323,'precent':12.2}}
     """
     self.partitions[self.mountpoint] = {
         'total': Common.BytetoMb(self.partition_total),
         'used': Common.BytetoMb(self.partition_used),
         'free': Common.BytetoMb(self.partition_free),
         'precent': self.partition_precent
     }
     return self.partitions
示例#2
0
 def ReturnJsonData(self):
     dic_memory = {
         'modelname': self.model_name,
         'checktime': self.checktime,
         'host_ipaddr': self.host_ipaddr,
         'total': Common.BytetoMb(self.memory_total),
         'used': Common.BytetoMb(self.memory_used),
         'free': Common.BytetoMb(self.memory_free),
         'precent': self.precent
     }
     # dic_memory['host_name'] = self.host_name
     return json.dumps(dic_memory)