CMDB Asset Acquisition

Source: Internet
Author: User

First, analysis

For now, there are four ways to collect assets, namely:

    • Agent
    • SSH classes, such as: Paramiko
    • Saltstack
    • Puppet (Ruby Development)

For the first three are developed in the Python language, the last one for Ruby, so we will focus on the previous three specific content.

Second, Agent

1. Features and application scenarios:

Applicable to the server, from each server side sends the data to the API interface, the API interacts with the database to complete the data communication, the performance is relatively high, the speed is fast, but each server must install the agent.

2. Usage:

Import Subprocessimport requests# Each server, there is such a py file. V1=subprocess.getoutput (' ipconfig ') #执行Windows命令, return information assigned to v1value=v1[68:88] #字符串切片取值v2 =subprocess.getoutput (' dir ') #同上value2 =v2[0:10]url= "http://127.0.0.1:8000/asset.html" #API接口URLresponse =requests.post (url,data={' K1 ': value, ' K2 ': value2}) #向API通过post方式, data is passed in a dictionary to return an object. Print (Response.text) #打印对象的text信息
Three, SSH class (for example: Paramiko)

1. Features and application scenarios:

Applies to fewer servers,

CMDB Asset Acquisition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.