CMDB服务器管理系统【s5day88】:兼容的实现

比较麻烦的实现方式

类的继承方式

目录结构如下:

auto_client\bin\run.py

import sys
import os
import importlib
import requests
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASEDIR)
os.environ['AUTO_CLIENT_SETTINGS'] = "conf.settings"

from src.plugins import PluginManager

if __name__ == '__main__':
    obj = PluginManager()
    server_dict = obj.exec_plugin()
    print(server_dict)

auto_client\conf\settings.py

PLUGIN_ITEMS = {
    "nic": "src.plugins.nic.Nic",
    "disk": "src.plugins.disk.Disk",
}

API = "http://127.0.0.1:8000/api/server.html"

TEST = False

MODE = "ANGET" # AGENT/SSH/SALT

auto_client\lib\config\__init__.py

import os
import importlib
from . import global_settings

class Settings(object):
    """
    global_settings,配置获取
    settings.py,配置获取
    """
    def __init__(self):

        for item in dir(global_settings):
            if item.isupper():
                k = item
                v = getattr(global_settings,item)
                setattr(self,k,v)

        setting_path = os.environ.get('AUTO_CLIENT_SETTINGS')
        md_settings = importlib.import_module(setting_path)
        for item in dir(md_settings):
            if item.isupper():
                k = item
                v = getattr(md_settings,item)
                setattr(self,k,v)


settings = Settings()

auto_client\lib\config\global_settings.py

TEST = True

NAME = "GAOXU"

auto_client\src\plugins\__init__.py

import importlib
import requests
from lib.config import settings

class PluginManager(object):
    def __init__(self):
        pass

    def exec_plugin(self):
        server_info = {}
        for k,v in settings.PLUGIN_ITEMS.items():
            # 找到v字符串:src.plugins.nic.Nic,src.plugins.disk.Disk
            module_path,cls_name = v.rsplit('.',maxsplit=1)
            module = importlib.import_module(module_path)
            cls = getattr(module,cls_name)

            if hasattr(cls,'initial'):
                obj = cls.initial()
            else:
                obj = cls()
            ret = obj.process()

            server_info[k] = ret
        return server_info

auto_client\src\plugins\base.py

from lib.config import  settings
class BasePlugin(object):

    def __init__(self):
        pass

    def exec_cmd(self,cmd):
        if settings.MODE == "AGENT":
            import subprocess
            result = subprocess.getoutput(cmd)
        elif settings.MODE == "SSH":
            import paramiko
            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            ssh.connect(hostname='192.168.16.72', port=22, username='root', password='redhat')
            stdin, stdout, stderr = ssh.exec_command(cmd)
            result = stdout.read()
            ssh.close()

        elif settings.MODE == "SALT":
            import subprocess
            result = subprocess.getoutput('salt "c1.com" cmd.run "%s"' %cmd)
        else:
            raise Exception("模式选择错误:AGENT,SSH,SALT")

        return result 

auto_client\src\plugins\disk.py

from .base import BasePlugin
class Disk(BasePlugin):

    def process(self):
        result = self.exec_cmd("dir")
        return 'disk info'

auzo_client\src\plugins\memory.py

from .base import BasePlugin
class Memory(BasePlugin):
    def process(self):

        return "xxx"

auto_client\src\plugins\nic.py

from .base import BasePlugin

class Nic(BasePlugin):
    def process(self):

        return 'nic info'

auto_client\src\plugins\board.py

from .base import BasePlugin
class Board(BasePlugin):
    def process(self):
        pass

auto_client\src\plugins\basic.py

from .base import BasePlugin
class Basic(BasePlugin):
    def initial(cls):
        return cls()

    def process(self):
        pass

  

传参方式

目录结构如下:

auto_client\bin\run.py

import sys
import os
import importlib
import requests
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASEDIR)
os.environ['AUTO_CLIENT_SETTINGS'] = "conf.settings"

from src.plugins import PluginManager

if __name__ == '__main__':
    obj = PluginManager()
    server_dict = obj.exec_plugin()
    print(server_dict)

auto_client\conf\settings.py

import os

BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

PLUGIN_ITEMS = {
    "nic": "src.plugins.nic.Nic",
    "disk": "src.plugins.disk.Disk",
    "basic": "src.plugins.basic.Basic",
    "board": "src.plugins.board.Board",
    "memory": "src.plugins.memory.Memory",
}

API = "http://127.0.0.1:8000/api/server.html"

TEST = True

MODE = "ANGET" # AGENT/SSH/SALT

SSH_USER = "root"
SSH_PORT = 22
SSH_PWD = "sdf"

auto_client\lib\config\__init__.py

import os
import importlib
from . import global_settings

class Settings(object):
    """
    global_settings,配置获取
    settings.py,配置获取
    """
    def __init__(self):

        for item in dir(global_settings):
            if item.isupper():
                k = item
                v = getattr(global_settings,item)
                setattr(self,k,v)

        setting_path = os.environ.get('AUTO_CLIENT_SETTINGS')
        md_settings = importlib.import_module(setting_path)
        for item in dir(md_settings):
            if item.isupper():
                k = item
                v = getattr(md_settings,item)
                setattr(self,k,v)


settings = Settings()

auto_client\lib\config\global_settings.py

TEST = True

NAME = "GAOXU"

auto_client\src\plugins\__init__.py

import importlib
import requests
from lib.config import settings
import traceback
# def func():
#     server_info = {}
#     for k,v in settings.PLUGIN_ITEMS.items():
#         # 找到v字符串:src.plugins.nic.Nic,src.plugins.disk.Disk
#         module_path,cls_name = v.rsplit('.',maxsplit=1)
#         module = importlib.import_module(module_path)
#         cls = getattr(module,cls_name)
#         obj = cls()
#         ret = obj.process()
#         server_info[k] = ret
#
#     requests.post(
#         url=settings.API,
#         data=server_info
#     )

