# juno-agent **Repository Path**: carlos6/juno-agent ## Basic Information - **Project Name**: juno-agent - **Description**: No description available - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-30 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ![](doc/logo.png) [![Build Status](https://travis-ci.org/douyu/juno.svg?branch=master)](https://travis-ci.org/douyu/juno) [![codecov](https://codecov.io/gh/douyu/juno/branch/master/graph/badge.svg)](https://codecov.io/gh/douyu/juno) [![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/github.com/douyu/juno?tab=doc) [![Go Report Card](https://goreportcard.com/badge/github.com/douyu/juno)](https://goreportcard.com/report/github.com/douyu/juno) ![license](https://img.shields.io/badge/license-Apache--2.0-green.svg) # Juno-Agent Juno-Agent是一个提供服务代理、应用配置下发、应用配置解析、shell沙箱、探活、消息总线的Agent。 Juno-Agent的设计目标主要是让开发能够通过可插拔的组件,观测和治理自己的系统。 ## 最小依赖 * Linux kernel version 2.6.23 or later * Windows 7 or later * FreeBSD 11.2 or later * MacOS 10.11 El Capitan or later ## 快速开始 查看帮助文档 ```cmd Juno-agent --help ``` 生成默认配置 ```cmd Juno-agent config > Juno-agent.toml ``` 使用文本配置,启用一个``test``组件 ```cmd Juno-agent --config=Juno-agent.toml --test ``` 使用文本配置,启用全部组件 ```cmd Juno-agent --config=Juno-agent.toml ``` ## 组件 * 代理模块 * 配置模块 * Shell沙箱 * 探活 * 消息总线 * HTTP模块 * 依赖探活: 提供HTTP接口,针对应用依赖的组件进行探活 ## API文档 ### 依赖探活 #### 说明 目前该组件支持http,mysql,redis,tcp的探活,应用方可以以主动拉取的形式来及时对 应用依赖的组件进行探活 #### POST /api/agent/check #### 请求参数 | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `check_datas` | [] CheckDatas| 待探活组件相关信息 | #### 接口返回 | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `code` | int | 状态码 | | `data` | [] ResHealthCheck | 探活结果 | | `msg` | string | 错误提示信息 | #### 调用示例 ##### curl ```shell script curl --location --request POST 'http://127.0.0.1:60814/api/agent/check' \ --header 'Content-Type: application/json' \ --data-raw '{ "check_datas":[ { "type":"mysql", "data":"{\"dsn\":\"user:pwd@tcp(127.0.0.1:3306)/mark?charset=utf8&parseTime=True&loc=Local\"}" }, { "type":"redis", "data":"{\"addr\":\"127.0.0.1:6740\"}" }, { "type":"http", "data":"{\"http\":\"http://10.117.22.50:60814/api/agent/config\",\"method\":\"get\",\"timeout\":3}" }, { "type":"tcp", "data":"{\"addr\":\"127.0.0.1:8000\",\"network\":\"tcp\"}" } ] }' ``` ##### postman ![image](./static/images/healthcheck/check.png) #### 自定义参数类型详解 * CheckDatas | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `type` | string | 组件名称:目前支持(mysql,redis,http,tcp) | | `data` | string | 组件配置信息json串 | 不同组件配置属性如下 mysql | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `dsn` | string | mysql dsn连接串 | redis | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `dialTimeout` | time.Duration | 连接 超时时间 默认 1 s | | `readTimeout` | time.Duration | 读 超时时间 默认 1 s | | `writeTimeout` | time.Duration | 写 超时时间 默认 1 s | | `db` | int | 默认 0 | | `addr` | string | redis 连接串 | | `passWord` | string | 密码 | http | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `http` | string | http addr | | `header` | string | header | | `method` | string | method | | `timeout` | int64 | timeout | tcp | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `addr` | string | tcp addr | | `header` | string | header | | `network` | string | tcp tcp4 tcp6 | * ResHealthCheck | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `component_type` | string | 组件类型 | | `check_time` | int64 | 探活时间 | | `check_result` | CheckResult | 探活结果 | CheckResult | 名称 | 类型 | 描述 | | :------:| :------: | :------: | | `is_success` | bool | 此次探活结果falg | | `msg` | string | 探活失败提示信息 |