GithubHelp home page GithubHelp logo

Comments (1)

wangyu096 avatar wangyu096 commented on April 27, 2024

功能描述

根据ip列表批量查询作业执行日志

请求参数

{{ bkapi_authorization_description }}

Header参数

字段 类型 必选 描述
X-Bkapi-Authorization string 认证信息
Accept string 固定值。application/json
Content-Type string 固定值。application/json

Body参数

字段 类型 必选 描述
bk_biz_id long 业务ID
job_instance_id long 作业实例ID
step_instance_id long 步骤实例ID
ip_list array 源/目标主机IP列表,定义见ip
ip
字段 类型 必选 描述
bk_cloud_id int 云区域ID
ip string IP地址

请求参数示例

  • POST
{
    "bk_biz_id": 1,
    "job_instance_id": 100,
    "step_instance_id": 200,
    "ip_list": [
        {
            "bk_cloud_id": 0,
            "ip": "10.0.0.1"
        },
        {
            "bk_cloud_id": 0,
            "ip": "10.0.0.2"
        }
    ]
}	

返回结果示例

脚本执行步骤

{
    "result": true,
    "code": 0,
    "message": "",
    "data": {
        "log_type": 1,
        "task_instance_id": 100,
        "step_instance_id": 200,
        "script_task_logs": [
            {
                "ip": "10.0.0.1",
                "bk_cloud_id": 0,
                "log_content": "[2018-03-15 14:39:30][PID:56875] job_start\n"
            },
            {
                "ip": "10.0.0.2",
                "bk_cloud_id": 0,
                "log_content": "[2018-03-15 14:39:30][PID:16789] job_start\n"
            }
        ]
    }
}

文件分发步骤

{
    "result": true,
    "code": 0,
    "message": "",
    "data": {
        "log_type": 2,
        "task_instance_id": 100,
        "step_instance_id": 200,
        "file_task_logs": [
            {
                "ip": "10.0.0.1",
                "bk_cloud_id": 0,
                "file_logs": [
                    {
                        "mode": 1, 
                        "src_ip": {
                            "bk_cloud_id": 0, 
                            "ip": "10.0.0.2"
                        }, 
                        "src_path": "/data/1.log", 
                        "dest_ip": {
                            "bk_cloud_id": 0, 
                            "ip": "10.0.0.1"
                        }, 
                        "dest_path": "/tmp/1.log", 
                        "status": 4,
                        "log_content": "[2021-06-28 11:32:16] FileName: /tmp/1.log FileSize: 9.0 Bytes State: dest agent success download file Speed: 1 KB/s Progress: 100% StatusDesc: dest agent success download file Detail: success" 
                    }
                ]
            },
            {
                "ip": "10.0.0.2",
                "bk_cloud_id": 0,
                "file_logs": [
                    {
                        "mode": 0, 
                        "src_ip": {
                            "bk_cloud_id": 0, 
                            "ip": "10.0.0.2"
                        }, 
                        "src_path": "/data/1.log",  
                        "status": 4,
                        "log_content": "[2021-06-28 11:32:16] FileName: /data/1.log FileSize: 9.0 Bytes State: source agent success upload file Speed: 1 KB/s Progress: 100% StatusDesc: source agent success upload file Detail: success upload"
                    }
                ]
            }
        ]
    }
}

文件任务返回结果说明

  • 如果需要返回文件源的上传日志,需要在ip_list添加源文件服务器IP

返回结果说明

data

字段 类型 描述
bk_cloud_id int 目标服务器云区域ID
ip string 目标服务器IP地址
log_type int 日志类型。1-脚本执行任务日志;2-文件分发任务日志
script_task_logs array 脚本执行任务日志。定义见script_task_log
file_task_logs array 文件分发任务日志。定义见file_task_log

script_task_log

字段 类型 描述
bk_cloud_id long 云区域ID
ip string 目标IP地址
log_content string 脚本执行日志内容

file_task_log

字段 类型 描述
bk_cloud_id long 云区域ID
ip string 源/目标IP地址
file_logs array 文件分发日志内容。定义见file_log

file_log

字段 类型 描述
mode 分发模式 0:上传;1:下载
src_ip object 文件源主机IP。定义见ip
src_path string 源文件路径
dest_ip object 分发目标主机IP,mode=1时有值。定义见ip
dest_path string 目标路径,mode=1时有值
status int 任务状态。1-等待开始;2-上传中;3-下载中;4-成功;5-失败
log_content string 文件分发日志内容

ip

字段 类型 描述
bk_cloud_id long 云区域ID
ip string IP地址

from bk-job.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.