class PluginManager(object):
    def __init__(self,hostname=None):
        self.hostname = hostname
        self.plugin_items = settings.PLUGIN_ITEMS
        self.mode = settings.MODE
        self.test = settings.TEST
        if self.mode == "SSH":
            self.ssh_user = settings.SSH_USER
            self.ssh_port = settings.SSH_PORT
            self.ssh_pwd = settings.SSH_PWD


    def exec_plugin(self):
        server_info = {}
        for k,v in self.plugin_items.items():
            # 找到v字符串:src.plugins.nic.Nic,
            # src.plugins.disk.Disk
            info = {'status':True,'data': None,'msg':None}
            try:
                module_path,cls_name = v.rsplit('.',maxsplit=1)
                module = importlib.import_module(module_path)
                cls = getattr(module,cls_name)

                if hasattr(cls,'initial'):
                    obj = cls.initial()
                else:
                    obj = cls()
                ret = obj.process(self.exec_cmd,self.test)
                info['data'] = ret
            except Exception as e:
                info['status'] = False
                info['msg'] = traceback.format_exc()

            server_info[k] = info
        return server_info

    def exec_cmd(self,cmd):
        if self.mode == "AGENT":
            import subprocess
            result = subprocess.getoutput(cmd)
        elif self.mode == "SSH":
            import paramiko
            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            ssh.connect(hostname=self.hostname, port=self.ssh_port, username=self.ssh_user, password=self.ssh_pwd)
            stdin, stdout, stderr = ssh.exec_command(cmd)
            result = stdout.read()
            ssh.close()
        elif self.mode == "SALT":
            import subprocess
            result = subprocess.getoutput('salt "%s" cmd.run "%s"' %(self.hostname,cmd))
        else:
            raise Exception("模式选择错误:AGENT,SSH,SALT")
        return result

auto_client\src\plugins\basic.py

class Basic(BasePlugin):

    @classmethod
    def initial(cls):
        return cls()

    def process(self):
        pass

 

测试模式

目录结构:

auto_client\bin\run.py

import sys
import os
import importlib
import requests
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASEDIR)
os.environ['AUTO_CLIENT_SETTINGS'] = "conf.settings"

from src.plugins import PluginManager

if __name__ == '__main__':
    obj = PluginManager()
    server_dict = obj.exec_plugin()
    print(server_dict)

auto_client\conf\settings.py

import os

BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

PLUGIN_ITEMS = {
    "nic": "src.plugins.nic.Nic",
    "disk": "src.plugins.disk.Disk",
    "basic": "src.plugins.basic.Basic",
    "board": "src.plugins.board.Board",
    "memory": "src.plugins.memory.Memory",
}

API = "http://127.0.0.1:8000/api/server.html"

TEST = True

MODE = "ANGET" # AGENT/SSH/SALT

SSH_USER = "root"
SSH_PORT = 22
SSH_PWD = "sdf"

auto_client\lib\config\__init__.py

import os
import importlib
from . import global_settings

class Settings(object):
    """
    global_settings,配置获取
    settings.py,配置获取
    """
    def __init__(self):

        for item in dir(global_settings):
            if item.isupper():
                k = item
                v = getattr(global_settings,item)
                setattr(self,k,v)

        setting_path = os.environ.get('AUTO_CLIENT_SETTINGS')
        md_settings = importlib.import_module(setting_path)
        for item in dir(md_settings):
            if item.isupper():
                k = item
                v = getattr(md_settings,item)
                setattr(self,k,v)


settings = Settings()

auto_client\lib\config\global_settings.py

TEST = True

NAME = "GAOXU"

auto_client\src\plugins\__init__.py

import importlib
import requests
from lib.config import settings
import traceback

class PluginManager(object):
    def __init__(self,hostname=None):
        self.hostname = hostname
        self.plugin_items = settings.PLUGIN_ITEMS
        self.mode = settings.MODE
        self.test = settings.TEST
        if self.mode == "SSH":
            self.ssh_user = settings.SSH_USER
            self.ssh_port = settings.SSH_PORT
            self.ssh_pwd = settings.SSH_PWD


    def exec_plugin(self):
        server_info = {}
        for k,v in self.plugin_items.items():
            # 找到v字符串:src.plugins.nic.Nic,
            # src.plugins.disk.Disk
            info = {'status':True,'data': None,'msg':None}
            try:
                module_path,cls_name = v.rsplit('.',maxsplit=1)
                module = importlib.import_module(module_path)
                cls = getattr(module,cls_name)

                if hasattr(cls,'initial'):
                    obj = cls.initial()
                else:
                    obj = cls()
                ret = obj.process(self.exec_cmd,self.test)
            except Exception as e:
                print(traceback.format_exc())
				
        return server_info

    def exec_cmd(self,cmd):
        if self.mode == "AGENT":
            import subprocess
            result = subprocess.getoutput(cmd)
        elif self.mode == "SSH":
            import paramiko
            ssh = paramiko.SSHClient()
            ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
            ssh.connect(hostname=self.hostname, port=self.ssh_port, username=self.ssh_user, password=self.ssh_pwd)
            stdin, stdout, stderr = ssh.exec_command(cmd)
            result = stdout.read()
            ssh.close()
        elif self.mode == "SALT":
            import subprocess
            result = subprocess.getoutput('salt "%s" cmd.run "%s"' %(self.hostname,cmd))
        else:
            raise Exception("模式选择错误:AGENT,SSH,SALT")
        return result

  

auto_client\src\plugins\basic.py

class Basic(object):

    @classmethod
    def initial(cls):
        return cls()

    def process(self,cmd_func,test):
        if test:
            output = {
                'os_platform': "linux",
                'os_version': "CentOS release 6.6 (Final)\nKernel \r on an \m",
                'hostname': 'c1.com'
            }
        else:
            output = {
                'os_platform': cmd_func("uname").strip(),
                'os_version': cmd_func("cat /etc/issue").strip().split('\n')[0],
                'hostname': cmd_func("hostname").strip(),
            }
        return output

auto_client\lib\convert.py

#!/usr/bin/env python
# -*- coding:utf-8 -*-

def convert_to_int(value,default=0):

    try:
        result = int(value)
    except Exception as e:
        result = default

    return result

def convert_mb_to_gb(value,default=0):

    try:
        value = value.strip('MB')
        result = int(value)
    except Exception as e:
        result = default

    return result

auto_client\files\board.out

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

