Data bank automated asset data acquisition

introduce
An introduction to the author
The author of this article is Wucheng contact mode: autohomeops@autohome.com.cn, which is mainly responsible for the development and technical management of cloud home platform. Personal Blog http://jackywu.github.io/
Team Introduction
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.
Contact information
You can communicate with us via email or message from official technology blog.
First, preface
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).
CentOS-6
CentOS-7
Windows 2008 R2
The server that this plug-in supports has
HP
DELL
CISCO
Four. Installation
Put the entire code directory in the module directory of Puppet Master, assuming that your module directory is /etc/puppet/modules
CD /etc/puppet/modules
Git clone git@github.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.
Five. Configuration
The configuration file is lib/puppet/reports/report_setting.yaml.
parameter
Meaning
Examples
Report_url
Report interface address
Http://localhost/api/report
Auth_required
Whether the interface contains validation
True/false, the default is false, and the validation code is implemented in auth.rb.
User
Verifying the username
If auth_required is true, you need to fill in
Passwd
Authentication cipher
If auth_required is true, you need to fill in
Enable_cache
Whether cache functionality is enabled
True/false, the default is false
Six. Use
Manual trigger
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?
‘setuptime’installation time
‘sn’sequence number
‘manufactory’server manufacturer
‘productname’server product name
‘model’server model
‘cpu_count’number of physical CPU numbers
‘cpu_core_count’logical kernel number of CPU
‘cpu_model’CPU model
‘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
‘certname’Puppet certname
}
Eight, summary
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.

Leave a Reply

Your email address will not be published. Required fields are marked *