An introduction to the author
The author of this article is Wucheng contact mode: firstname.lastname@example.org, which is mainly responsible for the development and technical management of cloud home platform. Personal Blog http://jackywu.github.io/
We are the car home operation and maintenance team. It is the most core team in the automotive home technology department. It is composed of OP and dev. Our goal is to build a high performance, high scalability, low cost, stable and reliable website infrastructure platform for the auto home group. Team technology blog address is http://autohomeops.corpautohome.com.
You can communicate with us via email or message from official technology blog.
At the OpsWorld conference in Shenzhen, 16, in December, we shared the operation and maintenance data bank – building CMDB method, which mentioned our internal asset data acquisition tools, and we intend to open it open source. Now we share it on Github (Assets_Report).
Two. Introduction of the principle
This tool is implemented on the basis of Facter mechanism, and the results collected are reported to the AutoBank resource management system with Puppet Report Processor.
This is a workflow diagram between Puppet’s Server and Agent.
When Agent sends Request request Catalog, it will report its own facts to Master.
We developed our own Report Processor:assets_report, and sent facts post to AutoBank’s data storage interface through HTTP protocol.
Students interested in developing custom facts can refer to fact_overview and custom facts.
Three, Feature introduction
Compared with Facter built in facts, this plug-in provides more hardware data, such as
CPU number, model
Memory capacity, serial number, manufacturer, slot position
The IP, mask, MAC, and type of the binding on the network card, and support the scene of binding more IP on a network card.
RAID card number, model, memory capacity, RAID Level
Number of disk, capacity, serial number, vendor, RAID card, slot location
Operating system type, version
Server vendor, SN
Advanced features: in order to avoid repeated reports of the same data, and reduce the AutoBank database pressure, this plug-in has a Cache function, that is, if the asset data of a server does not change, then only the not_modify tag will be reported.
The operating system supported by this plug-in has (the system must be 64 bits, because the collection tool in this plug-in is 64 bits).
Windows 2008 R2
The server that this plug-in supports has
Put the entire code directory in the module directory of Puppet Master, assuming that your module directory is /etc/puppet/modules
Git clone email@example.com:AutohomeOps/Assets_Report.git assets_report
Then let all the Node include assets_report modules, through the configuration of the manifests/init.pp in the module, the acquisition tool will be automatically installed on the server. The plug-in will work properly next time Puppet Agent runs.
The configuration file is lib/puppet/reports/report_setting.yaml.
Report interface address
Whether the interface contains validation
True/false, the default is false, and the validation code is implemented in auth.rb.
Verifying the username
If auth_required is true, you need to fill in
If auth_required is true, you need to fill in
Whether cache functionality is enabled
True/false, the default is false
Puppet agent -t
Or when puppet agent’s daemon runs automatically, the AutoBank resource management system interface will receive a HTTP call.
Seven. Data format
‘os_type’type operating system type
‘os_distribution’release operating system release version
‘os_release’version operating system version number
‘not_modify’do you have any changes in the data compared with last time?
‘productname’server product name
‘cpu_count’number of physical CPU numbers
‘cpu_core_count’logical kernel number of CPU
‘nic_count’network card number
Detailed parameters of the’nic’adapter network card
The number of’raid_adaptor_count’controller raid card controller
‘raid_adaptor’controller raid card controller detailed parameters
‘raid_type’type raid type
‘physical_disk_driver’physical disk detailed parameters
Total memory capacity of’ram_size’
‘ram_slot’memory detailed parameters
Each company will develop a set of collection tools when they are doing CMDB, and we need to face many different types of servers, types and versions of operating systems, and use different tools to solve these complicated problems. We have done this dirty work over and over again. We want to open it open, reduce the pain of some people, and hope to maintain a common set of tools with the power of the community to meet the requirements of the configuration of the vast majority of the equipment on the market.
In addition, there may be a few places to think about in the code, there are still some scenes that are not considered, and you are also looking at the Github in the form of issue. Welcome to PR.