auto_client\files\cpuinfo.out

  1 processor    : 0
  2 vendor_id    : GenuineIntel
  3 cpu family    : 6
  4 model        : 62
  5 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
  6 stepping    : 4
  7 cpu MHz        : 2099.921
  8 cache size    : 15360 KB
  9 physical id    : 0
 10 siblings    : 12
 11 core id        : 0
 12 cpu cores    : 6
 13 apicid        : 0
 14 initial apicid    : 0
 15 fpu        : yes
 16 fpu_exception    : yes
 17 cpuid level    : 13
 18 wp        : yes
 19 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
 20 bogomips    : 4199.84
 21 clflush size    : 64
 22 cache_alignment    : 64
 23 address sizes    : 46 bits physical, 48 bits virtual
 24 power management:
 25 
 26 processor    : 1
 27 vendor_id    : GenuineIntel
 28 cpu family    : 6
 29 model        : 62
 30 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
 31 stepping    : 4
 32 cpu MHz        : 2099.921
 33 cache size    : 15360 KB
 34 physical id    : 1
 35 siblings    : 12
 36 core id        : 0
 37 cpu cores    : 6
 38 apicid        : 32
 39 initial apicid    : 32
 40 fpu        : yes
 41 fpu_exception    : yes
 42 cpuid level    : 13
 43 wp        : yes
 44 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
 45 bogomips    : 4199.42
 46 clflush size    : 64
 47 cache_alignment    : 64
 48 address sizes    : 46 bits physical, 48 bits virtual
 49 power management:
 50 
 51 processor    : 2
 52 vendor_id    : GenuineIntel
 53 cpu family    : 6
 54 model        : 62
 55 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
 56 stepping    : 4
 57 cpu MHz        : 2099.921
 58 cache size    : 15360 KB
 59 physical id    : 0
 60 siblings    : 12
 61 core id        : 1
 62 cpu cores    : 6
 63 apicid        : 2
 64 initial apicid    : 2
 65 fpu        : yes
 66 fpu_exception    : yes
 67 cpuid level    : 13
 68 wp        : yes
 69 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
 70 bogomips    : 4199.84
 71 clflush size    : 64
 72 cache_alignment    : 64
 73 address sizes    : 46 bits physical, 48 bits virtual
 74 power management:
 75 
 76 processor    : 3
 77 vendor_id    : GenuineIntel
 78 cpu family    : 6
 79 model        : 62
 80 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
 81 stepping    : 4
 82 cpu MHz        : 2099.921
 83 cache size    : 15360 KB
 84 physical id    : 1
 85 siblings    : 12
 86 core id        : 1
 87 cpu cores    : 6
 88 apicid        : 34
 89 initial apicid    : 34
 90 fpu        : yes
 91 fpu_exception    : yes
 92 cpuid level    : 13
 93 wp        : yes
 94 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
 95 bogomips    : 4199.42
 96 clflush size    : 64
 97 cache_alignment    : 64
 98 address sizes    : 46 bits physical, 48 bits virtual
 99 power management:
