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

时间:2023-03-09 14:25:59
Django项目:CMDB(服务器硬件资产自动采集系统)--11--07CMDB文件模式测试采集硬件数据

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

 #settings.py
# ————————01CMDB获取服务器基本信息————————
import os BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))##当前路径 # 采集资产的方式,选项有:agent(默认), salt, ssh
MODE = 'agent' # ————————01CMDB获取服务器基本信息———————— # ————————02CMDB将服务器基本信息提交到API接口————————
# 资产信息API
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
# ASSET_API = "http://127.0.0.1:8000/api/asset"
ASSET_API = "http://192.168.80.53:8000/api/asset"
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— # ————————02CMDB将服务器基本信息提交到API接口———————— # ————————03CMDB信息安全API接口交互认证————————
# 用于API认证的KEY
KEY = '299095cc-1330-11e5-b06a-a45e60bec08b' #认证的密码
# 用于API认证的请求头
AUTH_KEY_NAME = 'auth-key'
# ————————03CMDB信息安全API接口交互认证———————— # ————————04CMDB本地(Agent)模式客户端唯一标识(ID)————————
# Agent模式保存服务器唯一ID的文件
CERT_FILE_PATH = os.path.join(BASEDIR, 'config', 'cert') #文件路径
# ————————04CMDB本地(Agent)模式客户端唯一标识(ID)———————— # ————————05CMDB采集硬件数据的插件————————
# 采集硬件数据的插件
PLUGINS_DICT = {
'cpu': 'src.plugins.cpu.CpuPlugin',
'disk': 'src.plugins.disk.DiskPlugin',
'main_board': 'src.plugins.main_board.MainBoardPlugin',
'memory': 'src.plugins.memory.MemoryPlugin',
'nic': 'src.plugins.nic.NicPlugin',
}
# ————————05CMDB采集硬件数据的插件———————— # ————————07CMDB文件模式测试采集硬件数据————————
# 是否测试模式,测试模时候数据从files目录下读取信息 选项有:#True False
TEST_MODE = True
# ————————07CMDB文件模式测试采集硬件数据————————

#settings.py

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

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

 #base.py
# ————————01CMDB获取服务器基本信息————————
from config import settings #配置文件 class BasePlugin(object):
def __init__(self, hostname=''): # ————————07CMDB文件模式测试采集硬件数据————————
self.test_mode = settings.TEST_MODE#是否测试模式
# ————————07CMDB文件模式测试采集硬件数据———————— if hasattr(settings, 'MODE'):
self.mode = settings.MODE #采集资产的方式
else:
self.mode = 'agent'#默认,采集资产的方式
def execute(self): # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# return self.windows()
try:#判断系统平台类型 # ————————07CMDB文件模式测试采集硬件数据————————
if self.test_mode: # 是否测试模式
return self.test() # 测试模式
# ————————07CMDB文件模式测试采集硬件数据———————— import platform # 获取操作系统信息 的模块
if platform.system() == 'Linux':
return self.linux() #执行 #def linux(self):
elif platform.system() == 'Windows':
return self.windows() # 执行 #def windows(self):
except Exception as e:
return '未知的系统平台类型!'
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— def windows(self):
raise Exception('您必须实现windows的方法')
# ————————01CMDB获取服务器基本信息———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
raise Exception('您必须实现linux的方法')
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):#测试模式
raise Exception('您必须实现test的方法')
# ————————07CMDB文件模式测试采集硬件数据————————

#base.py

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

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

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

 # basic.py
