API Simple Reporting Tool (ASRT) tool has a simple goal: Report up/down status of API endpoints.
ASRT (pronounced assert) was created to simply report on api endpoint statuses. It is not intended to be a stress tester like other tools, such as vegeta. It is just meant to be a simple reporter that a dashboard like tool could use. It can be easily integrated with any build processes. Not only is the output easily parseable (especitally with cut), but it also sets the exit status to 1 if it is not 100% successful.
go get github.com/mkboudreau/asrt
This tool is simple. Just dive in and start using it.
asrt status www.yahoo.com
asrt dashboard -r 5s www.yahoo.com
asrt status -fmt csv www.yahoo.com
asrt status -fmt csv-md www.yahoo.com
asrt status -fmt csv-no-color www.yahoo.com
asrt status -fmt json www.yahoo.com
asrt status -fmt json-compact www.yahoo.com www.google.com
asrt status -fmt json -f sites.list
asrt dashboard -fmt json -r 1m -f sites.list
asrt server -fmt json -r 1m -f sites.list
asrt status -f sites.list -fmt template="{{ .Label }} is {{ .Success }}"
asrt status -f sites.list -fmt template-file=my-output.txt
Example File
www.yahoo.com
www.yahoo.com|200
www.yahoo.com|GET|200
-d or --debug: turns on the logger-f or --file: input file (see formats below). at least a file or urls on the command line must be specified.-w or --workers: this is the number of workers or goroutines used to connect to the client sites.-t or --timeout: timeout for connections in time.Duration format. defaults to no timeout.-a or --aggregate: aggregates all sites into a single true/false response. includes the total sites unless -q is specified--failures-only: only submits data to the writer upon failure. Useful when using something like slack since you may only want to perform an http.POST upon a failure.-fmt or --format: the format to be used for output. valid values are:
CSV, CSV-MD, CSV-NO-COLOR, TAB, TAB-MD, TAB-NO-COLOR, JSON, JSON-COMPACT, TEMPLATE="{{...}}}, TEMPLATE-FILE=. default is TAB.--no-headers: minimizes the response and contains no header nor footer.-q or --quiet: turns off standard output, useful for scripts.--slack-url: setting this parameter enables slack integration using incoming webhook url specified.--slack-user: overrides the user this tool will post as to slack. only works if slack-url is specified.--slack-channel: overrides the channel this tool will post to on slack. only works if slack-url is specified.--slack-icon: overrides the icon this tool will use when posting to slack. only works if slack-url is specified.--http-url: setting this parameter enables generic http integration for sending output data.--http-method: sets the http method to use. default is POST. only works if http-url is specified.--http-auth: sets the http Authorization header. only works if http-url is specified.-ru or --retry-until: retry until a time.Duration. Status command will return result once it gets 100% success from all its targets or until this time.Duration elapses. If time.Duration is reached, it will return whatever the last response was.-r or --rate: refresh rate for dashboard only in time.Duration format. defaults to 30s.-r or --rate: refresh rate for dashboard only in time.Duration format. defaults to 30s.--port: set port to listen on (only works with server command). default is 7070URL|METHOD|STATUS_CODE|LABEL|HEADER...
www.yahoo.comwww.yahoo.com|200www.yahoo.com|GET|200www.microsoft.com|POSTwww.microsoft.com|POST|201www.yahoo.com/not_found|GET|404www.yahoo.com/not_found|GET|404|{H}"Authorization: Bearer 123"data.asrt.io|GET|200|"Main ASRT API Endpoint"Command line parameter should be in a single line and each target be separated by spaces.
Example: asrt www.yahoo.com www.microsoft.com|POST|201 data.asrt.io|GET|200|"Main ASRT API Endpoint"
Input file should have one line per target.
Example:
www.yahoo.com www.microsoft.com|POST|201 data.asrt.io|GET|200|"Main ASRT API Endpoint"
Using the --fmt template=... will cause the template text on the right side of "template=" to get parsed according to the Go standard library's text templating.
type Result struct {
Success bool
Error error
Expected string
Actual string
Url string
Label string
Timestamp string
Extra map[string]interface{}
}
See https://golang.org/pkg/text/template/
The following items are still outstanding:
Content type
Image
Digest
sha256:912e00b91…
Size
5.7 MB
Last updated
almost 10 years ago
docker pull mkboudreau/asrt