100 
101 processor    : 4
102 vendor_id    : GenuineIntel
103 cpu family    : 6
104 model        : 62
105 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
106 stepping    : 4
107 cpu MHz        : 2099.921
108 cache size    : 15360 KB
109 physical id    : 0
110 siblings    : 12
111 core id        : 2
112 cpu cores    : 6
113 apicid        : 4
114 initial apicid    : 4
115 fpu        : yes
116 fpu_exception    : yes
117 cpuid level    : 13
118 wp        : yes
119 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
120 bogomips    : 4199.84
121 clflush size    : 64
122 cache_alignment    : 64
123 address sizes    : 46 bits physical, 48 bits virtual
124 power management:
125 
126 processor    : 5
127 vendor_id    : GenuineIntel
128 cpu family    : 6
129 model        : 62
130 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
131 stepping    : 4
132 cpu MHz        : 2099.921
133 cache size    : 15360 KB
134 physical id    : 1
135 siblings    : 12
136 core id        : 2
137 cpu cores    : 6
138 apicid        : 36
139 initial apicid    : 36
140 fpu        : yes
141 fpu_exception    : yes
142 cpuid level    : 13
143 wp        : yes
144 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
145 bogomips    : 4199.42
146 clflush size    : 64
147 cache_alignment    : 64
148 address sizes    : 46 bits physical, 48 bits virtual
149 power management:
150 
151 processor    : 6
152 vendor_id    : GenuineIntel
153 cpu family    : 6
154 model        : 62
155 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
156 stepping    : 4
157 cpu MHz        : 2099.921
158 cache size    : 15360 KB
159 physical id    : 0
160 siblings    : 12
161 core id        : 3
162 cpu cores    : 6
163 apicid        : 6
164 initial apicid    : 6
165 fpu        : yes
166 fpu_exception    : yes
167 cpuid level    : 13
168 wp        : yes
169 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
170 bogomips    : 4199.84
171 clflush size    : 64
172 cache_alignment    : 64
173 address sizes    : 46 bits physical, 48 bits virtual
174 power management:
175 
176 processor    : 7
177 vendor_id    : GenuineIntel
178 cpu family    : 6
179 model        : 62
180 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
181 stepping    : 4
182 cpu MHz        : 2099.921
183 cache size    : 15360 KB
184 physical id    : 1
185 siblings    : 12
186 core id        : 3
187 cpu cores    : 6
188 apicid        : 38
189 initial apicid    : 38
190 fpu        : yes
191 fpu_exception    : yes
192 cpuid level    : 13
193 wp        : yes
194 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
195 bogomips    : 4199.42
196 clflush size    : 64
197 cache_alignment    : 64
198 address sizes    : 46 bits physical, 48 bits virtual
199 power management:
200 
201 processor    : 8
202 vendor_id    : GenuineIntel
203 cpu family    : 6
204 model        : 62
205 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
206 stepping    : 4
207 cpu MHz        : 2099.921
208 cache size    : 15360 KB
209 physical id    : 0
210 siblings    : 12
211 core id        : 4
212 cpu cores    : 6
213 apicid        : 8
214 initial apicid    : 8
215 fpu        : yes
216 fpu_exception    : yes
217 cpuid level    : 13
218 wp        : yes
219 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
220 bogomips    : 4199.84
221 clflush size    : 64
222 cache_alignment    : 64
223 address sizes    : 46 bits physical, 48 bits virtual
224 power management:
225 
226 processor    : 9
227 vendor_id    : GenuineIntel
228 cpu family    : 6
229 model        : 62
230 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
231 stepping    : 4
232 cpu MHz        : 2099.921
233 cache size    : 15360 KB
234 physical id    : 1
235 siblings    : 12
236 core id        : 4
237 cpu cores    : 6
238 apicid        : 40
239 initial apicid    : 40
240 fpu        : yes
241 fpu_exception    : yes
242 cpuid level    : 13
243 wp        : yes
244 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
245 bogomips    : 4199.42
246 clflush size    : 64
247 cache_alignment    : 64
248 address sizes    : 46 bits physical, 48 bits virtual
249 power management:
250 
251 processor    : 10
252 vendor_id    : GenuineIntel
253 cpu family    : 6
254 model        : 62
255 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
256 stepping    : 4
257 cpu MHz        : 2099.921
258 cache size    : 15360 KB
259 physical id    : 0
260 siblings    : 12
261 core id        : 5
262 cpu cores    : 6
263 apicid        : 10
264 initial apicid    : 10
265 fpu        : yes
266 fpu_exception    : yes
267 cpuid level    : 13
268 wp        : yes
269 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
270 bogomips    : 4199.84
271 clflush size    : 64
272 cache_alignment    : 64
273 address sizes    : 46 bits physical, 48 bits virtual
274 power management:
275 
276 processor    : 11
277 vendor_id    : GenuineIntel
278 cpu family    : 6
279 model        : 62
280 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
281 stepping    : 4
282 cpu MHz        : 2099.921
283 cache size    : 15360 KB
284 physical id    : 1
285 siblings    : 12
286 core id        : 5
287 cpu cores    : 6
288 apicid        : 42
289 initial apicid    : 42
290 fpu        : yes
291 fpu_exception    : yes
292 cpuid level    : 13
293 wp        : yes
294 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
295 bogomips    : 4199.42
296 clflush size    : 64
297 cache_alignment    : 64
298 address sizes    : 46 bits physical, 48 bits virtual
299 power management:
300 
301 processor    : 12
302 vendor_id    : GenuineIntel
303 cpu family    : 6
304 model        : 62
305 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
306 stepping    : 4
307 cpu MHz        : 2099.921
308 cache size    : 15360 KB
309 physical id    : 0
310 siblings    : 12
311 core id        : 0
312 cpu cores    : 6
313 apicid        : 1
314 initial apicid    : 1
315 fpu        : yes
316 fpu_exception    : yes
317 cpuid level    : 13
318 wp        : yes
319 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
320 bogomips    : 4199.84
321 clflush size    : 64
322 cache_alignment    : 64
323 address sizes    : 46 bits physical, 48 bits virtual
324 power management:
325 
326 processor    : 13
327 vendor_id    : GenuineIntel
328 cpu family    : 6
329 model        : 62
330 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
331 stepping    : 4
332 cpu MHz        : 2099.921
333 cache size    : 15360 KB
334 physical id    : 1
335 siblings    : 12
336 core id        : 0
337 cpu cores    : 6
338 apicid        : 33
339 initial apicid    : 33
340 fpu        : yes
341 fpu_exception    : yes
342 cpuid level    : 13
343 wp        : yes
344 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
345 bogomips    : 4199.42
346 clflush size    : 64
347 cache_alignment    : 64
348 address sizes    : 46 bits physical, 48 bits virtual
349 power management:
350 
351 processor    : 14
352 vendor_id    : GenuineIntel
353 cpu family    : 6
354 model        : 62
355 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
356 stepping    : 4
357 cpu MHz        : 2099.921
358 cache size    : 15360 KB
359 physical id    : 0
360 siblings    : 12
361 core id        : 1
362 cpu cores    : 6
363 apicid        : 3
364 initial apicid    : 3
365 fpu        : yes
366 fpu_exception    : yes
367 cpuid level    : 13
368 wp        : yes
369 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
370 bogomips    : 4199.84
371 clflush size    : 64
372 cache_alignment    : 64
373 address sizes    : 46 bits physical, 48 bits virtual
374 power management:
375 
376 processor    : 15
377 vendor_id    : GenuineIntel
378 cpu family    : 6
379 model        : 62
380 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
381 stepping    : 4
382 cpu MHz        : 2099.921
383 cache size    : 15360 KB
384 physical id    : 1
385 siblings    : 12
386 core id        : 1
387 cpu cores    : 6
388 apicid        : 35
389 initial apicid    : 35
390 fpu        : yes
391 fpu_exception    : yes
392 cpuid level    : 13
393 wp        : yes
394 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
395 bogomips    : 4199.42
396 clflush size    : 64
397 cache_alignment    : 64
398 address sizes    : 46 bits physical, 48 bits virtual
399 power management:
400 
401 processor    : 16
402 vendor_id    : GenuineIntel
403 cpu family    : 6
404 model        : 62
405 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
406 stepping    : 4
407 cpu MHz        : 2099.921
408 cache size    : 15360 KB
409 physical id    : 0
410 siblings    : 12
411 core id        : 2
412 cpu cores    : 6
413 apicid        : 5
414 initial apicid    : 5
415 fpu        : yes
416 fpu_exception    : yes
417 cpuid level    : 13
418 wp        : yes
419 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
420 bogomips    : 4199.84
421 clflush size    : 64
422 cache_alignment    : 64
423 address sizes    : 46 bits physical, 48 bits virtual
424 power management:
425 
426 processor    : 17
427 vendor_id    : GenuineIntel
428 cpu family    : 6
429 model        : 62
430 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
431 stepping    : 4
432 cpu MHz        : 2099.921
433 cache size    : 15360 KB
434 physical id    : 1
435 siblings    : 12
436 core id        : 2
437 cpu cores    : 6
438 apicid        : 37
439 initial apicid    : 37
440 fpu        : yes
441 fpu_exception    : yes
442 cpuid level    : 13
443 wp        : yes
444 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
445 bogomips    : 4199.42
446 clflush size    : 64
447 cache_alignment    : 64
448 address sizes    : 46 bits physical, 48 bits virtual
449 power management:
450 
451 processor    : 18
452 vendor_id    : GenuineIntel
453 cpu family    : 6
454 model        : 62
455 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
456 stepping    : 4
457 cpu MHz        : 2099.921
458 cache size    : 15360 KB
459 physical id    : 0
460 siblings    : 12
461 core id        : 3
462 cpu cores    : 6
463 apicid        : 7
464 initial apicid    : 7
465 fpu        : yes
466 fpu_exception    : yes
467 cpuid level    : 13
468 wp        : yes
469 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
470 bogomips    : 4199.84
471 clflush size    : 64
472 cache_alignment    : 64
473 address sizes    : 46 bits physical, 48 bits virtual
474 power management:
475 
476 processor    : 19
477 vendor_id    : GenuineIntel
478 cpu family    : 6
479 model        : 62
480 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
481 stepping    : 4
482 cpu MHz        : 2099.921
483 cache size    : 15360 KB
484 physical id    : 1
485 siblings    : 12
486 core id        : 3
487 cpu cores    : 6
488 apicid        : 39
489 initial apicid    : 39
490 fpu        : yes
491 fpu_exception    : yes
492 cpuid level    : 13
493 wp        : yes
494 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
495 bogomips    : 4199.42
496 clflush size    : 64
497 cache_alignment    : 64
498 address sizes    : 46 bits physical, 48 bits virtual
499 power management:
500 
501 processor    : 20
502 vendor_id    : GenuineIntel
503 cpu family    : 6
504 model        : 62
505 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
506 stepping    : 4
507 cpu MHz        : 2099.921
508 cache size    : 15360 KB
509 physical id    : 0
510 siblings    : 12
511 core id        : 4
512 cpu cores    : 6
513 apicid        : 9
514 initial apicid    : 9
515 fpu        : yes
516 fpu_exception    : yes
517 cpuid level    : 13
518 wp        : yes
519 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
520 bogomips    : 4199.84
521 clflush size    : 64
522 cache_alignment    : 64
523 address sizes    : 46 bits physical, 48 bits virtual
524 power management:
525 
526 processor    : 21
527 vendor_id    : GenuineIntel
528 cpu family    : 6
529 model        : 62
530 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
531 stepping    : 4
532 cpu MHz        : 2099.921
533 cache size    : 15360 KB
534 physical id    : 1
535 siblings    : 12
536 core id        : 4
537 cpu cores    : 6
538 apicid        : 41
539 initial apicid    : 41
540 fpu        : yes
541 fpu_exception    : yes
542 cpuid level    : 13
543 wp        : yes
544 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
545 bogomips    : 4199.42
546 clflush size    : 64
547 cache_alignment    : 64
548 address sizes    : 46 bits physical, 48 bits virtual
549 power management:
550 
551 processor    : 22
552 vendor_id    : GenuineIntel
553 cpu family    : 6
554 model        : 62
555 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
556 stepping    : 4
557 cpu MHz        : 2099.921
558 cache size    : 15360 KB
559 physical id    : 0
560 siblings    : 12
561 core id        : 5
562 cpu cores    : 6
563 apicid        : 11
564 initial apicid    : 11
565 fpu        : yes
566 fpu_exception    : yes
567 cpuid level    : 13
568 wp        : yes
569 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
570 bogomips    : 4199.84
571 clflush size    : 64
572 cache_alignment    : 64
573 address sizes    : 46 bits physical, 48 bits virtual
574 power management:
575 
576 processor    : 23
577 vendor_id    : GenuineIntel
578 cpu family    : 6
579 model        : 62
580 model name    : Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz
581 stepping    : 4
582 cpu MHz        : 2099.921
583 cache size    : 15360 KB
584 physical id    : 1
585 siblings    : 12
586 core id        : 5
587 cpu cores    : 6
588 apicid        : 43
589 initial apicid    : 43
590 fpu        : yes
591 fpu_exception    : yes
592 cpuid level    : 13
593 wp        : yes
594 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
595 bogomips    : 4199.42
596 clflush size    : 64
597 cache_alignment    : 64
598 address sizes    : 46 bits physical, 48 bits virtual
599 power management:
cpu信息

auto_client\files\disk.out

  1                                      
  2 Adapter #0
  3 
  4 Enclosure Device ID: 32
  5 Slot Number: 0
  6 Drive's postion: DiskGroup: 0, Span: 0, Arm: 0
  7 Enclosure position: 0
  8 Device Id: 0
  9 WWN: 5000C5007272C288
 10 Sequence Number: 2
 11 Media Error Count: 0
 12 Other Error Count: 0
 13 Predictive Failure Count: 0
 14 Last Predictive Failure Event Seq Number: 0
 15 PD Type: SAS
 16 Raw Size: 279.396 GB [0x22ecb25c Sectors]
 17 Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
 18 Coerced Size: 278.875 GB [0x22dc0000 Sectors]
 19 Firmware state: Online, Spun Up
 20 Device Firmware Level: LS08
 21 Shield Counter: 0
 22 Successful diagnostics completion on :  N/A
 23 SAS Address(0): 0x5000c5007272c289
 24 SAS Address(1): 0x0
 25 Connected Port Number: 0(path0) 
 26 Inquiry Data: SEAGATE ST300MM0006     LS08S0K2B5NV            
 27 FDE Enable: Disable
 28 Secured: Unsecured
 29 Locked: Unlocked
 30 Needs EKM Attention: No
 31 Foreign State: None 
 32 Device Speed: 6.0Gb/s 
 33 Link Speed: 6.0Gb/s 
 34 Media Type: Hard Disk Device
 35 Drive Temperature :29C (84.20 F)
 36 PI Eligibility:  No 
 37 Drive is formatted for PI information:  No
 38 PI: No PI
 39 Drive's write cache : Disabled
 40 Port-0 :
 41 Port status: Active
 42 Port's Linkspeed: 6.0Gb/s 
 43 Port-1 :
 44 Port status: Active
 45 Port's Linkspeed: Unknown 
 46 Drive has flagged a S.M.A.R.T alert : No
 47 
 48 
 49 
 50 Enclosure Device ID: 32
 51 Slot Number: 1
 52 Drive's postion: DiskGroup: 0, Span: 0, Arm: 1
 53 Enclosure position: 0
 54 Device Id: 1
 55 WWN: 5000C5007272DE74
 56 Sequence Number: 2
 57 Media Error Count: 0
 58 Other Error Count: 0
 59 Predictive Failure Count: 0
 60 Last Predictive Failure Event Seq Number: 0
 61 PD Type: SAS
 62 Raw Size: 279.396 GB [0x22ecb25c Sectors]
 63 Non Coerced Size: 278.896 GB [0x22dcb25c Sectors]
 64 Coerced Size: 278.875 GB [0x22dc0000 Sectors]
 65 Firmware state: Online, Spun Up
 66 Device Firmware Level: LS08
 67 Shield Counter: 0
 68 Successful diagnostics completion on :  N/A
 69 SAS Address(0): 0x5000c5007272de75
 70 SAS Address(1): 0x0
 71 Connected Port Number: 0(path0) 
 72 Inquiry Data: SEAGATE ST300MM0006     LS08S0K2B5AH            
 73 FDE Enable: Disable
 74 Secured: Unsecured
 75 Locked: Unlocked
 76 Needs EKM Attention: No
 77 Foreign State: None 
 78 Device Speed: 6.0Gb/s 
 79 Link Speed: 6.0Gb/s 
 80 Media Type: Hard Disk Device
 81 Drive Temperature :29C (84.20 F)
 82 PI Eligibility:  No 
 83 Drive is formatted for PI information:  No
 84 PI: No PI
 85 Drive's write cache : Disabled
 86 Port-0 :
 87 Port status: Active
 88 Port's Linkspeed: 6.0Gb/s 
 89 Port-1 :
 90 Port status: Active
 91 Port's Linkspeed: Unknown 
 92 Drive has flagged a S.M.A.R.T alert : No
 93 
 94 
 95 
 96 Enclosure Device ID: 32
 97 Slot Number: 2
 98 Drive's postion: DiskGroup: 1, Span: 0, Arm: 0
 99 Enclosure position: 0
