megaease / easeprobe

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

ParseRequestedURI: config.yaml failed to parse with error parse "config.yaml": invalid URI for request #535

Closed d2406 closed 3 months ago

d2406 commented 3 months ago

Environment (please complete the following information):

Describe the bug

config.yaml

http:
  - name: EaseProbe Github
    url: https://www.baidu.com
notify:
  log:
    - name: log file
      file: ./easeprobe.log
settings:
  log:
    level: "debug"
root@local:~/download/easeprobe/bin# ./easeprobe -f config.yaml
DEBU[2024-06-13T01:39:10+08:00] Load meta data: name[EaseProbe], version[v2.1.2]
INFO[2024-06-13T01:39:10+08:00] Clean data file: data/data.yaml-2024-06-12T17_34_31.18293374Z
INFO[2024-06-13T01:39:10+08:00] Load the configuration file successfully!
DEBU[2024-06-13T01:39:10+08:00]
version: ""
http:
    - name: EaseProbe Github
      channels: []
      alert:
        strategy: unknown
        factor: 0
        max: 0
      url: https://github.com/megaease/easeprobe
      proxy: ""
      ca: ""
      cert: ""
      key: ""
      insecure: false
tcp: []
shell: []
client: []
ssh:
    bastion: {}
    servers: []
tls: []
host:
    bastion: {}
    servers: []
ping: []
websocket: []
notify:
    log:
        - name: log file
          file: ./easeprobe.log
          host: ""
          network: ""
settings:
    name: EaseProbe
    icon: https://megaease.com/favicon.png
    pid: /root/download/bin/easeprobe.pid
    log:
        level: debug
        file: ""
        self_rotate: true
        size: 10
        age: 7
        backups: 5
        compress: true
    timeformat: 2006-01-02 15:04:05 UTC
    timezone: UTC
    probe:
        interval: 1m0s
        timeout: 30s
        alert:
            strategy: unknown
            factor: 0
            max: 0
    notify:
        retry:
            times: 3
            interval: 5s
        dry: false
    sla:
        schedule: daily
        time: "00:00"
        data: data/data.yaml
        backups: 5
        channels:
            - __EaseProbe_Channel__
    http:
        ip: 0.0.0.0
        port: "8181"
        refresh: 0s
        log:
            level: info
            file: ""
            self_rotate: true
            size: 10
            age: 7
            backups: 5
            compress: true