# ————————01CMDB获取服务器基本信息————————
from .base import BasePlugin #采集资产的方式
from lib.response import BaseResponse #提交数据的类型
import platform #platform模块给我们提供了很多方法去获取操作系统的信息 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
"""
本模块基于windows操作系统,依赖wmi和win32com库,需要提前使用pip进行安装,
我们依然可以通过pip install pypiwin32来安装win32com模块
或者下载安装包手动安装。
""" class BasicPlugin(BasePlugin):
def os_platform(self):#获取系统平台
# ————————07CMDB文件模式测试采集硬件数据————————
# output=platform.system() #windows和Linux 都可以执行
# return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 try:
if self.test_mode: # 是否测试模式
output = 'Linux' # 选择要测试的系统(windows和Linux或者苹果等未知的系统)
return output.strip() # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
output = platform.system() #windows和Linux 都可以执行
return output.strip() # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
except Exception as e:
return '未知的系统平台!'
# ————————07CMDB文件模式测试采集硬件数据———————— def os_version(self):#获取系统版本
# output = wmi.WMI().Win32_OperatingSystem()[0].Caption
# return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
try: # ————————07CMDB文件模式测试采集硬件数据————————
if self.test_mode: # 是否测试模式
output = """CentOS release 6.6 (Final)\nKernel \r on an \m"""
result = output.strip().split('\n')[0] # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。#split() 通过指定分隔符对字符串进行切片
return result
# ————————07CMDB文件模式测试采集硬件数据———————— if platform.system() == 'Linux':
import subprocess # 启动一个新的进程并且与之通信
output = subprocess.getoutput('cat /etc/issue') # Linux系统下的命令
result = output.strip().split('\n')[0] # split() 通过指定分隔符对字符串进行切片
# strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
return result
if platform.system() == 'Windows':
import wmi # Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
output = wmi.WMI().Win32_OperatingSystem()[0].Caption # Windows系统下的命令
result = output.strip()
# strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
return result
except Exception as e:
return '未知的系统版本!'
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— def os_hostname(self):#获取主机名
# output = wmi.WMI().Win32_OperatingSystem()[0].CSName
# return output.strip()#strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。 # ————————06CMDB测试Linux系统采集硬件数据的命令————————
try: # ————————07CMDB文件模式测试采集硬件数据————————
if self.test_mode: # 是否测试模式
output = 'test.com'
return output.strip() # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
# ————————07CMDB文件模式测试采集硬件数据———————— if platform.system() == 'Linux':
import subprocess # 启动一个新的进程并且与之通信
output = subprocess.getoutput('hostname') # Linux系统下的命令
return output.strip() # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
elif platform.system() == 'Windows':
import wmi # Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
output = wmi.WMI().Win32_OperatingSystem()[0].CSName # Windows系统下的命令
return output.strip() # strip() 方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列。
except Exception as e:
return '未知的主机名!'
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— def windows(self):
response = BaseResponse()#提交数据的类型
try:
ret = {
'os_platform': self.os_platform(),#系统平台
'os_version': self.os_version(),#系统版本
'hostname': self.os_hostname(),#主机名
}
response.data = ret #字典形式
print('windows服务器基本信息:',response.data)
except Exception as e:
response.status = False#获取信息时出现错误
return response
"""
class BaseResponse(object): #提交数据的类型
def __init__(self):
self.status = True #状态
self.message = None #消息
self.data = None #数据内容
self.error = None #错误信息 """
# ————————01CMDB获取服务器基本信息———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = self.windows() #因为执行同样的方法,所以,就不重复写。
print('linux服务器基本信息:', response.data)
return response
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = self.windows() #因为执行同样的方法,所以,就不重复写。
print('test服务器基本信息:', response.data)
return response
# ————————07CMDB文件模式测试采集硬件数据————————

# basic.py

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

 # cpu.py
