Code Monkey home page Code Monkey logo

wt-check's Introduction

Webtask script to check sites status and health

Small app that runs as a cron script on Webtask platform and checks if an URL get a response, and allows also to check if the body match with a given string or a regex expression.

If the check fails posts a message in a Slack channel.

Message posted to a Slack channel with wt-check

Run

Install on Webtask platform as a cron service running every 2 minutes with:

$ wt cron schedule \
     -n checkcron \
     --secret "URL=http://theurltocheck.com/path/to/uri" \
     --secret STATUS=200 \
     --secret TIMEOUT=5000 \
     --secret "BODY=Text expected" \
     --secret "REGEX=Regex expression" \
     --secret SLACK_TOKEN=THETOKEN \
     --secret SLACK_CHANNEL=CHANNELNAME \
     "*/2 * * * *" \
     check.js

Options

  • -n checkcron: the name of the cron process.
  • --secret URL: The URL to check.
  • --secret STATUS: (optional) The status expected, default 200.
  • --secret TIMEOUT: (optional) Milliseconds to wait the response before aborting the request, default 10000 (10 seconds).
  • --secret BODY: (optional) A text expected in the body.
  • --secret REGEX: (optional), regex expression expected to match with the body.
  • --secret SLACK_TOKEN: the Slack API token, go to https://api.slack.com/web#authentication to get a token.
  • --secret SLACK_CHANNEL: the channel where to post the alerts.
  • "*/2 * * * *": cron configuration (eg. run every 2 min).

You can also install the script directly to Webtask platform without having this project downloaded in your local machine with:

$ wt cron schedule [OPTIONS] \
     https://raw.githubusercontent.com/mrsarm/wt-check/master/check.js

To see more options of Webtask CLI go to https://webtask.io/docs.

About

Source code: https://github.com/mrsarm/wt-check

Author: Mariano Ruiz ([email protected])

2016 | Apache-2.0

wt-check's People

Contributors

mrsarm avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.