Example #1
0
def client():
    if settings.MODE == 'agent':
        cli = AutoAgent()
    elif settings.MODE == 'ssh':
        cli = AutoSSH()
    elif settings.MODE == 'salt':
        cli = AutoSalt()
    else:
        raise Exception('请配置资产采集模式,如:ssh、agent、salt')
    ret = cli.process()
    return ret
Example #2
0
def client():
    # Agent模式
    if settings.MODE == 'agent':
        cli = AutoAgent()
    # Snmp模式
    elif settings.MODE == 'snmp':
        cli = AutoSnmp()
    # 非Agent或Snmp模式,则报异常
    else:
        raise Exception('请配置资产采集模式,如:agent、snmp')
    cli.process()
Example #3
0
def update_client():
    if settings.MODE == 'agent':
        cli = AutoAgent(url=settings.UP_API_URL)
    elif settings.MODE == 'ssh':
        cli = AutoSSH()
    elif settings.MODE == 'salt':
        cli = AutoSalt()
    else:
        raise Exception('请配置资产采集模式,如:ssh、agent、salt')

    ret = cli.process()
    print(ret)
Example #4
0
def client():
    if settings.MODE == 'AGENT':
        cli = AutoAgent()
    elif settings.MODE == 'SSH':
        cli = AutoSSH()
    elif settings.MODE == 'SALT':
        cli = AutoSalt()
    else:
        raise Exception('请配置资产采集模式,如:ssh、agent、salt')
    cli.process()
Example #5
0
def client():
    if settings.MODE == 'agent':
        cli = AutoAgent(url=settings.API_URL)
    elif settings.MODE == 'ssh':
        cli = AutoSSH()
    elif settings.MODE == 'salt':
        cli = AutoSalt()
    else:
        raise Exception('请配置资产采集模式,如:ssh、agent、salt')

    cli.process()
Example #6
0
def client():
    try:
        cli = AutoAgent()
        cli.process()
    except Exception as e:
        print(e)
Example #7
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# __author__= 'luhj'
from src.client import AutoAgent
from src.client import AutoSalt
from src.client import AutoSSH
from config import settings

def client()
    if settings.MODE == 'agent':
        cli = AutoAgent()
    elif settings.MODE == 'ssh':
        cli = AutoSSH()
    elif settings.MODE == 'salt':
        cli = AutoSalt()
    else:
        raise Exception('资产采集模式配置错误[ssh,agent,salt]')
    cli.process()