# ————————05CMDB采集硬件数据的插件————————
from .base import BasePlugin #采集资产的方式 和 系统平台
from lib.response import BaseResponse #提交数据的类型(字典) # ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— class CpuPlugin(BasePlugin):
def windows(self):
response = BaseResponse() #提交数据的类型(字典)
try:
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
output =wmi.WMI().Win32_Processor() #获取CPU相关信息
response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
except Exception as e:
response.status = False
return response @staticmethod#返回函数的静态方法
def windows_parse(content):
response = {}
cpu_physical_set = set()#set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
for item in content:
response['cpu_model'] = item.Manufacturer # cpu型号
response['cpu_count'] = item.NumberOfCores # cpu核心个量
cpu_physical_set.add(item.DeviceID) #CPU物理个量
response['cpu_physical_count'] = len(cpu_physical_set)#CPU物理个量
return response #返回结果 # ————————05CMDB采集硬件数据的插件———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = BaseResponse() #提交数据的类型(字典)
import os # 操作系统层面执行
from config.settings import BASEDIR # 获取路径
try:
output = open(os.path.join(BASEDIR, 'files/linux_out/cpu.out'), 'r').read() #打开文件获取内容
response.data = self.linux_parse(output)#解析shell命令返回结果
except Exception as e:
response.status = False
return response
# ————————07CMDB文件模式测试采集硬件数据———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = BaseResponse() # 提交数据的类型(字典)
try:
import subprocess # 启动一个新的进程并且与之通信
shell_command = "cat /proc/cpuinfo" # 定义命令 lscpu
output = subprocess.getoutput(shell_command) # linux系统上执行的命令
response.data = self.linux_parse(output) # 解析shell命令返回结果
except Exception as e:
response.status = False
return response @staticmethod # 返回函数的静态方法
def linux_parse(content): # 解析shell命令返回结果
response = {'cpu_count': 0, 'cpu_physical_count': 0, 'cpu_model': ''}
cpu_physical_set = set() # set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
content = content.strip() # strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
for item in content.split('\n\n'): # split()通过指定分隔符对字符串进行切片
for row_line in item.split('\n'):
key, value = row_line.split(':')
key = key.strip()
if key == 'processor':
response['cpu_count'] += 1 # cpu核心个量
elif key == 'physical id':
cpu_physical_set.add(value) # CPU物理个量
elif key == 'model name':
if not response['cpu_model']:
response['cpu_model'] = value # cpu型号
response['cpu_physical_count'] = len(cpu_physical_set) # CPU物理个量
return response
# ————————06CMDB测试Linux系统采集硬件数据的命令————————

# cpu.py

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

 # disk.py