INFO[2024-06-13T01:39:10+08:00] Successfully created the PID file: /root/download/bin/easeprobe.pid
INFO[0000] Application Log File [Stdout] - Self-Rotate
INFO[0000] Web Access Log File [Stdout] - Self-Rotate
DEBU[2024-06-13T01:39:10+08:00] [Web] Auto refresh interval time: 1m0s
INFO[2024-06-13T01:39:10+08:00] [Web] HTTP server is listening on 0.0.0.0:8181
DEBU[2024-06-13T01:39:10+08:00] --------- Process the probers settings ---------
DEBU[2024-06-13T01:39:10+08:00] --> HTTP / slice / {DefaultProbe:{ProbeKind: ProbeTag: ProbeName:EaseProbe Github ProbeChannels:[] ProbeTimeout:0s ProbeTimeInterval:0s Labels:map[] StatusChangeThresholdSettings:{Failure:0 Success:0} NotificationStrategySettings:{Strategy:unknown Factor:0 MaxTimes:0} ProbeFunc:<nil> ProbeResult:<nil> metrics:<nil>} URL:https://github.com/megaease/easeprobe Proxy: ContentEncoding: Method: Headers:map[] Body: TextChecker:{Contain: NotContain: RegExp:false containReg:<nil> notContainReg:<nil>} Evaluator:{Variables:[] DocType:unsupported Expression: Document: Extractor:<nil> EvalFuncs:map[] ExtractedValues:map[]} User: Pass: SuccessCode:[] TLS:{CA: Cert: Key: Insecure:false} client:<nil> traceStats:<nil> metrics:<nil>}
DEBU[2024-06-13T01:39:10+08:00] --------- Process the notification settings ---------
DEBU[2024-06-13T01:39:10+08:00] --> Log - slice - {DefaultNotify:{NotifyKind: NotifyFormat:unknown NotifySendFunc:<nil> NotifyName:log file NotifyChannels:[] Dry:false Timeout:0s Retry:{Times:0 Interval:0s}} File:./easeprobe.log Host: Network: Type:0 logger:<nil>}
DEBU[2024-06-13T01:39:10+08:00] Global Probe Configuration: {Interval:1m0s Timeout:30s StatusChangeThresholdSettings:{Failure:0 Success:0} NotificationStrategySettings:{Strategy:unknown Factor:0 MaxTimes:0}}
INFO[2024-06-13T01:39:10+08:00] Found result from data file with name: EaseProbe Github
INFO[2024-06-13T01:39:10+08:00] Probe [http / EaseProbe Github] base options are configured!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_total
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_total> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_total_time
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_total_time> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_status
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_status> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_sla
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_sla> is created!
DEBU[2024-06-13T01:39:10+08:00] [http / EaseProbe Github] the security checks false
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_status_code
INFO[2024-06-13T01:39:10+08:00] [Metric] Counter <EaseProbe_http_status_code> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_content_len
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_content_len> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_dns_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_dns_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_connect_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_connect_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_tls_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_tls_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_send_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_send_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_wait_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_wait_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_transfer_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_transfer_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [Metric] get the name: EaseProbe_http_total_duration
INFO[2024-06-13T01:39:10+08:00] [Metric] Gauge <EaseProbe_http_total_duration> is created!
DEBU[2024-06-13T01:39:10+08:00] [http / EaseProbe Github] configuration: {DefaultProbe:{ProbeKind:http ProbeTag: ProbeName:EaseProbe Github ProbeChannels:[__EaseProbe_Channel__] ProbeTimeout:30s ProbeTimeInterval:1m0s Labels:map[] StatusChangeThresholdSettings:{Failure:1 Success:1} NotificationStrategySettings:{Strategy:regular Factor:1 MaxTimes:1} ProbeFunc:0xe227e0 ProbeResult:0xc0005f3e00 metrics:0xc0004d81e0} URL:https://github.com/megaease/easeprobe Proxy: ContentEncoding: Method:GET Headers:map[] Body: TextChecker:{Contain: NotContain: RegExp:false containReg:<nil> notContainReg:<nil>} Evaluator:{Variables:[] DocType:unsupported Expression: Document: Extractor:<nil> EvalFuncs:map[] ExtractedValues:map[]} User: Pass: SuccessCode:[[0 499]] TLS:{CA: Cert: Key: Insecure:false} client:0xc0004d82a0 traceStats:<nil> metrics:0xc000526500}
INFO[2024-06-13T01:39:10+08:00] [log / log file] - local log file(./easeprobe.log) configured
INFO[2024-06-13T01:39:10+08:00] Notification [log] - [log file] is running on Live mode!
INFO[2024-06-13T01:39:10+08:00] Notification [log] - [log file] is configured!
INFO[2024-06-13T01:39:10+08:00] Successfully setup the notify channel: log
INFO[2024-06-13T01:39:10+08:00] --------- Channel Configuration ---------
INFO[2024-06-13T01:39:10+08:00] Channel: __EaseProbe_Channel__
INFO[2024-06-13T01:39:10+08:00]    Probers:
INFO[2024-06-13T01:39:10+08:00]     - http: EaseProbe Github
INFO[2024-06-13T01:39:10+08:00]    Notifiers:
INFO[2024-06-13T01:39:10+08:00]      - log: log file
DEBU[2024-06-13T01:39:10+08:00] Start Time Gap: 1s = 1m0s / 1
INFO[2024-06-13T01:39:10+08:00] Ready to monitor(http): EaseProbe Github - https://github.com/megaease/easeprobe
DEBU[2024-06-13T01:39:10+08:00] --------- SLA Report Notifies ---------
DEBU[2024-06-13T01:39:10+08:00]   - log : log file
INFO[2024-06-13T01:39:10+08:00] Scheduling daily SLA reports at 00:00 UTC time...
DEBU[2024-06-13T01:39:10+08:00] [http / EaseProbe Github] Delay 0s = (0 * 1s) seconds to start the probe work
INFO[2024-06-13T01:39:10+08:00] The SLA report will be schedule at 2024-06-13 00:00:00 UTC
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - total - start get connection: 1718213950849669863
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - dns - start resolve github.com: 1718213950849784
DEBU[2024-06-13T01:39:10+08:00] Successfully save the SLA data to file: data/data.yaml
DEBU[2024-06-13T01:39:10+08:00] ParseRequestedURI: config.yaml failed to parse with error parse "config.yaml": invalid URI for request
DEBU[2024-06-13T01:39:10+08:00] The configuration file [config.yaml] has not been modified
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - dns - resolve ip [{20.205.243.166 }], time 3.757ms
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - conn - start tcp connect to 20.205.243.166:443: 1718213950853567
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - conn - tcp connection created to 20.205.243.166:443. time: 70.651ms
DEBU[2024-06-13T01:39:10+08:00] [http / EaseProbe Github] dial tcp:github.com:443
DEBU[2024-06-13T01:39:10+08:00] [http TRACE EaseProbe Github] - tls - start negotiation: 1718213950924311
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - tls - negotiated to "github.com", time: 88.151ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - connection established. reused: false idle: false idle time: 0ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - send - start write header field Host [github.com] : 1718213951012528
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - send - start write header field User-Agent [MegaEase EaseProbe/v2.1.2] : 1718213951012528
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - send - start write header field Connection [close] : 1718213951012528
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - send - start write header field Accept-Encoding [gzip] : 1718213951012528
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - send - headers written, time: 0.066ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - wait - start write request: 1718213951012609
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - transfer - start transfer the response: 1718213951641416
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - wait - got first response byte, time: 628.805ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - transfer - done, time: 0.356ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] - total - done , time: 792.102ms
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] ======================== Trace Stats ======================
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] DNS   Connect TLS Send    Wait    Trans   Total
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] 3.76  70.65   88.15   0.07    628.81  0.36    792.10
DEBU[2024-06-13T01:39:11+08:00] [http TRACE EaseProbe Github] ===========================================================
DEBU[2024-06-13T01:39:11+08:00] [http / EaseProbe Github] - Text Mode - Contain:[], NotContain:[]
DEBU[2024-06-13T01:39:11+08:00] [http / EaseProbe Github] - Status Threshold Checking - Current[true], StatusCnt[1], FailureThread[1], SuccessThread[1]
INFO[2024-06-13T01:39:11+08:00] [http / EaseProbe Github] - Status is UP! Threshold reached for success [1/1]
DEBU[2024-06-13T01:39:11+08:00] [http / EaseProbe Github] - HTTP Status Code is 200
DEBU[2024-06-13T01:39:11+08:00] http: {"name":"EaseProbe Github","endpoint":"https://github.com/megaease/easeprobe","time":"2024-06-12T17:39:10.849636947Z","timestamp":1718213950849,"rtt":933990476,"status":"up","prestatus":"init","message":"Success (http): HTTP Status Code is 200","latestdowntime":"0001-01-01T00:00:00Z","recoverytime":0,"stat":{"since":"2024-06-12T17:35:34.287769348Z","total":1,"status":{"1":1,"2":0},"uptime":60000000000,"downtime":0,"StatusHistory":[{"Status":true,"Message":"HTTP Status Code is 200"}],"MaxLen":1,"CurrentStatus":true,"StatusCount":1,"alert":{"strategy":"regular","factor":1,"max":1,"notified":0,"failed":0,"next":1,"interval":0}}}
DEBU[2024-06-13T01:39:11+08:00] [channel / __EaseProbe_Channel__]: EaseProbe Github (https://github.com/megaease/easeprobe) - Initial Status [init] == [up], no notification.
DEBU[2024-06-13T01:39:15+08:00] ParseRequestedURI: config.yaml failed to parse with error parse "config.yaml": invalid URI for request
DEBU[2024-06-13T01:39:15+08:00] The configuration file [config.yaml] has not been modified

The following two lines of log output mean what?

DEBU[2024-06-13T01:39:20+08:00] ParseRequestedURI: config.yaml failed to parse with error parse "config.yaml": invalid URI for request
DEBU[2024-06-13T01:39:20+08:00] The configuration file [config.yaml] has not been modified
samanhappy commented 3 months ago

These debug logs are generated by EaseProbe as it monitors changes in a configuration file: