5 stable releases
| new 1.1.0 | Oct 31, 2025 |
|---|---|
| 1.0.3 | Jul 6, 2024 |
#4 in #health-monitoring
Used in 2 crates
125KB
2K
SLoC
Healthscript
A DSL for writing healthchecks.
Read the blog post for uses cases and why this was created.
The best way to grok the language is to look at the examples below.
The general philosophy behind the language design are as follows:
- Tags before the uri are included as part of the request, and tags after the uri are expectations about the response
- "Meta" tags like HTTP verbs, HTTP headers, status codes, and timeouts are in square brackets
[] - Body tags are in angle brackets
<> - Urls with custom schemes should be used to denote the protocol in the url, similar to
postgres://urls for example
HTTP Examples
-
Make an HTTP
GETrequest tohttps://example.com, and expect a200status codehttps://example.com
-
Make an HTTP
POSTrequest tohttps://httpbin.org/postwith aUser-Agent: curl/7.72.0header, and expect a200status code and a response header ofserver: gunicorn/19.9.0[POST] [User-Agent: curl/7.72.0] https://httpbin.org/post [server: gunicorn/19.9.0]
-
Make an HTTP
POSTrequest with some JSON, and expect a200status code and the response body to be JSON matching the jq expression.json.a == 3[POST] <{ "a": 3 }> https://httpbin.org/post <(.json.a == 3)>
-
Make an HTTP
POSTrequest with body bytes encoded in base64 tohttps://httpbin.org/post, and expect a200status code[POST] <aHR0cHM6Ly9naXRodWIuY29tL3Job21idXNnZy9oZWFsdGhzY3JpcHQ=> https://httpbin.org/post
Error Recovery
The parser will recover from errors as best as possible to help you write correct healthscript. Errors are available using the CLI.

Install the CLI with
cargo install healthscript-cli
Badge Service
Append healthscript at the end of https://healthscript.mbund.dev/ to have the hosted server run the healthcheck against your service and generate an svg badge. Then, you can use markdown syntax to include it in your own readmes.

You may need to url encode your spaces to %20.
Library
Integrate healthscript into your own rust project. To do so, add the following to your Cargo.toml
healthscript = "1.0"
Or use the cargo CLI.
cargo add healthscript
TCP Examples
-
Connect to
pwn.osucyber.clubon port13389over TCP, and expect at least one byte to be returnedtcp://pwn.osucyber.club:13389
-
Connect to
pwn.osucyber.clubon port13389over TCP, and expect the response to contain the regex/e./to be found anywhere within the response, timing out after 3 secondstcp://pwn.osucyber.club:13389 </e./> [3s]
-
Connect to
pwn.osucyber.clubon port13389over TCP, and expect the response to start with the stringcheetcp://pwn.osucyber.club:13389 <"chee">
Ping Examples
-
Ping
example.com, and expect a response, timing out after 8 secondsping://example.com
DNS Examples
-
Make a DNS query to
example.comand expect any responsedns://example.com
-
Make a DNS query to
example.comusing the dns server1.1.1.1and expect any responsedns://example.com/1.1.1.1
Dependencies
~27–45MB
~731K SLoC