# ————————05CMDB采集硬件数据的插件————————
from .base import BasePlugin #采集资产的方式 和 系统平台
from lib.response import BaseResponse #提交数据的类型(字典)
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— class DiskPlugin(BasePlugin):
def windows(self):
response = BaseResponse() #提交数据的类型(字典)
try:
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
output =wmi.WMI().Win32_DiskDrive() #获取磁盘相关信息
response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
except Exception as e:
response.status = False
return response @staticmethod#返回函数的静态方法
def windows_parse(content):
response = {}
for item in content:
item_dict = {}
item_dict['slot'] = item.Index #插槽位
item_dict['pd_type'] = item.InterfaceType #磁盘型号
item_dict['capacity'] = round(int(item.Size) / (1024**3)) # 磁盘容量
item_dict['model'] = item.Model #磁盘类型
response[item_dict['slot']] = item_dict #分割存每个 磁盘信息
return response #返回结果
# ————————05CMDB采集硬件数据的插件———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = BaseResponse() #提交数据的类型(字典)
import os # 操作系统层面执行
from config.settings import BASEDIR # 获取路径
try:
output = open(os.path.join(BASEDIR, 'files/linux_out/disk.out'), 'r').read() #打开文件获取内容 linux_virtual_out linux_out
response.data = self.linux_parse(output)#解析shell命令返回结果
except Exception as e:#如果获取内容错误或者解析错误就换一个方式
try:
output = open(os.path.join(BASEDIR, 'files/linux_virtual_out/disk.out'),'r').read() # 打开文件获取内容 linux_virtual_out linux_out
response.data = self.linux_virtual_parse(output) # 解析shell命令返回结果
except Exception as e:#如果 出现未知错误
response.status = False
return response # ————————07CMDB文件模式测试采集硬件数据———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = BaseResponse() #提交数据的类型(字典)
try:
import subprocess # 启动一个新的进程并且与之通信
shell_command = "sudo MegaCli -PDList -aALL" #定义命令#需要安装 MegaCli 模块
output = subprocess.getoutput(shell_command) #linux系统上执行的命令
if 'MegaCli'in output:
shell_command = "lsblk" # 虚拟机 #lsblk
output = subprocess.getoutput(shell_command) # linux系统上执行的命令
response.data = self.linux_virtual_parse(output) # 解析shell命令返回结果
else:
response.data = self.linux_parse(output)#解析shell命令返回结果
except Exception as e: # 如果 出现未知错误
response.status = False
return response def linux_virtual_parse(self, content): # 解析shell命令返回结果
content = [i for i in content.split('\n') if i != ''] # split()通过指定分隔符对字符串进行切片
key_list = [i for i in content[0].split(' ') if i != ''] # split()通过指定分隔符对字符串进行切片
key_list[0] = 'slot' # 替换key的名字
key_list[3] = 'capacity'
key_list[5] = 'pd_type'
ram_dict = {}
for i in content[1:]: # 从列表下标1开始循环
segment = {}
value = [x for x in i.split(' ') if x != ''] # 如果不是空值就循环 # split()通过指定分隔符对字符串进行切片
filter = str(value) # 列表转成字符串进行判断
if '攢' not in filter: # '─' '攢' #二级逻辑硬盘
if '─' not in filter: # '─' '攢' #二级逻辑硬盘
list = zip(key_list, value) # zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。
for k, v in list:
if k == 'capacity': # 处理单位问题
if 'G' in v:
l = v.split('G') # split()通过指定分隔符对字符串进行切片
v = l[0]
if 'M' in v: # 处理单位问题
l = v.split('M') # split()通过指定分隔符对字符串进行切片
s = l[0]
m = int(s)
v = m / 1024
segment[k] = v
ram_dict[value[0]] = segment
return ram_dict def linux_parse(self, content): # 解析shell命令返回结果
import re # 正则表达式
response = {}
result = []
for row_line in content.split("\n\n\n\n"): # split()通过指定分隔符对字符串进行切片
result.append(row_line) # 添加到列表
for item in result: # 循环列表
temp_dict = {}
for row in item.split('\n'): # split()通过指定分隔符对字符串进行切片
if not row.strip(): # strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
continue
if len(row.split(':')) != 2: # 测试长度
continue
key, value = row.split(':') # split()通过指定分隔符对字符串进行切片
name = self.mega_patter_match(key)
if name:
if key == 'Raw Size': # 磁盘容量
raw_size = re.search('(\d+\.\d+)',
value.strip()) # Raw Size: 279.396 GB [0x22ecb25c Sectors]
if raw_size:
temp_dict[name] = raw_size.group()
else:
raw_size = ''
else:
temp_dict[name] = value.strip() # 磁盘型号 #磁盘类型
if temp_dict:
response[temp_dict['slot']] = temp_dict # 插槽位 #分割存每个 磁盘信息
return response @staticmethod # 返回函数的静态方法
def mega_patter_match(needle):
grep_pattern = {'Slot': 'slot', 'Raw Size': 'capacity', 'Inquiry': 'model', 'PD Type': 'pd_type'}
for key, value in grep_pattern.items():
if needle.startswith(key): # 确定此字符串实例的开头是否与指定的字符串匹配
return value
return False
# ————————06CMDB测试Linux系统采集硬件数据的命令————————

# disk.py

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

 # main_board.py
# ————————05CMDB采集硬件数据的插件————————
from .base import BasePlugin #采集资产的方式 和 系统平台
from lib.response import BaseResponse #提交数据的类型(字典)
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— class MainBoardPlugin(BasePlugin):
def windows(self):
response = BaseResponse() #提交数据的类型(字典)
try:
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
output =wmi.WMI().Win32_BaseBoard() #获取主板相关信息
response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
except Exception as e:
response.status = False
return response @staticmethod#返回函数的静态方法
def windows_parse(content):
response = {}
for item in content:
response['Manufacturer'] = item.Manufacturer #主板制造商
response['model'] = item.Name #主板型号
response['sn'] = item.SerialNumber #主板SN号
return response #返回结果
# ————————05CMDB采集硬件数据的插件———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = BaseResponse() #提交数据的类型(字典)
import os # 操作系统层面执行
from config.settings import BASEDIR # 获取路径
try:
output = open(os.path.join(BASEDIR, 'files/linux_out/board.out'), 'r').read() #打开文件获取内容
response.data = self.linux_parse(output)#解析shell命令返回结果
except Exception as e:
response.status = False
return response
# ————————07CMDB文件模式测试采集硬件数据———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = BaseResponse() #提交数据的类型(字典)
try:
import subprocess # 启动一个新的进程并且与之通信
shell_command = "sudo dmidecode -t1" #定义命令
output =subprocess.getoutput(shell_command) #linux系统上执行的命令
response.data = self.linux_parse(output) #解析shell命令返回结果
except Exception as e:
response.status = False
return response def linux_parse(self, content):#解析shell命令返回结果
result = {}
key_map = {'Manufacturer': 'manufacturer', 'Product Name': 'model','Serial Number': 'sn',}
for item in content.split('\n'): #split()通过指定分隔符对字符串进行切片
row_data = item.strip().split(':') #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
if len(row_data) == 2:
if row_data[0] in key_map:#如果在需要的字典里
result[key_map[row_data[0]]] = row_data[1].strip() if row_data[1] else row_data[1]
return result
# ————————06CMDB测试Linux系统采集硬件数据的命令————————

