Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据

摘要:
1#设置。py2#---------01CMDB获取服务器的基本信息---------3importos45BASEDIR=os。路径dirname(os.path.dirname(os/path.abspath(__file__)))##当前路径67#收集资产的方法。选项包括:agent(默认)、salt、ssh8MODE='agent'910#--------01 CMDB获取服务器基础

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第1张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第3张
 1 #settings.py
 2 # ————————01CMDB获取服务器基本信息————————
 3 import os
 4 
 5 BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))##当前路径
 6 
 7 # 采集资产的方式,选项有:agent(默认), salt, ssh
 8 MODE = 'agent'
 9 
10 # ————————01CMDB获取服务器基本信息————————
11 
12 # ————————02CMDB将服务器基本信息提交到API接口————————
13 # 资产信息API
14 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
15 # ASSET_API = "http://127.0.0.1:8000/api/asset"
16 ASSET_API = "http://192.168.80.53:8000/api/asset"
17 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
18 
19 # ————————02CMDB将服务器基本信息提交到API接口————————
20 
21 # ————————03CMDB信息安全API接口交互认证————————
22 # 用于API认证的KEY
23 KEY = '299095cc-1330-11e5-b06a-a45e60bec08b' #认证的密码
24 # 用于API认证的请求头
25 AUTH_KEY_NAME = 'auth-key'
26 # ————————03CMDB信息安全API接口交互认证————————
27 
28 
29 # ————————04CMDB本地(Agent)模式客户端唯一标识(ID)————————
30 # Agent模式保存服务器唯一ID的文件
31 CERT_FILE_PATH = os.path.join(BASEDIR, 'config', 'cert') #文件路径
32 # ————————04CMDB本地(Agent)模式客户端唯一标识(ID)————————
33 
34 # ————————05CMDB采集硬件数据的插件————————
35 # 采集硬件数据的插件
36 PLUGINS_DICT = {
37     'cpu': 'src.plugins.cpu.CpuPlugin',
38     'disk': 'src.plugins.disk.DiskPlugin',
39     'main_board': 'src.plugins.main_board.MainBoardPlugin',
40     'memory': 'src.plugins.memory.MemoryPlugin',
41     'nic': 'src.plugins.nic.NicPlugin',
42 }
43 # ————————05CMDB采集硬件数据的插件————————
44 
45 # ————————07CMDB文件模式测试采集硬件数据————————
46 # 是否测试模式,测试模时候数据从files目录下读取信息  选项有:#True  False
47 TEST_MODE = True
48 # ————————07CMDB文件模式测试采集硬件数据————————
#settings.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第4张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第5张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第7张
 1 #base.py
 2 # ————————01CMDB获取服务器基本信息————————
 3 from config import settings  #配置文件
 4 
 5 class BasePlugin(object):
 6     def __init__(self, hostname=''):
 7 
 8         # ————————07CMDB文件模式测试采集硬件数据————————
 9         self.test_mode = settings.TEST_MODE#是否测试模式