100 Device Id: 2
101 WWN: 50025388A075B731
102 Sequence Number: 2
103 Media Error Count: 0
104 Other Error Count: 1158
105 Predictive Failure Count: 0
106 Last Predictive Failure Event Seq Number: 0
107 PD Type: SATA
108 Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
109 Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
110 Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
111 Firmware state: Online, Spun Up
112 Device Firmware Level: 1B6Q
113 Shield Counter: 0
114 Successful diagnostics completion on :  N/A
115 SAS Address(0): 0x500056b37789abee
116 Connected Port Number: 0(path0) 
117 Inquiry Data: S1SZNSAFA01085L     Samsung SSD 850 PRO 512GB               EXM01B6Q
118 FDE Enable: Disable
119 Secured: Unsecured
120 Locked: Unlocked
121 Needs EKM Attention: No
122 Foreign State: None 
123 Device Speed: 6.0Gb/s 
124 Link Speed: 6.0Gb/s 
125 Media Type: Solid State Device
126 Drive:  Not Certified
127 Drive Temperature :25C (77.00 F)
128 PI Eligibility:  No 
129 Drive is formatted for PI information:  No
130 PI: No PI
131 Drive's write cache : Disabled
132 Drive's NCQ setting : Disabled
133 Port-0 :
134 Port status: Active
135 Port's Linkspeed: 6.0Gb/s 
136 Drive has flagged a S.M.A.R.T alert : No
137 
138 
139 
140 Enclosure Device ID: 32
141 Slot Number: 3
142 Drive's postion: DiskGroup: 1, Span: 0, Arm: 1
143 Enclosure position: 0
144 Device Id: 3
145 WWN: 50025385A02A074F
146 Sequence Number: 2
147 Media Error Count: 0
148 Other Error Count: 0
149 Predictive Failure Count: 0
150 Last Predictive Failure Event Seq Number: 0
151 PD Type: SATA
152 Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
153 Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
154 Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
155 Firmware state: Online, Spun Up
156 Device Firmware Level: 6B0Q
157 Shield Counter: 0
158 Successful diagnostics completion on :  N/A
159 SAS Address(0): 0x500056b37789abef
160 Connected Port Number: 0(path0) 
161 Inquiry Data: S1AXNSAF912433K     Samsung SSD 840 PRO Series              DXM06B0Q
162 FDE Enable: Disable
163 Secured: Unsecured
164 Locked: Unlocked
165 Needs EKM Attention: No
166 Foreign State: None 
167 Device Speed: 6.0Gb/s 
168 Link Speed: 6.0Gb/s 
169 Media Type: Solid State Device
170 Drive:  Not Certified
171 Drive Temperature :28C (82.40 F)
172 PI Eligibility:  No 
173 Drive is formatted for PI information:  No
174 PI: No PI
175 Drive's write cache : Disabled
176 Drive's NCQ setting : Disabled
177 Port-0 :
178 Port status: Active
179 Port's Linkspeed: 6.0Gb/s 
180 Drive has flagged a S.M.A.R.T alert : No
181 
182 
183 
184 Enclosure Device ID: 32
185 Slot Number: 4
186 Drive's postion: DiskGroup: 1, Span: 1, Arm: 0
187 Enclosure position: 0
188 Device Id: 4
189 WWN: 50025385A01FD838
190 Sequence Number: 2
191 Media Error Count: 0
192 Other Error Count: 0
193 Predictive Failure Count: 0
194 Last Predictive Failure Event Seq Number: 0
195 PD Type: SATA
196 Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
197 Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
198 Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
199 Firmware state: Online, Spun Up
200 Device Firmware Level: 5B0Q
201 Shield Counter: 0
202 Successful diagnostics completion on :  N/A
203 SAS Address(0): 0x500056b37789abf0
204 Connected Port Number: 0(path0) 
205 Inquiry Data: S1AXNSAF303909M     Samsung SSD 840 PRO Series              DXM05B0Q
206 FDE Enable: Disable
207 Secured: Unsecured
208 Locked: Unlocked
209 Needs EKM Attention: No
210 Foreign State: None 
211 Device Speed: 6.0Gb/s 
212 Link Speed: 6.0Gb/s 
213 Media Type: Solid State Device
214 Drive:  Not Certified
215 Drive Temperature :27C (80.60 F)
216 PI Eligibility:  No 
217 Drive is formatted for PI information:  No
218 PI: No PI
219 Drive's write cache : Disabled
220 Drive's NCQ setting : Disabled
221 Port-0 :
222 Port status: Active
223 Port's Linkspeed: 6.0Gb/s 
224 Drive has flagged a S.M.A.R.T alert : No
225 
226 
227 
228 Enclosure Device ID: 32
229 Slot Number: 5
230 Drive's postion: DiskGroup: 1, Span: 1, Arm: 1
231 Enclosure position: 0
232 Device Id: 5
233 WWN: 50025385A02AB5C9
234 Sequence Number: 2
235 Media Error Count: 0
236 Other Error Count: 0
237 Predictive Failure Count: 0
238 Last Predictive Failure Event Seq Number: 0
239 PD Type: SATA
240 Raw Size: 476.939 GB [0x3b9e12b0 Sectors]
241 Non Coerced Size: 476.439 GB [0x3b8e12b0 Sectors]
242 Coerced Size: 476.375 GB [0x3b8c0000 Sectors]
243 Firmware state: Online, Spun Up
244 Device Firmware Level: 6B0Q
245 Shield Counter: 0
246 Successful diagnostics completion on :  N/A
247 SAS Address(0): 0x500056b37789abf1
248 Connected Port Number: 0(path0) 
249 Inquiry Data: S1AXNSAFB00549A     Samsung SSD 840 PRO Series              DXM06B0Q
250 FDE Enable: Disable
251 Secured: Unsecured
252 Locked: Unlocked
253 Needs EKM Attention: No
254 Foreign State: None 
255 Device Speed: 6.0Gb/s 
256 Link Speed: 6.0Gb/s 
257 Media Type: Solid State Device
258 Drive:  Not Certified
259 Drive Temperature :28C (82.40 F)
260 PI Eligibility:  No 
261 Drive is formatted for PI information:  No
262 PI: No PI
263 Drive's write cache : Disabled
264 Drive's NCQ setting : Disabled
265 Port-0 :
266 Port status: Active
267 Port's Linkspeed: 6.0Gb/s 
268 Drive has flagged a S.M.A.R.T alert : No
硬盘信息