# main_board.py

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

 # memory.py
# ————————05CMDB采集硬件数据的插件————————
from .base import BasePlugin #采集资产的方式 和 系统平台
from lib.response import BaseResponse #提交数据的类型(字典)
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— class MemoryPlugin(BasePlugin):
def windows(self):
response = BaseResponse() #提交数据的类型(字典)
try:
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
output =wmi.WMI().Win32_PhysicalMemory() #获取内存相关信息
response.data = self.windows_parse(output)
except Exception as e:
response.status = False
return response @staticmethod#返回函数的静态方法
def windows_parse(content):
response={}
for item in content:
item_dict = {}
item_dict['slot'] = item.DeviceLocator #插槽位
item_dict['manufacturer'] = item.Manufacturer # 内存制造商
item_dict['model'] =item.FormFactor # 内存型号
item_dict['Capacity'] = round(int(item.Capacity) / (1024**3)) # 内存容量
item_dict['sn'] = item.SerialNumber #内存SN号
item_dict['speed'] = item.Speed #内存速度
response[item_dict['slot']] = item_dict #分割存每条 内存信息
return response # ————————05CMDB采集硬件数据的插件————————
# ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = BaseResponse() #提交数据的类型(字典)
import os # 操作系统层面执行
from config.settings import BASEDIR # 获取路径
try:
output = open(os.path.join(BASEDIR, 'files/linux_out/memory.out'), 'r').read() #打开文件获取内容 linux_virtual_out linux_out
response.data = self.linux_parse(output) # 解析shell命令返回结果
except Exception as e:#如果获取内容错误或者解析错误就换一个方式
try:
output = open(os.path.join(BASEDIR, 'files/linux_virtual_out/memory.out'),'r').read() # 打开文件获取内容 linux_virtual_out linux_out
response.data = self.linux_virtual_parse(output) # 解析shell命令返回结果
except Exception as e:
response.status = False
return response
# ————————07CMDB文件模式测试采集硬件数据———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = BaseResponse() #提交数据的类型(字典)
try:
import subprocess # 启动一个新的进程并且与之通信
shell_command = "sudo dmidecode -q -t 17 2>/dev/null" #定义命令 cat /proc/swaps #swapon
output = subprocess.getoutput(shell_command) #linux系统上执行的命令
if not output:
shell_command = "swapon" # 定义命令 cat /proc/swaps #swapon
output = subprocess.getoutput(shell_command) # linux系统上执行的命令
response.data = self.linux_virtual_parse(output) # 解析shell命令返回结果
else:
response.data = self.linux_parse(output) # 解析shell命令返回结果
except Exception as e: # 如果 出现未知错误
response.status = False
return response def convert_mb_to_gb(self,value, default=0):#转换单位
try:
value = value.strip('MB') #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
result = int(value)
except Exception as e:
result = default
return result def linux_virtual_parse(self, content): # 解析shell命令返回结果
content = [i for i in content.split('\n') if i != ''] # split()通过指定分隔符对字符串进行切片
key_list = [i for i in content[0].split(' ') if i != ''] # split()通过指定分隔符对字符串进行切片
key_list[0] = 'slot' #替换key的名字
key_list[1] = 'model'
key_list[2] = 'capacity'
ram_dict = {}
for i in content[1:]: # 从列表下标1开始循环
segment = {}
value = [x for x in i.split(' ') if x != '']#如果不是空值就循环 # split()通过指定分隔符对字符串进行切片
list = zip(key_list, value) # zip() 函数用于将可迭代的对象作为参数,将对象中对应的元素打包成一个个元组,然后返回由这些元组组成的列表。
for k, v in list:
if k=='capacity': #处理单位问题
if 'M' in v:
l = v.split('M') # split()通过指定分隔符对字符串进行切片
v = l[0]
if 'G' in v: # 处理单位问题
l = v.split('G') # split()通过指定分隔符对字符串进行切片
s = l[0]
m = int(s)
v = m * 1024
segment[k] = v
ram_dict[value[0]] = segment
return ram_dict def linux_parse(self, content): # 解析shell命令返回结果
ram_dict = {}
key_map = {'Size': 'capacity','Locator': 'slot','Type': 'model','Speed': 'speed',
'Manufacturer': 'manufacturer','Serial Number': 'sn',}
devices = content.split('Memory Device') #split()通过指定分隔符对字符串进行切片
for item in devices:
item = item.strip() #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
if not item:
continue
if item.startswith('#'): #startswith()方法用于检查字符串是否是以指定子字符串开头
continue
segment = {}
lines = item.split('\n\t') #split()通过指定分隔符对字符串进行切片
for line in lines:
if len(line.split(':')) > 1: #split()通过指定分隔符对字符串进行切片
key, value = line.split(':') #split()通过指定分隔符对字符串进行切片
else:
key = line.split(':')[0] #split()通过指定分隔符对字符串进行切片
value = ""
if key in key_map:
if key == 'Size': # 内存容量
segment[key_map['Size']] = self.convert_mb_to_gb(value, 0) #转换单位
else:
segment[key_map[key.strip()]] = value.strip() #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
ram_dict[segment['slot']] = segment #插槽位 #分割存每条 内存信息
return ram_dict
# ————————06CMDB测试Linux系统采集硬件数据的命令————————

