hardtyz / yii2-health

Yii2 多点健康检查

安装: 19

依赖: 0

建议者: 0

安全: 0

类型:yii2-extension

0.0.2 2018-08-07 12:48 UTC

This package is auto-updated.

Last update: 2024-09-21 22:47:39 UTC


README

1. 安装

安装此扩展的首选方式是通过 composer

并在 composer.json 中添加以下行

    "repositories": [
        {
            "url": "https://bitbucket.org/HardTYZ/yii2-health",
            "type": "git"
        }
    ]

并在 composer.json 的 require 部分添加一行

"hardtyz/yii2-health": "*"

使用方法

配置示例

只需简单地将它添加到您的模块配置中,您需要在 "check" 数组中定义您的检查。

...
   'modules'   => [
        'health' => [
            'class'  => 'hardtyz\health\Module',
            'check' => [
                "TcpCheck" => [
                    "type" => "tcp",                    // type tcp
                    "host" => "localhost",              // tcp host or ip adress
                    "port" => 80,                       // tcp port
                    "name" => "TcpCheck"                // service name
                ],
                "HttpCheck" => [
                    "type" => "http",                   // type http
                    "host" => "https://",       // http or https host
                    "name" => "HttpCheck"               // service name
                ],
                "DataBaseCheck" => [
                    "type" => "db",                     // type database
                    "db" => "db",                       // name of database profile
                    "name" => "DB"                      // service name
                ],
            ],
        ],
    ],
...