auto_client\files\memory.out

  1 Memory Device
  2     Total Width: 32 bits
  3     Data Width: 32 bits
  4     Size: 1024 MB
  5     Form Factor: DIMM
  6     Set: None
  7     Locator: DIMM #0
  8     Bank Locator: BANK #0
  9     Type: DRAM
 10     Type Detail: EDO
 11     Speed: 667 MHz
 12     Manufacturer: Not Specified
 13     Serial Number: Not Specified
 14     Asset Tag: Not Specified
 15     Part Number: Not Specified
 16     Rank: Unknown
 17 
 18 Memory Device
 19     Total Width: 32 bits
 20     Data Width: 32 bits
 21     Size: No Module Installed
 22     Form Factor: DIMM
 23     Set: None
 24     Locator: DIMM #1
 25     Bank Locator: BANK #1
 26     Type: DRAM
 27     Type Detail: EDO
 28     Speed: 667 MHz
 29     Manufacturer: Not Specified
 30     Serial Number: Not Specified
 31     Asset Tag: Not Specified
 32     Part Number: Not Specified
 33     Rank: Unknown
 34 
 35 Memory Device
 36     Total Width: 32 bits
 37     Data Width: 32 bits
 38     Size: No Module Installed
 39     Form Factor: DIMM
 40     Set: None
 41     Locator: DIMM #2
 42     Bank Locator: BANK #2
 43     Type: DRAM
 44     Type Detail: EDO
 45     Speed: 667 MHz
 46     Manufacturer: Not Specified
 47     Serial Number: Not Specified
 48     Asset Tag: Not Specified
 49     Part Number: Not Specified
 50     Rank: Unknown
 51 
 52 Memory Device
 53     Total Width: 32 bits
 54     Data Width: 32 bits
 55     Size: No Module Installed
 56     Form Factor: DIMM
 57     Set: None
 58     Locator: DIMM #3
 59     Bank Locator: BANK #3
 60     Type: DRAM
 61     Type Detail: EDO
 62     Speed: 667 MHz
 63     Manufacturer: Not Specified
 64     Serial Number: Not Specified
 65     Asset Tag: Not Specified
 66     Part Number: Not Specified
 67     Rank: Unknown
 68 
 69 Memory Device
 70     Total Width: 32 bits
 71     Data Width: 32 bits
 72     Size: No Module Installed
 73     Form Factor: DIMM
 74     Set: None
 75     Locator: DIMM #4
 76     Bank Locator: BANK #4
 77     Type: DRAM
 78     Type Detail: EDO
 79     Speed: 667 MHz
 80     Manufacturer: Not Specified
 81     Serial Number: Not Specified
 82     Asset Tag: Not Specified
 83     Part Number: Not Specified
 84     Rank: Unknown
 85 
 86 Memory Device
 87     Total Width: 32 bits
 88     Data Width: 32 bits
 89     Size: No Module Installed
 90     Form Factor: DIMM
 91     Set: None
 92     Locator: DIMM #5
 93     Bank Locator: BANK #5
 94     Type: DRAM
 95     Type Detail: EDO
 96     Speed: 667 MHz
 97     Manufacturer: Not Specified
 98     Serial Number: Not Specified
 99     Asset Tag: Not Specified