# memory.py

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

 # nic.py
# ————————05CMDB采集硬件数据的插件————————
from .base import BasePlugin #采集资产的方式 和 系统平台
from lib.response import BaseResponse #提交数据的类型(字典)
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
# import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令———————— class NicPlugin(BasePlugin):
def windows(self):
response = BaseResponse() #提交数据的类型(字典)
try:
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
import wmi#Windows操作系统上管理数据和操作的基础设施 #linux写无法导入这个模块
# ————————06CMDB测试Linux系统采集硬件数据的命令————————
output =wmi.WMI().Win32_NetworkAdapterConfiguration() #获取网卡相关信息
response.data = self.windows_parse(output) #解析相关信息 返回结果 #存到字典
except Exception as e:
response.status = False
return response @staticmethod#返回函数的静态方法
def windows_parse(content):
response={}
IPCM = 0 # 权重
for item in content:
if item.IPConnectionMetric: # 权重
if item.IPConnectionMetric > IPCM: # 权重 #防止虚拟网卡
item_dict = {}
name=item.ServiceName # 网卡名称
item_dict['hwaddr'] = item.MACAddress # 网卡MAC地址
item_dict['ipaddrs'] = item.IPAddress[0] # IP地址
item_dict['netmask'] = item.IPSubnet[0] # IP子网掩码
item_dict['up'] = item.IPEnabled #是否有启用
response[name] = item_dict
IPCM = item.IPConnectionMetric # 权重
return response
# ————————05CMDB采集硬件数据的插件———————— # ————————07CMDB文件模式测试采集硬件数据————————
def test(self):
response = BaseResponse() #提交数据的类型(字典)
import os # 操作系统层面执行
from config.settings import BASEDIR # 获取路径
try:
output = open(os.path.join(BASEDIR, 'files/linux_out/nic.out'), 'r').read() #打开文件获取内容
interfaces_info = self._interfaces_ip(output) #接口 # 解析shell命令返回结果
self.standard(interfaces_info) # 内容进行 标准化
response.data = interfaces_info # 解析shell命令返回结果
except Exception as e:
response.status = False
return response
# ————————07CMDB文件模式测试采集硬件数据———————— # ————————06CMDB测试Linux系统采集硬件数据的命令————————
def linux(self):
response = BaseResponse() #提交数据的类型(字典)
try:
interfaces_info = self.linux_interfaces() #linux系统上执行的命令
self.standard(interfaces_info) # 内容进行 标准化
response.data = interfaces_info # 解析shell命令返回结果
except Exception as e:
response.status = False
return response def standard(self, interfaces_info):# 内容进行 标准化
for key, value in interfaces_info.items():
ipaddrs = set()#set()函数创建一个无序不重复元素集,可进行关系测试,删除重复数据,还可以计算交集、差集、并集等。
netmask = set()
if not 'inet' in value:
value['ipaddrs'] = '' # IP地址
value['netmask'] = '' # IP子网掩码
else:
for item in value['inet']:
ipaddrs.add(item['address']) # IP地址
netmask.add(item['netmask']) # IP子网掩码
value['ipaddrs'] = '/'.join(ipaddrs) # IP地址
value['netmask'] = '/'.join(netmask) # IP子网掩码
del value['inet'] def linux_interfaces(self):#获得* NIX / BSD变种接口信息
ifaces = dict() #dict() 函数用于创建一个字典。返回一个字典。
ip_path = 'ip'
if ip_path:
# ————————在使用#linux系统上执行的命令时开启————————
import subprocess # 启动一个新的进程并且与之通信
cmd1 = subprocess.getoutput('sudo {0} link show'.format(ip_path)) #定义命令ip link show
cmd2 = subprocess.getoutput('sudo {0} addr show'.format(ip_path)) #定义命令ip addr show
ifaces = self._interfaces_ip(cmd1 + '\n' + cmd2) #linux系统上执行的命令 #接口 # 解析shell命令返回结果
# ————————在使用#linux系统上执行的命令时开启————————
return ifaces def which(self, exe):
import os # 操作系统层面执行
def _is_executable_file_or_link(exe):
# 检查操作系统。X_OK不足够了,因为目录可能会执行
return (os.access(exe, os.X_OK) and
(os.path.isfile(exe) or os.path.islink(exe))) if exe:
if _is_executable_file_or_link(exe):
# executable in cwd or fullpath
return exe # 默认路径基于busybox的默认
default_path = '/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin'
search_path = os.environ.get('PATH', default_path)
path_ext = os.environ.get('PATHEXT', '.EXE')
ext_list = path_ext.split(';') search_path = search_path.split(os.pathsep)
if True:
"""
   # 添加任何dirs default_path search_path不。如果
   # 没有PATH变量中发现操作系统。环境,那么这将是
   # 无为法。这将确保所有dirs default_path
   # 搜索,让salt.utils.which()调用时工作得很好
   # salt-call从cron(取决于平台
   # 有一个极其有限的路径)。
"""
search_path.extend(
[
x for x in default_path.split(os.pathsep)
if x not in search_path
]
)
for path in search_path:
full_path = os.path.join(path, exe)
if _is_executable_file_or_link(full_path):
return full_path
return None def _number_of_set_bits_to_ipv4_netmask(self, set_bits): # pylint: disable=C0103
'''
返回一个整数表示的IPv4网络掩码,面具。 Ex. 0xffffff00 -> '255.255.255.0'
'''
return self.cidr_to_ipv4_netmask(self._number_of_set_bits(set_bits))
def cidr_to_ipv4_netmask(self, cidr_bits):
'''
返回一个IPv4网络掩码
'''
try:
cidr_bits = int(cidr_bits)
if not 1 <= cidr_bits <= 32:
return ''
except ValueError:
return ''
netmask = ''
for idx in range(4):
if idx:
netmask += '.'
if cidr_bits >= 8:
netmask += ''
cidr_bits -= 8
else:
netmask += '{0:d}'.format(256 - (2 ** (8 - cidr_bits)))
cidr_bits = 0
return netmask
def _number_of_set_bits(self, x):
'''
返回的比特数,设置在一个32位整数
#来自http://*.com/a/4912729
'''
x -= (x >> 1) & 0x55555555
x = ((x >> 2) & 0x33333333) + (x & 0x33333333)
x = ((x >> 4) + x) & 0x0f0f0f0f
x += x >> 8
x += x >> 16
return x & 0x0000003f def _interfaces_ip(self, out): #接口 # 解析shell命令返回结果
import re # 正则表达式
'''
  使用ip来返回一个字典的接口的各种信息
  每个(向上/向下状态、ip地址、子网掩码和hwaddr)
'''
ret = dict()
right_keys = ['name', 'hwaddr', 'up', 'netmask', 'ipaddrs'] def parse_network(value, cols):
'''
  子网掩码,返回一个元组的ip广播
  基于当前的关口
'''
brd = None
if '/' in value: # 我们有一个CIDR在这个地址
ip, cidr = value.split('/') # pylint:禁用= C0103
else:
ip = value # pylint:禁用= C0103
cidr = 32 if type_ == 'inet':
mask = self.cidr_to_ipv4_netmask(int(cidr))
if 'brd' in cols:
brd = cols[cols.index('brd') + 1]
return (ip, mask, brd) groups = re.compile('\r?\n\\d').split(out)
for group in groups:
iface = None
data = dict() for line in group.splitlines():
if ' ' not in line:
continue
match = re.match(r'^\d*:\s+([\w.\-]+)(?:@)?([\w.\-]+)?:\s+<(.+)>', line)
if match:
iface, parent, attrs = match.groups()
if 'UP' in attrs.split(','):
data['up'] = True
else:
data['up'] = False
if parent and parent in right_keys:
data[parent] = parent
continue cols = line.split()
if len(cols) >= 2:
type_, value = tuple(cols[0:2])
iflabel = cols[-1:][0]
if type_ in ('inet',):
if 'secondary' not in cols:
ipaddr, netmask, broadcast = parse_network(value, cols)
if type_ == 'inet':
if 'inet' not in data:
data['inet'] = list()
addr_obj = dict()
addr_obj['address'] = ipaddr
addr_obj['netmask'] = netmask
addr_obj['broadcast'] = broadcast
data['inet'].append(addr_obj) else:
if 'secondary' not in data:
data['secondary'] = list()
ip_, mask, brd = parse_network(value, cols)
data['secondary'].append({
'type': type_,
'address': ip_,
'netmask': mask,
'broadcast': brd,
})
del ip_, mask, brd
elif type_.startswith('link'):
data['hwaddr'] = value
if iface:
if iface.startswith('pan') or iface.startswith('lo') or iface.startswith('v'):
del iface, data
else:
ret[iface] = data
del iface, data
return ret
# ————————06CMDB测试Linux系统采集硬件数据的命令————————

