Skip to content
/ statoo Public

`statoo` is a super simple http GET tool for checking site health

License

Notifications You must be signed in to change notification settings

vigo/statoo

Repository files navigation

Version Go Documentation Go Report Card Build Status Go Build Status

Statoo

A super basic http tool that makes only GET request to given URL and returns status code of the response. Well, if you are curl or http (httpie) user, you can make the same kind of request and get a kind-of same response since statoo is way better simple :)

statoo injects Accept-Encoding: gzip request header to every http request!

Install

$ go get -u github.com/vigo/statoo

Usage:

$ statoo -h


usage: statoo [-flags] URL

  flags:

  -version        display version information (X.X.X)
  -t, -timeout    default timeout in seconds  (default: 10)
  -h, -help       display help
  -json           provides json output
  -verbose        verbose output              (default: false)
  -header         request header, multiple allowed
  -find           find text in repsonse body if -json is set

  examples:
  
  $ statoo "https://ugur.ozyilmazel.com"
  $ statoo -timeout 30 "https://ugur.ozyilmazel.com"
  $ statoo -verbose "https://ugur.ozyilmazel.com"
  $ statoo -json https://vigo.io
  $ statoo -header "Authorization: Bearer TOKEN" https://vigo.io
  $ statoo -header "Authorization: Bearer TOKEN" -header "X-Api-Key: APIKEY" https://vigo.io
  $ statoo -json -find "Meetup organization" https://vigo.io

Let’s try:

$ statoo "https://ugur.ozyilmazel.com"
200

$ statoo -verbose "https://ugur.ozyilmazel.com"
https://ugur.ozyilmazel.com -> 200

or;

$ statoo -json https://vigo.io

response;

{
    "url": "https://vigo.io",
    "status": 200,
    "checked_at": "2021-05-10T16:44:19.22862Z",
    "response_duration": 231.701225,
    "response_size": 1453
}
  • response_duration is in milliseconds.
  • response_size is in bytes (gzipped)

Let’s find text inside of the response body. This feature is only available if the -json flag is set!

$ statoo -json -find "Meetup organization" https://vigo.io
{
    "url": "https://vigo.io",
    "status": 200,
    "checked_at": "2021-05-10T16:45:35.980107Z",
    "response_duration": 154.040385,
    "response_size": 1453,
    "find": "Meetup organization",
    "found": true
}

$ statoo -json -find "meetup organization" https://vigo.io # case sensitive
{
    "url": "https://vigo.io",
    "status": 200,
    "checked_at": "2021-05-10T16:46:03.04418Z",
    "response_duration": 133.755459,
    "response_size": 1453,
    "find": "meetup organization",
    "found": false
}

Now you can pass multiple -header flags:

$ statoo -header "Key1: Value1" -header "Key2: Value2" "https://ugur.ozyilmazel.com"

It’s better to pipe -json output to jq or python -m json.tool for pretty print :)

That’s it!


Rake Tasks

$ rake -T

rake default            # show avaliable tasks (default task)
rake docker:build       # Build
rake docker:rmi         # Delete image
rake docker:run         # Run
rake release[revision]  # Release new version major,minor,patch, default: patch
rake test[verbose]      # run tests

Docker

build:

$ docker build . -t statoo

run:

$ docker run -i -t statoo:latest statoo -h
$ docker run -i -t statoo:latest statoo -json -find "Meetup organization" https://vigo.io

Contributer(s)


Contribute

All PR’s are welcome!

  1. fork (https://github.com/vigo/statoo/fork)
  2. Create your branch (git checkout -b my-feature)
  3. commit yours (git commit -am 'add some functionality')
  4. push your branch (git push origin my-feature)
  5. Than create a new Pull Request!

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.


License

This project is licensed under MIT