10         # ————————07CMDB文件模式测试采集硬件数据————————
11 
12         if hasattr(settings, 'MODE'):
13             self.mode = settings.MODE #采集资产的方式
14         else:
15             self.mode = 'agent'#默认,采集资产的方式
16     def execute(self):
17 
18         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
19         # return self.windows()
20         try:#判断系统平台类型
21 
22             # ————————07CMDB文件模式测试采集硬件数据————————
23             if self.test_mode:  # 是否测试模式
24                 return self.test()  # 测试模式
25             # ————————07CMDB文件模式测试采集硬件数据————————
26 
27             import platform  # 获取操作系统信息 的模块
28             if platform.system() == 'Linux':
29                 return self.linux() #执行 #def linux(self):
30             elif platform.system() == 'Windows':
31                 return self.windows() #  执行 #def windows(self):
32         except Exception as e:
33             return '未知的系统平台类型!'
34         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
35 
36     def windows(self):
37         raise Exception('您必须实现windows的方法')
38 # ————————01CMDB获取服务器基本信息————————
39 
40     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
41     def linux(self):
42         raise Exception('您必须实现linux的方法')
43     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
44 
45     # ————————07CMDB文件模式测试采集硬件数据————————
46     def test(self):#测试模式
47         raise Exception('您必须实现test的方法')
48     # ————————07CMDB文件模式测试采集硬件数据————————
#base.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第8张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第9张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第10张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第12张
  1 # basic.py
  2 # ————————01CMDB获取服务器基本信息————————
  3 from .base import BasePlugin #采集资产的方式
  4 from lib.response import BaseResponse   #提交数据的类型
  5 import platform  #platform模块给我们提供了很多方法去获取操作系统的信息
  6 
  7 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  8 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
  9 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 10 """
 11 本模块基于windows操作系统,依赖wmi和win32com库,需要提前使用pip进行安装,
 12 我们依然可以通过pip install pypiwin32来安装win32com模块
 13 或者下载安装包手动安装。
 14 """
 15 
 16 class BasicPlugin(BasePlugin):
 17     def os_platform(self):#获取系统平台
 18         # ————————07CMDB文件模式测试采集硬件数据————————
 19         # output=platform.system() #windows和Linux 都可以执行
 20         # return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 21 
 22         try:
 23             if self.test_mode:  # 是否测试模式
 24                 output = 'Linux'  # 选择要测试的系统(windows和Linux或者苹果等未知的系统)
 25                 return output.strip()  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 26             output = platform.system() #windows和Linux 都可以执行
 27             return output.strip()  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 28         except Exception as e:
 29             return '未知的系统平台!'
 30         # ————————07CMDB文件模式测试采集硬件数据————————
 31 
 32     def os_version(self):#获取系统版本
 33         # output = wmi.WMI().Win32_OperatingSystem()[0].Caption
 34         # return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 35 
 36         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 37         try:
 38 
 39             # ————————07CMDB文件模式测试采集硬件数据————————
 40             if self.test_mode:  # 是否测试模式
 41                 output = """CentOS release 6.6 (Final)
Kernel 
 on an m"""
 42                 result = output.strip().split('
')[0]  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。#split() 通过指定分隔符对字符串进行切片
 43                 return result
 44             # ————————07CMDB文件模式测试采集硬件数据————————
 45 
 46             if platform.system() == 'Linux':
 47                 import subprocess  # 启动一个新的进程并且与之通信
 48                 output = subprocess.getoutput('cat /etc/issue')  # Linux系统下的命令
 49                 result = output.strip().split('
')[0]  # split() 通过指定分隔符对字符串进行切片
 50                 # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 51                 return result
 52             if platform.system() == 'Windows':
 53                 import wmi  # Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 54                 output = wmi.WMI().Win32_OperatingSystem()[0].Caption  # Windows系统下的命令
 55                 result = output.strip()
 56                 # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 57                 return result
 58         except Exception as e:
 59             return '未知的系统版本!'
 60         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 61 
 62     def os_hostname(self):#获取主机名
 63         # output = wmi.WMI().Win32_OperatingSystem()[0].CSName
 64         # return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 65 
 66         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 67         try:
 68 
 69             # ————————07CMDB文件模式测试采集硬件数据————————
 70             if self.test_mode:  # 是否测试模式
 71                 output = 'test.com'
 72                 return output.strip()  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 73             # ————————07CMDB文件模式测试采集硬件数据————————
 74 
 75             if platform.system() == 'Linux':
 76                 import subprocess  # 启动一个新的进程并且与之通信
 77                 output = subprocess.getoutput('hostname')  # Linux系统下的命令
 78                 return output.strip()  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 79             elif platform.system() == 'Windows':
 80                 import wmi # Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 81                 output = wmi.WMI().Win32_OperatingSystem()[0].CSName  # Windows系统下的命令
 82                 return output.strip()  # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
 83         except Exception as e:
 84             return '未知的主机名!'
 85         # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 86 
 87     def windows(self):
 88         response = BaseResponse()#提交数据的类型
 89         try:
 90             ret = {
 91                 'os_platform': self.os_platform(),#系统平台
 92                 'os_version': self.os_version(),#系统版本
 93                 'hostname': self.os_hostname(),#主机名
 94             }
 95             response.data = ret #字典形式
 96             print('windows服务器基本信息:',response.data)
 97         except Exception as e:
 98             response.status = False#获取信息时出现错误
 99         return response
100     """
101     class BaseResponse(object): #提交数据的类型
102     def __init__(self):
103         self.status = True      #状态
104         self.message = None     #消息
105         self.data = None        #数据内容
106         self.error = None       #错误信息
107 
108     """
109 # ————————01CMDB获取服务器基本信息————————
110 
111     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
112     def linux(self):
113         response = self.windows() #因为执行同样的方法,所以,就不重复写。
114         print('linux服务器基本信息:', response.data)
115         return response
116     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
117 
118     # ————————07CMDB文件模式测试采集硬件数据————————
119     def test(self):
120         response = self.windows() #因为执行同样的方法,所以,就不重复写。
121         print('test服务器基本信息:', response.data)
122         return response
123     # ————————07CMDB文件模式测试采集硬件数据————————
# basic.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第13张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第15张
 1 # cpu.py
 2 # ————————05CMDB采集硬件数据的插件————————
 3 from .base import BasePlugin  #采集资产的方式  和  系统平台
 4 from lib.response import BaseResponse #提交数据的类型(字典)
 5 
 6 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 7 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 8 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 9 
10 class CpuPlugin(BasePlugin):
11     def windows(self):
12         response = BaseResponse() #提交数据的类型(字典)
13         try:
14             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
15             import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
16             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
17             output =wmi.WMI().Win32_Processor() #获取CPU相关信息
18             response.data = self.windows_parse(output)  #解析相关信息 返回结果 #存到字典
19         except Exception as e:
20             response.status = False
21         return response
22 
23     @staticmethod#返回函数的静态方法
24     def windows_parse(content):
25         response = {}
26         cpu_physical_set = set()#set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
27         for item in content:
28             response['cpu_model'] = item.Manufacturer  # cpu型号
29             response['cpu_count'] = item.NumberOfCores  # cpu核心个量
30             cpu_physical_set.add(item.DeviceID) #CPU物理个量
31         response['cpu_physical_count'] = len(cpu_physical_set)#CPU物理个量
32         return response #返回结果
33 
34 # ————————05CMDB采集硬件数据的插件————————
35 
36     # ————————07CMDB文件模式测试采集硬件数据————————
37     def test(self):
38         response = BaseResponse() #提交数据的类型(字典)
39         import os  # 操作系统层面执行
40         from config.settings import BASEDIR  # 获取路径
41         try:
42             output = open(os.path.join(BASEDIR, 'files/linux_out/cpu.out'), 'r').read() #打开文件获取内容
43             response.data = self.linux_parse(output)#解析shell命令返回结果
44         except Exception as e:
45             response.status = False
46         return response
47     # ————————07CMDB文件模式测试采集硬件数据————————
48 
49 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
50     def linux(self):
51         response = BaseResponse()  # 提交数据的类型(字典)
52         try:
53             import subprocess  # 启动一个新的进程并且与之通信
54             shell_command = "cat /proc/cpuinfo"  # 定义命令 lscpu
55             output = subprocess.getoutput(shell_command)  # linux系统上执行的命令
56             response.data = self.linux_parse(output)  # 解析shell命令返回结果
57         except Exception as e:
58             response.status = False
59         return response
60 
61     @staticmethod  # 返回函数的静态方法
62     def linux_parse(content):  # 解析shell命令返回结果
63         response = {'cpu_count': 0, 'cpu_physical_count': 0, 'cpu_model': ''}
64         cpu_physical_set = set()  # set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
65         content = content.strip()  # strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
66         for item in content.split('

'):  # split()通过指定分隔符对字符串进行切片
67             for row_line in item.split('
'):
68                 key, value = row_line.split(':')
69                 key = key.strip()
70                 if key == 'processor':
71                     response['cpu_count'] += 1  # cpu核心个量
72                 elif key == 'physical id':
73                     cpu_physical_set.add(value)  # CPU物理个量
74                 elif key == 'model name':
75                     if not response['cpu_model']:
76                         response['cpu_model'] = value  # cpu型号
77         response['cpu_physical_count'] = len(cpu_physical_set)  # CPU物理个量
78         return response
79 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# cpu.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第16张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第18张
  1 # disk.py
  2 # ————————05CMDB采集硬件数据的插件————————
  3 from .base import BasePlugin  #采集资产的方式  和  系统平台
  4 from lib.response import BaseResponse #提交数据的类型(字典)
  5 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  6 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
  7 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  8 
  9 class DiskPlugin(BasePlugin):
 10     def windows(self):
 11         response = BaseResponse() #提交数据的类型(字典)
 12         try:
 13             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 14             import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 15             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 16             output =wmi.WMI().Win32_DiskDrive() #获取磁盘相关信息
 17             response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
 18         except Exception as e:
 19             response.status = False
 20         return response
 21 
 22     @staticmethod#返回函数的静态方法
 23     def windows_parse(content):
 24         response = {}
 25         for item in content:
 26             item_dict = {}
 27             item_dict['slot'] = item.Index                      #插槽位
 28             item_dict['pd_type'] = item.InterfaceType           #磁盘型号
 29             item_dict['capacity'] = round(int(item.Size) / (1024**3))   # 磁盘容量
 30             item_dict['model'] = item.Model  #磁盘类型
 31             response[item_dict['slot']] = item_dict #分割存每个 磁盘信息
 32         return response #返回结果
 33 # ————————05CMDB采集硬件数据的插件————————
 34 
 35     # ————————07CMDB文件模式测试采集硬件数据————————
 36     def test(self):
 37         response = BaseResponse() #提交数据的类型(字典)
 38         import os  # 操作系统层面执行
 39         from config.settings import BASEDIR  # 获取路径
 40         try:
 41             output = open(os.path.join(BASEDIR, 'files/linux_out/disk.out'), 'r').read() #打开文件获取内容 linux_virtual_out  linux_out
 42             response.data = self.linux_parse(output)#解析shell命令返回结果
 43         except Exception as e:#如果获取内容错误或者解析错误就换一个方式
 44             try:
 45                 output = open(os.path.join(BASEDIR, 'files/linux_virtual_out/disk.out'),'r').read()  # 打开文件获取内容 linux_virtual_out  linux_out
 46                 response.data = self.linux_virtual_parse(output)  # 解析shell命令返回结果
 47             except Exception as e:#如果 出现未知错误
 48                 response.status = False
 49         return response
 50 
 51     # ————————07CMDB文件模式测试采集硬件数据————————
 52 
 53 
 54     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 55     def linux(self):
 56         response = BaseResponse() #提交数据的类型(字典)
 57         try:
 58             import subprocess  # 启动一个新的进程并且与之通信
 59             shell_command = "sudo MegaCli  -PDList -aALL"  #定义命令#需要安装 MegaCli 模块
 60             output = subprocess.getoutput(shell_command) #linux系统上执行的命令
 61             if 'MegaCli'in output:
 62                 shell_command = "lsblk"  # 虚拟机 #lsblk
 63                 output = subprocess.getoutput(shell_command)  # linux系统上执行的命令
 64                 response.data = self.linux_virtual_parse(output)  # 解析shell命令返回结果
 65             else:
 66                 response.data = self.linux_parse(output)#解析shell命令返回结果
 67         except Exception as e:  # 如果 出现未知错误
 68             response.status = False
 69         return response
 70 
 71     def linux_virtual_parse(self, content):  # 解析shell命令返回结果
 72         content = [i for i in content.split('
') if i != '']  # split()通过指定分隔符对字符串进行切片
 73         key_list = [i for i in content[0].split(' ') if i != '']  # split()通过指定分隔符对字符串进行切片
 74         key_list[0] = 'slot'  # 替换key的名字
 75         key_list[3] = 'capacity'
 76         key_list[5] = 'pd_type'
 77         ram_dict = {}
 78         for i in content[1:]:  # 从列表下标1开始循环
 79             segment = {}
 80             value = [x for x in i.split(' ') if x != '']  # 如果不是空值就循环   # split()通过指定分隔符对字符串进行切片
 81             filter = str(value)  # 列表转成字符串进行判断
 82             if '' not in filter:  # '─'  '攢' #二级逻辑硬盘
 83                 if '' not in filter:  # '─'  '攢' #二级逻辑硬盘
 84                     list = zip(key_list, value)  # zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。
 85                     for k, v in list:
 86                         if k == 'capacity':  # 处理单位问题
 87                             if 'G' in v:
 88                                 l = v.split('G')  # split()通过指定分隔符对字符串进行切片
 89                                 v = l[0]
 90                             if 'M' in v:  # 处理单位问题
 91                                 l = v.split('M')  # split()通过指定分隔符对字符串进行切片
 92                                 s = l[0]
 93                                 m = int(s)
 94                                 v = m / 1024
 95                         segment[k] = v
 96                     ram_dict[value[0]] = segment
 97         return ram_dict
 98 
 99     def linux_parse(self, content):  # 解析shell命令返回结果
100         import re  # 正则表达式
101         response = {}
102         result = []
103         for row_line in content.split("



"):  # split()通过指定分隔符对字符串进行切片
104             result.append(row_line)  # 添加到列表
105         for item in result:  # 循环列表
106             temp_dict = {}
107             for row in item.split('
'):  # split()通过指定分隔符对字符串进行切片
108                 if not row.strip():  # strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
109                     continue
110                 if len(row.split(':')) != 2:  # 测试长度
111                     continue
112                 key, value = row.split(':')  # split()通过指定分隔符对字符串进行切片
113                 name = self.mega_patter_match(key)
114                 if name:
115                     if key == 'Raw Size':  # 磁盘容量
116                         raw_size = re.search('(d+.d+)',
117                                              value.strip())  # Raw Size: 279.396 GB [0x22ecb25c Sectors]
118                         if raw_size:
119                             temp_dict[name] = raw_size.group()
120                         else:
121                             raw_size = '0'
122                     else:
123                         temp_dict[name] = value.strip()  # 磁盘型号  #磁盘类型
124             if temp_dict:
125                 response[temp_dict['slot']] = temp_dict  # 插槽位 #分割存每个 磁盘信息
126         return response
127 
128     @staticmethod  # 返回函数的静态方法
129     def mega_patter_match(needle):
130         grep_pattern = {'Slot': 'slot', 'Raw Size': 'capacity', 'Inquiry': 'model', 'PD Type': 'pd_type'}
131         for key, value in grep_pattern.items():
132             if needle.startswith(key):  # 确定此字符串实例的开头是否与指定的字符串匹配
133                 return value
134         return False
135     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# disk.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第19张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第21张
 1 # main_board.py
 2 # ————————05CMDB采集硬件数据的插件————————
 3 from .base import BasePlugin #采集资产的方式  和  系统平台
 4 from lib.response import BaseResponse  #提交数据的类型(字典)
 5 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 6 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 7 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 8 
 9 class MainBoardPlugin(BasePlugin):
10     def windows(self):
11         response = BaseResponse() #提交数据的类型(字典)
12         try:
13             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
14             import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
15             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
16             output =wmi.WMI().Win32_BaseBoard() #获取主板相关信息
17             response.data = self.windows_parse(output)  #解析相关信息 返回结果 #存到字典
18         except Exception as e:
19             response.status = False
20         return response
21 
22     @staticmethod#返回函数的静态方法
23     def windows_parse(content):
24         response = {}
25         for item in content:
26             response['Manufacturer'] = item.Manufacturer #主板制造商
27             response['model'] = item.Name                 #主板型号
28             response['sn'] = item.SerialNumber             #主板SN号
29         return response #返回结果
30 # ————————05CMDB采集硬件数据的插件————————
31 
32     # ————————07CMDB文件模式测试采集硬件数据————————
33     def test(self):
34         response = BaseResponse() #提交数据的类型(字典)
35         import os  # 操作系统层面执行
36         from config.settings import BASEDIR  # 获取路径
37         try:
38             output = open(os.path.join(BASEDIR, 'files/linux_out/board.out'), 'r').read() #打开文件获取内容
39             response.data = self.linux_parse(output)#解析shell命令返回结果
40         except Exception as e:
41             response.status = False
42         return response
43     # ————————07CMDB文件模式测试采集硬件数据————————
44 
45 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
46     def linux(self):
47         response = BaseResponse() #提交数据的类型(字典)
48         try:
49             import subprocess  # 启动一个新的进程并且与之通信
50             shell_command = "sudo dmidecode -t1" #定义命令
51             output =subprocess.getoutput(shell_command) #linux系统上执行的命令
52             response.data = self.linux_parse(output) #解析shell命令返回结果
53         except Exception as e:
54             response.status = False
55         return response
56 
57     def linux_parse(self, content):#解析shell命令返回结果
58         result = {}
59         key_map = {'Manufacturer': 'manufacturer', 'Product Name': 'model','Serial Number': 'sn',}
60         for item in content.split('
'): #split()通过指定分隔符对字符串进行切片
61             row_data = item.strip().split(':') #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
62             if len(row_data) == 2:
63                 if row_data[0] in key_map:#如果在需要的字典里
64                     result[key_map[row_data[0]]] = row_data[1].strip() if row_data[1] else row_data[1]
65         return result
66     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# main_board.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第22张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第24张
  1 # memory.py
  2 # ————————05CMDB采集硬件数据的插件————————
  3 from .base import BasePlugin  #采集资产的方式  和  系统平台
  4 from lib.response import BaseResponse #提交数据的类型(字典)
  5 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  6 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
  7 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  8 
  9 class MemoryPlugin(BasePlugin):
 10     def windows(self):
 11         response = BaseResponse()  #提交数据的类型(字典)
 12         try:
 13             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 14             import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 15             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 16             output =wmi.WMI().Win32_PhysicalMemory()  #获取内存相关信息
 17             response.data = self.windows_parse(output)
 18         except Exception as e:
 19             response.status = False
 20         return response
 21 
 22     @staticmethod#返回函数的静态方法
 23     def windows_parse(content):
 24         response={}
 25         for item in content:
 26             item_dict = {}
 27             item_dict['slot'] = item.DeviceLocator                          #插槽位
 28             item_dict['manufacturer'] = item.Manufacturer                   # 内存制造商
 29             item_dict['model'] =item.FormFactor                             # 内存型号
 30             item_dict['Capacity'] = round(int(item.Capacity) / (1024**3))   # 内存容量
 31             item_dict['sn'] = item.SerialNumber                              #内存SN号
 32             item_dict['speed'] = item.Speed                                 #内存速度
 33             response[item_dict['slot']] = item_dict                         #分割存每条  内存信息
 34         return response
 35 
 36 # ————————05CMDB采集硬件数据的插件————————
 37     # ————————07CMDB文件模式测试采集硬件数据————————
 38     def test(self):
 39         response = BaseResponse() #提交数据的类型(字典)
 40         import os  # 操作系统层面执行
 41         from config.settings import BASEDIR  # 获取路径
 42         try:
 43             output = open(os.path.join(BASEDIR, 'files/linux_out/memory.out'), 'r').read()  #打开文件获取内容 linux_virtual_out linux_out
 44             response.data = self.linux_parse(output)  # 解析shell命令返回结果
 45         except Exception as e:#如果获取内容错误或者解析错误就换一个方式
 46             try:
 47                 output = open(os.path.join(BASEDIR, 'files/linux_virtual_out/memory.out'),'r').read()  # 打开文件获取内容 linux_virtual_out  linux_out
 48                 response.data = self.linux_virtual_parse(output)  # 解析shell命令返回结果
 49             except Exception as e:
 50                 response.status = False
 51         return response
 52     # ————————07CMDB文件模式测试采集硬件数据————————
 53 
 54 
 55     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 56     def linux(self):
 57         response = BaseResponse() #提交数据的类型(字典)
 58         try:
 59             import subprocess  # 启动一个新的进程并且与之通信
 60             shell_command = "sudo dmidecode  -q -t 17 2>/dev/null" #定义命令 cat /proc/swaps   #swapon
 61             output = subprocess.getoutput(shell_command) #linux系统上执行的命令
 62             if not output:
 63                 shell_command = "swapon"  # 定义命令 cat /proc/swaps   #swapon
 64                 output = subprocess.getoutput(shell_command)  # linux系统上执行的命令
 65                 response.data = self.linux_virtual_parse(output)  # 解析shell命令返回结果
 66             else:
 67                 response.data = self.linux_parse(output) # 解析shell命令返回结果
 68         except Exception as e:  # 如果 出现未知错误
 69             response.status = False
 70         return response
 71 
 72     def convert_mb_to_gb(self,value, default=0):#转换单位
 73         try:
 74             value = value.strip('MB') #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
 75             result = int(value)
 76         except Exception as e:
 77             result = default
 78         return result
 79 
 80     def linux_virtual_parse(self, content):  # 解析shell命令返回结果
 81         content = [i for i in content.split('
') if i != '']  # split()通过指定分隔符对字符串进行切片
 82         key_list = [i for i in content[0].split(' ') if i != '']  # split()通过指定分隔符对字符串进行切片
 83         key_list[0] = 'slot'  #替换key的名字
 84         key_list[1] = 'model'
 85         key_list[2] = 'capacity'
 86         ram_dict = {}
 87         for i in content[1:]:  # 从列表下标1开始循环
 88             segment = {}
 89             value = [x for x in i.split(' ') if x != '']#如果不是空值就循环   # split()通过指定分隔符对字符串进行切片
 90             list = zip(key_list, value)  # zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。
 91             for k, v in list:
 92                 if k=='capacity': #处理单位问题
 93                     if 'M' in v:
 94                         l = v.split('M') # split()通过指定分隔符对字符串进行切片
 95                         v = l[0]
 96                     if 'G' in v:  # 处理单位问题
 97                         l = v.split('G') # split()通过指定分隔符对字符串进行切片
 98                         s = l[0]
 99                         m = int(s)
100                         v = m * 1024
101                 segment[k] = v
102             ram_dict[value[0]] = segment
103         return ram_dict
104 
105     def linux_parse(self, content): # 解析shell命令返回结果
106         ram_dict = {}
107         key_map = {'Size': 'capacity','Locator': 'slot','Type': 'model','Speed': 'speed',
108                    'Manufacturer': 'manufacturer','Serial Number': 'sn',}
109         devices = content.split('Memory Device') #split()通过指定分隔符对字符串进行切片
110         for item in devices:
111             item = item.strip() #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
112             if not item:
113                 continue
114             if item.startswith('#'): #startswith()方法用于检查字符串是否是以指定子字符串开头
115                 continue
116             segment = {}
117             lines = item.split('
	')  #split()通过指定分隔符对字符串进行切片
118             for line in lines:
119                 if len(line.split(':')) > 1:  #split()通过指定分隔符对字符串进行切片
120                     key, value = line.split(':')  #split()通过指定分隔符对字符串进行切片
121                 else:
122                     key = line.split(':')[0]  #split()通过指定分隔符对字符串进行切片
123                     value = ""
124                 if key in key_map:
125                     if key == 'Size':  # 内存容量
126                         segment[key_map['Size']] = self.convert_mb_to_gb(value, 0) #转换单位
127                     else:
128                         segment[key_map[key.strip()]] = value.strip() #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
129             ram_dict[segment['slot']] = segment   #插槽位 #分割存每条  内存信息
130         return ram_dict
131     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# memory.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第25张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第27张
  1 # nic.py
  2 # ————————05CMDB采集硬件数据的插件————————
  3 from .base import BasePlugin  #采集资产的方式  和  系统平台
  4 from lib.response import BaseResponse #提交数据的类型(字典)
  5 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  6 # import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
  7 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
  8 
  9 class NicPlugin(BasePlugin):
 10     def windows(self):
 11         response = BaseResponse() #提交数据的类型(字典)
 12         try:
 13             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 14             import wmi#Windows操作系统上管理数据和操作的基础设施   #linux写无法导入这个模块
 15             # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 16             output =wmi.WMI().Win32_NetworkAdapterConfiguration() #获取网卡相关信息
 17             response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
 18         except Exception as e:
 19             response.status = False
 20         return response
 21 
 22     @staticmethod#返回函数的静态方法
 23     def windows_parse(content):
 24         response={}
 25         IPCM = 0  # 权重
 26         for item in content:
 27             if item.IPConnectionMetric: # 权重
 28                 if item.IPConnectionMetric > IPCM: # 权重 #防止虚拟网卡
 29                     item_dict = {}
 30                     name=item.ServiceName                       # 网卡名称
 31                     item_dict['hwaddr'] = item.MACAddress      # 网卡MAC地址
 32                     item_dict['ipaddrs'] = item.IPAddress[0]    # IP地址
 33                     item_dict['netmask'] = item.IPSubnet[0]     # IP子网掩码
 34                     item_dict['up'] = item.IPEnabled            #是否有启用
 35                     response[name] = item_dict
 36                     IPCM = item.IPConnectionMetric  # 权重
 37         return response
 38 # ————————05CMDB采集硬件数据的插件————————
 39 
 40     # ————————07CMDB文件模式测试采集硬件数据————————
 41     def test(self):
 42         response = BaseResponse() #提交数据的类型(字典)
 43         import os  # 操作系统层面执行
 44         from config.settings import BASEDIR  # 获取路径
 45         try:
 46             output = open(os.path.join(BASEDIR, 'files/linux_out/nic.out'), 'r').read()  #打开文件获取内容
 47             interfaces_info = self._interfaces_ip(output)  #接口 # 解析shell命令返回结果
 48             self.standard(interfaces_info) # 内容进行 标准化
 49             response.data = interfaces_info # 解析shell命令返回结果
 50         except Exception as e:
 51             response.status = False
 52         return response
 53     # ————————07CMDB文件模式测试采集硬件数据————————
 54 
 55 
 56     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
 57     def linux(self):
 58         response = BaseResponse() #提交数据的类型(字典)
 59         try:
 60             interfaces_info = self.linux_interfaces() #linux系统上执行的命令
 61             self.standard(interfaces_info)  # 内容进行 标准化
 62             response.data = interfaces_info # 解析shell命令返回结果
 63         except Exception as e:
 64             response.status = False
 65         return response
 66 
 67     def standard(self, interfaces_info):# 内容进行 标准化
 68         for key, value in interfaces_info.items():
 69             ipaddrs = set()#set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
 70             netmask = set()
 71             if not 'inet' in value:
 72                 value['ipaddrs'] = ''           # IP地址
 73                 value['netmask'] = ''           # IP子网掩码
 74             else:
 75                 for item in value['inet']:
 76                     ipaddrs.add(item['address'])  # IP地址
 77                     netmask.add(item['netmask'])  # IP子网掩码
 78                 value['ipaddrs'] = '/'.join(ipaddrs) # IP地址
 79                 value['netmask'] = '/'.join(netmask) # IP子网掩码
 80                 del value['inet']
 81 
 82     def linux_interfaces(self):#获得* NIX / BSD变种接口信息
 83         ifaces = dict() #dict() 函数用于创建一个字典。返回一个字典。
 84         ip_path = 'ip'
 85         if ip_path:
 86             # ————————在使用#linux系统上执行的命令时开启————————
 87             import subprocess  # 启动一个新的进程并且与之通信
 88             cmd1 = subprocess.getoutput('sudo {0} link show'.format(ip_path)) #定义命令ip link show
 89             cmd2 = subprocess.getoutput('sudo {0} addr show'.format(ip_path)) #定义命令ip addr show
 90             ifaces = self._interfaces_ip(cmd1 + '
' + cmd2)  #linux系统上执行的命令 #接口 # 解析shell命令返回结果
 91             # ————————在使用#linux系统上执行的命令时开启————————
 92         return ifaces
 93 
 94     def which(self, exe):
 95         import os  # 操作系统层面执行
 96         def _is_executable_file_or_link(exe):
 97             # 检查操作系统。X_OK不足够了,因为目录可能会执行
 98             return (os.access(exe, os.X_OK) and
 99                     (os.path.isfile(exe) or os.path.islink(exe)))
100 
101         if exe:
102             if _is_executable_file_or_link(exe):
103                 # executable in cwd or fullpath
104                 return exe
105 
106             # 默认路径基于busybox的默认
107             default_path = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin'
108             search_path = os.environ.get('PATH', default_path)
109             path_ext = os.environ.get('PATHEXT', '.EXE')
110             ext_list = path_ext.split(';')
111 
112             search_path = search_path.split(os.pathsep)
113             if True:
114                 """
115             # 添加任何dirs default_path search_path不。如果
116             # 没有PATH变量中发现操作系统。环境,那么这将是
117             # 无为法。这将确保所有dirs default_path
118             # 搜索,让salt.utils.which()调用时工作得很好
119             # salt-call从cron(取决于平台
120             # 有一个极其有限的路径)。
121               """
122                 search_path.extend(
123                     [
124                         x for x in default_path.split(os.pathsep)
125                         if x not in search_path
126                     ]
127                 )
128             for path in search_path:
129                 full_path = os.path.join(path, exe)
130                 if _is_executable_file_or_link(full_path):
131                     return full_path
132         return None
133 
134     def _number_of_set_bits_to_ipv4_netmask(self, set_bits):  # pylint: disable=C0103
135         '''
136         返回一个整数表示的IPv4网络掩码,面具。
137 
138         Ex. 0xffffff00 -> '255.255.255.0'
139         '''
140         return self.cidr_to_ipv4_netmask(self._number_of_set_bits(set_bits))
141     def cidr_to_ipv4_netmask(self, cidr_bits):
142         '''
143         返回一个IPv4网络掩码
144         '''
145         try:
146             cidr_bits = int(cidr_bits)
147             if not 1 <= cidr_bits <= 32:
148                 return ''
149         except ValueError:
150             return ''
151         netmask = ''
152         for idx in range(4):
153             if idx:
154                 netmask += '.'
155             if cidr_bits >= 8:
156                 netmask += '255'
157                 cidr_bits -= 8
158             else:
159                 netmask += '{0:d}'.format(256 - (2 ** (8 - cidr_bits)))
160                 cidr_bits = 0
161         return netmask
162     def _number_of_set_bits(self, x):
163         '''
164         返回的比特数,设置在一个32位整数
165         #来自http://stackoverflow.com/a/4912729
166         '''
167         x -= (x >> 1) & 0x55555555
168         x = ((x >> 2) & 0x33333333) + (x & 0x33333333)
169         x = ((x >> 4) + x) & 0x0f0f0f0f
170         x += x >> 8
171         x += x >> 16
172         return x & 0x0000003f
173 
174     def _interfaces_ip(self, out): #接口 # 解析shell命令返回结果
175         import re  # 正则表达式
176         '''
177       使用ip来返回一个字典的接口的各种信息
178       每个(向上/向下状态、ip地址、子网掩码和hwaddr)
179         '''
180         ret = dict()
181         right_keys = ['name', 'hwaddr', 'up', 'netmask', 'ipaddrs']
182 
183         def parse_network(value, cols):
184             '''
185           子网掩码,返回一个元组的ip广播
186           基于当前的关口
187             '''
188             brd = None
189             if '/' in value:  # 我们有一个CIDR在这个地址
190                 ip, cidr = value.split('/')  # pylint:禁用= C0103
191             else:
192                 ip = value  # pylint:禁用= C0103
193                 cidr = 32
194 
195             if type_ == 'inet':
196                 mask = self.cidr_to_ipv4_netmask(int(cidr))
197                 if 'brd' in cols:
198                     brd = cols[cols.index('brd') + 1]
199             return (ip, mask, brd)
200 
201         groups = re.compile('
?
\d').split(out)
202         for group in groups:
203             iface = None
204             data = dict()
205 
206             for line in group.splitlines():
207                 if ' ' not in line:
208                     continue
209                 match = re.match(r'^d*:s+([w.-]+)(?:@)?([w.-]+)?:s+<(.+)>', line)
210                 if match:
211                     iface, parent, attrs = match.groups()
212                     if 'UP' in attrs.split(','):
213                         data['up'] = True
214                     else:
215                         data['up'] = False
216                     if parent and parent in right_keys:
217                         data[parent] = parent
218                     continue
219 
220                 cols = line.split()
221                 if len(cols) >= 2:
222                     type_, value = tuple(cols[0:2])
223                     iflabel = cols[-1:][0]
224                     if type_ in ('inet',):
225                         if 'secondary' not in cols:
226                             ipaddr, netmask, broadcast = parse_network(value, cols)
227                             if type_ == 'inet':
228                                 if 'inet' not in data:
229                                     data['inet'] = list()
230                                 addr_obj = dict()
231                                 addr_obj['address'] = ipaddr
232                                 addr_obj['netmask'] = netmask
233                                 addr_obj['broadcast'] = broadcast
234                                 data['inet'].append(addr_obj)
235 
236                         else:
237                             if 'secondary' not in data:
238                                 data['secondary'] = list()
239                             ip_, mask, brd = parse_network(value, cols)
240                             data['secondary'].append({
241                                 'type': type_,
242                                 'address': ip_,
243                                 'netmask': mask,
244                                 'broadcast': brd,
245                             })
246                             del ip_, mask, brd
247                     elif type_.startswith('link'):
248                         data['hwaddr'] = value
249             if iface:
250                 if iface.startswith('pan') or iface.startswith('lo') or iface.startswith('v'):
251                     del iface, data
252                 else:
253                     ret[iface] = data
254                     del iface, data
255         return ret
256     # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# nic.py

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第28张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第30张
{"os_platform": "Linux",
 "os_version": "CentOS release 6.6 (Final)",
"hostname": "c1.com",


"cpu": {"status": true, "message": null,
"data":{"cpu_count": 24, "cpu_physical_count": 2, "cpu_model": " Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz"},
"error": null},

"disk": {"status": true, "message": null,
 "data":{"0": {"slot": "0", "pd_type": "SAS", "capacity": "279.396", "model": "SEAGATE ST300MM0006     LS08S0K2B5NV"},
         "1": {"slot": "1", "pd_type": "SAS", "capacity": "279.396", "model": "SEAGATE ST300MM0006     LS08S0K2B5AH"},
         "2": {"slot": "2", "pd_type": "SATA", "capacity": "476.939", "model": "S1SZNSAFA01085L     Samsung SSD 850 PRO 512GB               EXM01B6Q"},
         "3": {"slot": "3", "pd_type": "SATA", "capacity": "476.939", "model": "S1AXNSAF912433K     Samsung SSD 840 PRO Series              DXM06B0Q"},
         "4": {"slot": "4", "pd_type": "SATA", "capacity": "476.939", "model": "S1AXNSAF303909M     Samsung SSD 840 PRO Series              DXM05B0Q"},
         "5": {"slot": "5", "pd_type": "SATA", "capacity": "476.939", "model": "S1AXNSAFB00549A     Samsung SSD 840 PRO Series              DXM06B0Q"}},
"error": null},


 "main_board": {"status": true, "message": null,
 "data":{"manufacturer": "Parallels Software International Inc.","model": "Parallels Virtual Platform","sn": "Parallels-1A 1B CB 3B 64 66 4B 13 86 B0 86 FF 7E 2B 20 30"},
"error": null},

"memory": {"status": true, "message": null,
"data":{"DIMM #0": {"capacity": 1024, "slot": "DIMM #0", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #1": {"capacity": 0, "slot": "DIMM #1", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #2": {"capacity": 0, "slot": "DIMM #2", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #3": {"capacity": 0, "slot": "DIMM #3", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #4": {"capacity": 0, "slot": "DIMM #4", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #5": {"capacity": 0, "slot": "DIMM #5", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #6": {"capacity": 0, "slot": "DIMM #6", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"},
        "DIMM #7": {"capacity": 0, "slot": "DIMM #7", "model": "DRAM", "speed": "667 MHz", "manufacturer": "Not Specified", "sn": "Not Specified"}},
"error": null},

 "nic": {"status": true, "message": null,
 "data":{"eth0": {"up": true, "hwaddr": "00:1c:42:a5:57:7a", "ipaddrs": "10.211.55.4", "netmask": "255.255.255.0"}},
"error": null}}
all
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第32张
SMBIOS 2.7 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: Parallels Software International Inc.
    Product Name: Parallels Virtual Platform
    Version: None
    Serial Number: Parallels-1A 1B CB 3B 64 66 4B 13 86 B0 86 FF 7E 2B 20 30
    UUID: 3BCB1B1A-6664-134B-86B0-86FF7E2B2030
    Wake-up Type: Power Switch
    SKU Number: Undefined
    Family: Parallels VM
board.out
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第34张
processor    : 0
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 0
cpu cores    : 6
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 1
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 0
cpu cores    : 6
apicid        : 32
initial apicid    : 32
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 2
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 1
cpu cores    : 6
apicid        : 2
initial apicid    : 2
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 3
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 1
cpu cores    : 6
apicid        : 34
initial apicid    : 34
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 4
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 2
cpu cores    : 6
apicid        : 4
initial apicid    : 4
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 5
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 2
cpu cores    : 6
apicid        : 36
initial apicid    : 36
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 6
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 3
cpu cores    : 6
apicid        : 6
initial apicid    : 6
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 7
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 3
cpu cores    : 6
apicid        : 38
initial apicid    : 38
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 8
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 4
cpu cores    : 6
apicid        : 8
initial apicid    : 8
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 9
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 4
cpu cores    : 6
apicid        : 40
initial apicid    : 40
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 10
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 5
cpu cores    : 6
apicid        : 10
initial apicid    : 10
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 11
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 5
cpu cores    : 6
apicid        : 42
initial apicid    : 42
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 12
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 0
cpu cores    : 6
apicid        : 1
initial apicid    : 1
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 13
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 0
cpu cores    : 6
apicid        : 33
initial apicid    : 33
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 14
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 1
cpu cores    : 6
apicid        : 3
initial apicid    : 3
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 15
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 1
cpu cores    : 6
apicid        : 35
initial apicid    : 35
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 16
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 2
cpu cores    : 6
apicid        : 5
initial apicid    : 5
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 17
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 2
cpu cores    : 6
apicid        : 37
initial apicid    : 37
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 18
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 3
cpu cores    : 6
apicid        : 7
initial apicid    : 7
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 19
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 3
cpu cores    : 6
apicid        : 39
initial apicid    : 39
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 20
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 4
cpu cores    : 6
apicid        : 9
initial apicid    : 9
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 21
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 4
cpu cores    : 6
apicid        : 41
initial apicid    : 41
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 22
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 0
siblings    : 12
core id        : 5
cpu cores    : 6
apicid        : 11
initial apicid    : 11
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.84
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:

processor    : 23
vendor_id    : GenuineIntel
cpu family    : 6
model        : 62
model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
stepping    : 4
cpu MHz        : 2099.921
cache size    : 15360 KB
physical id    : 1
siblings    : 12
core id        : 5
cpu cores    : 6
apicid        : 43
initial apicid    : 43
fpu        : yes
fpu_exception    : yes
cpuid level    : 13
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm ida arat xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms
bogomips    : 4199.42
clflush size    : 64
cache_alignment    : 64
address sizes    : 46 bits physical, 48 bits virtual
power management:
cpu
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第36张
                                     
Adapter #0

Enclosure Device ID: 32
Slot Number: 0
Drive's postion: DiskGroup: 0, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 0
WWN: 5000C5007272C288
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.875 GB [0x22dc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: LS08
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5007272c289
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST300MM0006     LS08S0K2B5NV            
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive Temperature :29C (84.20 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: Unknown 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 32
Slot Number: 1
Drive's postion: DiskGroup: 0, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 1
WWN: 5000C5007272DE74
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SAS
Raw Size: 279.396 GB [0x22ecb25c Sectors]
Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
Coerced Size: 278.875 GB [0x22dc0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: LS08
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x5000c5007272de75
SAS Address(1): 0x0
Connected Port Number: 0(path0) 
Inquiry Data: SEAGATE ST300MM0006     LS08S0K2B5AH            
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Hard Disk Device
Drive Temperature :29C (84.20 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Port-1 :
Port status: Active
Port's Linkspeed: Unknown 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 32
Slot Number: 2
Drive's postion: DiskGroup: 1, Span: 0, Arm: 0
Enclosure position: 0
Device Id: 2
WWN: 50025388A075B731
Sequence Number: 2
Media Error Count: 0
Other Error Count: 1158
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: 1B6Q
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x500056b37789abee
Connected Port Number: 0(path0) 
Inquiry Data: S1SZNSAFA01085L     Samsung SSD 850 PRO 512GB               EXM01B6Q
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :25C (77.00 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Drive's NCQ setting : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 32
Slot Number: 3
Drive's postion: DiskGroup: 1, Span: 0, Arm: 1
Enclosure position: 0
Device Id: 3
WWN: 50025385A02A074F
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: 6B0Q
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x500056b37789abef
Connected Port Number: 0(path0) 
Inquiry Data: S1AXNSAF912433K     Samsung SSD 840 PRO Series              DXM06B0Q
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :28C (82.40 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Drive's NCQ setting : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 32
Slot Number: 4
Drive's postion: DiskGroup: 1, Span: 1, Arm: 0
Enclosure position: 0
Device Id: 4
WWN: 50025385A01FD838
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: 5B0Q
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x500056b37789abf0
Connected Port Number: 0(path0) 
Inquiry Data: S1AXNSAF303909M     Samsung SSD 840 PRO Series              DXM05B0Q
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :27C (80.60 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Drive's NCQ setting : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No



Enclosure Device ID: 32
Slot Number: 5
Drive's postion: DiskGroup: 1, Span: 1, Arm: 1
Enclosure position: 0
Device Id: 5
WWN: 50025385A02AB5C9
Sequence Number: 2
Media Error Count: 0
Other Error Count: 0
Predictive Failure Count: 0
Last Predictive Failure Event Seq Number: 0
PD Type: SATA
Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
Firmware state: Online, Spun Up
Device Firmware Level: 6B0Q
Shield Counter: 0
Successful diagnostics completion on :  N/A
SAS Address(0): 0x500056b37789abf1
Connected Port Number: 0(path0) 
Inquiry Data: S1AXNSAFB00549A     Samsung SSD 840 PRO Series              DXM06B0Q
FDE Enable: Disable
Secured: Unsecured
Locked: Unlocked
Needs EKM Attention: No
Foreign State: None 
Device Speed: 6.0Gb/s 
Link Speed: 6.0Gb/s 
Media Type: Solid State Device
Drive:  Not Certified
Drive Temperature :28C (82.40 F)
PI Eligibility:  No 
Drive is formatted for PI information:  No
PI: No PI
Drive's write cache : Disabled
Drive's NCQ setting : Disabled
Port-0 :
Port status: Active
Port's Linkspeed: 6.0Gb/s 
Drive has flagged a S.M.A.R.T alert : No




Exit Code: 0x00
disk.out
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第38张
Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: 1024 MB
    Form Factor: DIMM
    Set: None
    Locator: DIMM #0
    Bank Locator: BANK #0
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #1
    Bank Locator: BANK #1
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #2
    Bank Locator: BANK #2
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #3
    Bank Locator: BANK #3
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #4
    Bank Locator: BANK #4
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #5
    Bank Locator: BANK #5
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #6
    Bank Locator: BANK #6
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown

Memory Device
    Total Width: 32 bits
    Data Width: 32 bits
    Size: No Module Installed
    Form Factor: DIMM
    Set: None
    Locator: DIMM #7
    Bank Locator: BANK #7
    Type: DRAM
    Type Detail: EDO
    Speed: 667 MHz
    Manufacturer: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Part Number: Not Specified
    Rank: Unknown
memory.out
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第40张
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1c:42:a5:57:7a brd ff:ff:ff:ff:ff:ff
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 52:54:00:a3:74:29 brd ff:ff:ff:ff:ff:ff
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
    link/ether 52:54:00:a3:74:29 brd ff:ff:ff:ff:ff:ff
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1c:42:a5:57:7a brd ff:ff:ff:ff:ff:ff
    inet 10.211.55.4/24 brd 10.211.55.255 scope global eth0
    inet6 fdb2:2c26:f4e4:0:21c:42ff:fea5:577a/64 scope global dynamic
       valid_lft 2591752sec preferred_lft 604552sec
    inet6 fe80::21c:42ff:fea5:577a/64 scope link
       valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 52:54:00:a3:74:29 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
    link/ether 52:54:00:a3:74:29 brd ff:ff:ff:ff:ff:ff
nic.out

 Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第41张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第43张
 {    'os_platform': 'Linux',    'os_version': '\S',    'hostname': 'DKL18U83RFAQI3G','cpu': {'status': True,'message': None,
        'data': {'cpu_count': 1,'cpu_physical_count': 1,'cpu_model': ' Intel(R) Celeron(R) CPU        E3500  @ 2.70GHz'        },
        'error': None    },

    'disk': {'status': False,'message': None,'data': None,
        'error': None    },

    'main_board': {'status': True,'message': None,
        'data': {'manufacturer': 'innotek GmbH','model': 'VirtualBox','sn': '0'},
        'error': None    },

    'memory': {'status': True,'message': None,
        'data': {'/dev/dm-1': {'slot': '/dev/dm-1','model': 'partition','capacity': '820','USED': '8K','PRIO': '-1'}},
        'error': None    },

    'nic': {'status': True,        'message': None,
        'data': {'enp0s8': {'up': True,'hwaddr': '08:00:27:75:03:bb','ipaddrs': '192.168.80.76','netmask': '255.255.255.0'}    },
        'error': None
    }
}
all
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第45张
1 NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
2 sda               8:0    0    8.3G  0 disk
3 ├─sda1            8:1    0    1G  0 part /boot
4 └─sda2            8:2    0    7G  0 part
5   ├─centos-root 253:0    0  6.2G  0 lvm  /
6   └─centos-swap 253:1    0  820M  0 lvm  [SWAP]
7 sdb               8:16   0  1.3G  0 disk
8 sdc               8:32   0  3.1G  0 disk
9 sr0              11:0    1 1024M  0 rom
disk.out
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第2张Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第47张
NAME      TYPE      SIZE USED PRIO
/dev/dm-1 partition 820M   0B   -1
/dev/dm-2 partition 2G   0B   -2
memory.out

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第48张

Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据第49张

免责声明:文章转载自《Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Win10 UWP 开发系列:使用多语言工具包让应用支持多语言OC与JS的交互(iOS与H5混编)下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

澄清VB调用API时字符串参数的困惑

声明:本文部分内容来源于网络! 首先,我认为这样花费精力去研究VB调用API字符串的种种猫腻是很有必要的。本着严谨和发现问题与解决问题的原则,和为了能更好的认识问题的本质,我特写了这篇冗长的讨论。网上有很多关于此的讨论,但比较杂乱,目的不明确,也很难懂。在此也就是做个总结吧!让大家能有一个清楚认识。 我的问题是从调用内存API时参数的ByVal VarPt...

Django三种风格模型继承

Django三种风格的模型继承 只要继承了model.Model, 就会生成一个新的表,但是,如果在Meta方法中添加abstract=True,就不会产生新的表,而是作为一个基类存放多个表共同拥有的方法和字段等 抽象类继承:父类继承自models.Model,但不会在底层数据库中生成相应的数据表,父类的属性列存储在其子类的数据表中。 多表继承:父类和子...

django 菜单权限

一.什么是权限 能做哪些事情,不能做哪些事情,可以做的权限 二.设计权限 思路: web应用中,所谓的权限,其实就是一个用户能够访问的url,通过对用户访问的url进行控制,从而实现对用户权限的控制. 每个用户代表不同的的角色,每个角色具有不同的权限. 一个用户可以有多重角色,多个人也可以是一种角色(比如说一个公司可以有多个销售),所以说,用户与角色之间的...

在Django / DRF中正确处理日期时间/时区

我正在尝试为我的网络应用程序进行正确的日期处理设置.我有一个看起来像这样的模型 class Entity(models.Model): name = models.CharField(max_length=255) date = models.DateTimeField() 用户可以向我的DRF端点/ api / v1 / entity /...

Linux declare命令

[ Linux 命令大全Linux declare命令用于声明 shell 变量。 declare为shell指令,在第一种语法中可用来声明变量并设置变量的属性([rix]即为变量的属性),在第二种语法中可用来显示shell函数。若不加上任何参数,则会显示全部的shell变量与函数(与执行set指令的效果相同)。 语法 declare [+/-][rxi...

Linux之Ansible

一、安装ansible 环境是centos7.0 主管服务器ip:192.168.175.134,只需安装ansible在本机即可,其余服务器无需安装,ansible通讯是用ssh 首先更换yum源 cd /etc/yum.repos.d/ cp CentOS-Base.repo CentOS-Base.repo.bak wget -O /etc/yu...