# nic.py

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

{"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":{"": {"slot": "", "pd_type": "SAS", "capacity": "279.396", "model": "SEAGATE ST300MM0006 LS08S0K2B5NV"},
"": {"slot": "", "pd_type": "SAS", "capacity": "279.396", "model": "SEAGATE ST300MM0006 LS08S0K2B5AH"},
"": {"slot": "", "pd_type": "SATA", "capacity": "476.939", "model": "S1SZNSAFA01085L Samsung SSD 850 PRO 512GB EXM01B6Q"},
"": {"slot": "", "pd_type": "SATA", "capacity": "476.939", "model": "S1AXNSAF912433K Samsung SSD 840 PRO Series DXM06B0Q"},
"": {"slot": "", "pd_type": "SATA", "capacity": "476.939", "model": "S1AXNSAF303909M Samsung SSD 840 PRO Series DXM05B0Q"},
"": {"slot": "", "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

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

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

Adapter #

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

Memory Device
Total Width: 32 bits
Data Width: 32 bits
Size: 1024 MB
Form Factor: DIMM
Set: None
Locator: DIMM #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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 #
Bank Locator: BANK #
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

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文件模式测试采集硬件数据

 {    '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': ''},
'error': None }, 'memory': {'status': True,'message': None,
'data': {'/dev/dm-1': {'slot': '/dev/dm-1','model': 'partition','capacity': '','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

 NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda 8:0 0 8.3G 0 disk
├─sda1 8:1 0 1G 0 part /boot
└─sda2 8:2 0 7G 0 part
├─centos-root 253:0 0 6.2G 0 lvm /
└─centos-swap 253:1 0 820M 0 lvm [SWAP]
sdb 8:16 0 1.3G 0 disk
sdc 8:32 0 3.1G 0 disk
sr0 11:0 1 1024M 0 rom

disk.out

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文件模式测试采集硬件数据

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