megaease / easeprobe

A simple, standalone, and lightweight tool that can do health/status checking, written in Go.
Apache License 2.0
2.18k stars 231 forks source link

Shell探针中Redis示例有问题 #569

Closed shengbinxu closed 1 month ago

shengbinxu commented 2 months ago
image

1、REDISCLI_AUTH这个环境变量在redis 3.2版本中无效。

image

建议在示例中做一个说明。 替代方案:在命令中使用-a选项指定密码

image

2、当redis server内存不足或者磁盘满了时,使用ping应该是无法检测服务是否异常(没有验证,纯属猜测)。这时候我执行set key aa 会执行失败。 此时对应的语法应该是:

shell:
  - name: Redis (Local)
    cmd: "redis-cli"
    args:
      - "-h"
      - "xxx.xxx.48.xxx"
      - "-a"
      - "$password"
      - "set"
      - "testtest"
      - "1"
    clean_env: true # Do not pass the OS environment variables to the command
                    # default: false
    env:
      # set the `REDISCLI_AUTH` environment variable for redis password
      - "REDISCLI_AUTH=tidecloudredis"
    # check the command output, if does not contain the PONG, mark the status down
    contain : "OK"
    not_contain: "failure" # response body must NOT contain this string, if it does the probe is considered failed.
    with_output: false # if true, the error message will contain the output, it works for `contain` and `not_contain` field.
    regex: false # if true, the `contain` and `not_contain` will be treated as regular expression. default: false

最开始我使用的错误语法是:

args:
      - "-h"
      - "10.25.48.xxx"
      - "-a"
      - "$password"
     #  下面的指令应该分三行
      - "set testtest 1"

建议在示例中做一个说明

suchen-sci commented 2 months ago

Hi,

Thanks a lot for your issue. If possible, could you please to make a PR to update it? Please make sure you test it.

wayne666 commented 1 month ago

直接 args 指定 -a就能解吧

proditis commented 1 month ago

I was about to create a PR for this but it appears that the official documentation for redis cli mentions this environment variable as the suggested method for authentication. image

https://redis.io/docs/latest/develop/connect/cli/

I think we can safely close this issue. This is just an example so the user must adapt the example according to their needs just like @wayne666 suggested.

samanhappy commented 1 month ago

The REDISCLI_AUTH environment variable was introduced in Redis version 5.0.3, as noted in this commit. It might be useful to include a remark about this feature in relevant documentation.