100     Part Number: Not Specified
101     Rank: Unknown
102 
103 Memory Device
104     Total Width: 32 bits
105     Data Width: 32 bits
106     Size: No Module Installed
107     Form Factor: DIMM
108     Set: None
109     Locator: DIMM #6
110     Bank Locator: BANK #6
111     Type: DRAM
112     Type Detail: EDO
113     Speed: 667 MHz
114     Manufacturer: Not Specified
115     Serial Number: Not Specified
116     Asset Tag: Not Specified
117     Part Number: Not Specified
118     Rank: Unknown
119 
120 Memory Device
121     Total Width: 32 bits
122     Data Width: 32 bits
123     Size: No Module Installed
124     Form Factor: DIMM
125     Set: None
126     Locator: DIMM #7
127     Bank Locator: BANK #7
128     Type: DRAM
129     Type Detail: EDO
130     Speed: 667 MHz
131     Manufacturer: Not Specified
132     Serial Number: Not Specified
133     Asset Tag: Not Specified
134     Part Number: Not Specified
135     Rank: Unknown
内存信息

auto_client\files\nic.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

auto_client\src\plugins\basic.py

class Basic(object):

    @classmethod
    def initial(cls):
        return cls()

    def process(self,cmd_func,test):
        if test:
            output = {
                'os_platform': "linux",
                'os_version': "CentOS release 6.6 (Final)\nKernel \r on an \m",
                'hostname': 'c1.com'
            }
        else:
            output = {
                'os_platform': cmd_func("uname").strip(),
                'os_version': cmd_func("cat /etc/issue").strip().split('\n')[0],
                'hostname': cmd_func("hostname").strip(),
            }
        return output

auto_client\src\plugins\board.py

import os
from lib.config import settings

class Board(object):
    def process(self, cmd_func, test):
        if test:
            output = open(os.path.join(settings.BASEDIR, 'files/board.out'), 'r', encoding='utf-8').read()
        else:
            output = cmd_func("sudo dmidecode -t1")
        return self.parse(output)

    def parse(self, content):

        result = {}
        key_map = {
            'Manufacturer': 'manufacturer',
            'Product Name': 'model',
            'Serial Number': 'sn',
        }

        for item in content.split('\n'):
            row_data = item.strip().split(':')
            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

auto_client\src\plugins\disk.py

import re
import os
from lib.config import settings

class Disk(object):

    def process(self,cmd_func,test):
        if test:
            output = open(os.path.join(settings.BASEDIR, 'files/disk.out'), 'r', encoding='utf-8').read()
        else:
            output = cmd_func("sudo MegaCli  -PDList -aALL")

        return self.parse(output)

    def parse(self, content):
        """
        解析shell命令返回结果
        :param content: shell 命令结果
        :return:解析后的结果
        """
        response = {}
        result = []
        for row_line in content.split("\n\n\n\n"):
            result.append(row_line)
        for item in result:
            temp_dict = {}
            for row in item.split('\n'):
                if not row.strip():
                    continue
                if len(row.split(':')) != 2:
                    continue
                key, value = row.split(':')
                name = self.mega_patter_match(key)
                if name:
                    if key == 'Raw Size':
                        raw_size = re.search('(\d+\.\d+)', value.strip())
                        if raw_size:

                            temp_dict[name] = raw_size.group()
                        else:
                            raw_size = '0'
                    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

auto_client\src\plugins\memory.py

import re
import os
from lib.config import settings
from lib import convert

class Memory(object):
    def process(self, cmd_func, test):
        if test:
            output = open(os.path.join(settings.BASEDIR, 'files/memory.out'), 'r', encoding='utf-8').read()

        else:
            output = cmd_func("sudo dmidecode  -q -t 17 2>/dev/null")
        return self.parse(output)

    def parse(self, content):
        """
        解析shell命令返回结果
        :param content: shell 命令结果
        :return:解析后的结果
        """
        ram_dict = {}
        key_map = {
            'Size': 'capacity',
            'Locator': 'slot',
            'Type': 'model',
            'Speed': 'speed',
            'Manufacturer': 'manufacturer',
            'Serial Number': 'sn',

        }
        devices = content.split('Memory Device')
        for item in devices:
            item = item.strip()
            if not item:
                continue
            if item.startswith('#'):
                continue
            segment = {}
            lines = item.split('\n\t')
            for line in lines:
                if not line.strip():
                    continue
                if len(line.split(':')):
                    key, value = line.split(':')
                else:
                    key = line.split(':')[0]
                    value = ""
                if key in key_map:
                    if key == 'Size':
                        segment[key_map['Size']] = convert.convert_mb_to_gb(value, 0)
                    else:
                        segment[key_map[key.strip()]] = value.strip()

            ram_dict[segment['slot']] = segment

        return ram_dict

auto_client\src\plugins\nic.py

import os
import re
from lib.config import settings

class Nic(object):
    def process(self, cmd_func, test):
        if test:
            output = open(os.path.join(settings.BASEDIR, 'files/nic.out'), 'r', encoding='utf-8').read()
            interfaces_info = self._interfaces_ip(output)
        else:
            interfaces_info = self.linux_interfaces(cmd_func)

        self.standard(interfaces_info)

        return interfaces_info

    def linux_interfaces(self, command_func):
        '''
        Obtain interface information for *NIX/BSD variants
        '''
        ifaces = dict()
        ip_path = 'ip'
        if ip_path:
            cmd1 = command_func('sudo {0} link show'.format(ip_path))
            cmd2 = command_func('sudo {0} addr show'.format(ip_path))
            ifaces = self._interfaces_ip(cmd1 + '\n' + cmd2)
        return ifaces

详细的扑捉错误信息

    def exec_plugin(self):
        server_info = {}
        for k,v in self.plugin_items.items():
            # 找到v字符串:src.plugins.nic.Nic,
            # src.plugins.disk.Disk
            info = {'status':True,'data': None,'msg':None}
            try:
                module_path,cls_name = v.rsplit('.',maxsplit=1)
                module = importlib.import_module(module_path)
                cls = getattr(module,cls_name)

                if hasattr(cls,'initial'):
                    obj = cls.initial()
                else:
                    obj = cls()
                ret = obj.process(self.exec_cmd,self.test)
                info['data'] = ret
            except Exception as e:
                info['status'] = False
                info['msg'] = traceback.format_exc()

            server_info[k] = info
        return server_info

  

posted @ 2018-07-16 21:42  活的潇洒80  阅读(348)  评论(0编辑  收藏  举报