1
0
mirror of https://github.com/Luzifer/webcheck.git synced 2024-07-21 11:36:55 +00:00
webcheck is a CLI tool to check the health of a web page
Go to file
2024-07-16 15:12:35 +02:00
.github/workflows Switch to Github Workflow 2024-07-16 12:21:31 +02:00
ci Switch to Github Workflow 2024-07-16 12:21:31 +02:00
.gitignore Fix: Limit historical performance data 2018-07-24 13:36:12 +02:00
.golangci.yml Lint: Resolve linter errors, improve code 2024-07-16 14:54:48 +02:00
go.mod Update dependencies 2024-07-16 12:18:01 +02:00
go.sum Update dependencies 2024-07-16 12:18:01 +02:00
History.md prepare release v0.2.3 2024-07-16 15:12:35 +02:00
LICENSE Add meta files 2018-07-23 14:56:38 +02:00
main.go Fix: Do not panic when no-log is enabled 2024-07-16 15:06:37 +02:00
Makefile Switch to Github Workflow 2024-07-16 12:21:31 +02:00
README.md Update README 2024-07-16 15:09:49 +02:00
ring.go Fix: Limit historical performance data 2018-07-24 13:36:12 +02:00
types.go Lint: Resolve linter errors, improve code 2024-07-16 14:54:48 +02:00

Luzifer / webcheck

webcheck is a CLI tool to check the health of a web page. It was written because there are quite a lot of GUI tools or services to monitor websites but I did not find any tool to execute on the CLI to to an ad-hoc monitoring of a page. To fix this I wrote this tool.

webcheck is used to check:

  • HTTP status code 2xx
  • Regular expression match on the response body
  • Response within a certain timeout
  • Response times (only display, no checking)

If the request is marked as a FAIL all headers and the response body are written into a log file to be debugged manually. This can for example be helpful if your webserver delivers weird responses on certain requests and you are using webcheck to find them.

Installation

You either can download a pre-compiled binary for you system from the Releases section of this repository or if you do have a working Go environment you can just go install github.com/Luzifer/webcheck@latest the tool.

Usage

$ webcheck --help
Usage of webcheck:
  -i, --interval duration        Check interval (default 1s)
  -l, --log-dir string           Directory to log non-matched requests to (default "/tmp/resp-log/")
      --log-level string         Log level (debug, info, warn, error, fatal) (default "info")
      --log-retention duration   When to clean up file from log-dir (default 24h0m0s)
  -m, --match string             RegExp to match the response body against to validate it (default ".*")
      --no-log                   Disable response body logging
  -t, --timeout duration         Timeout for the request (default 30s)
  -u, --url string               URL to query
      --version                  Prints current version and exits

Example

$ webcheck -u https://bfa1c797.eu.ngrok.io/monitoring.txt -m healthy

[Mon, 23 Jul 2018 16:07:02 CEST] (OKAY) Status was 200 and text matched (13.331ms/14.229ms/115.599ms)
[Mon, 23 Jul 2018 16:07:16 CEST] (FAIL) Response body does not match regexp (13.314ms/14.229ms/15.316ms) (Resp: request-log/request827008143)
[Mon, 23 Jul 2018 16:07:21 CEST] (OKAY) Status was 200 and text matched (13.411ms/14.436ms/18.25ms)
[Mon, 23 Jul 2018 16:07:28 CEST] (FAIL) Status code was != 2xx: 404 (6.923ms/7.011ms/7.237ms) (Resp: request-log/request070057634)

$ cat request-log/request827008143
Accept-Ranges: bytes
Content-Length: 4
Content-Type: text/plain; charset=utf-8
Date: Mon, 23 Jul 2018 14:07:16 GMT
Last-Modified: Mon, 23 Jul 2018 14:07:15 GMT

foo