Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
131 lines (86 sloc) 3.54 KB

Quick start

To monitor applications and the infrastructure parts you need to configure checks. A configured check is a json file that defines a method name (script to be used) and the input parameters. Each check is executed when your external monitoring software invokes the HTTP endpoint, or when you execute the shell command.

Infracheck can work as a HTTP endpoint responding with JSON, or as a console command.


1. Requirements

You need to install all requirements manually if you decide not to use a docker container.


  • Python 3.6+
  • OpenSSH Client
  • sshpass
  • mysql-client
  • postgresql-client
  • docker client
  • curl

2. Structure

You need to create a project structure from following template:

- checks/
    - http
    - smtp
    - port
- configured/
    - redis
    - duckduckgo_http
    - smtp_is_alive

In checks there should be scripts that will take parameters as environment variables, process and give results. For simpler cases you may not need to define any scripts, just configure pre-defined ones.

configured should contain your actual use cases, for example "duckduckgo_http" from above example could use "http" check with url "" as a parameter.

3. Configuring a first check

Let's assume that we need to check if a page contains given keyword, and does not contain another defined one. Following check will use curl to fetch page content.

Test cases:

  • If page will not load, then THE CHECK RETURNS FAILURE
  • If page contains "Server error", then THE CHECK RETURNS FAILURE
  • If page will not contain keyword "iwa", then THE CHECK RETURNS FAILURE
  • If page loads properly and contains "iwa" keyword, then THE CHECK RETURNS SUCCESS
    "type": "http",
    "input": {
        "url": "",
        "expect_keyword": "iwa",
        "not_expect_keyword": "Server error"

Hint: You can pass environment variables in parameters - see: :ref:`Templating` section.

4. Running checks

With Docker

You can use a ready-to-use docker image wolnosciowiec/infracheck or wolnosciowiec/infracheck:armhf for 32 bit ARM. The image will by default expose a HTTP endpoint.

sudo docker run --name infracheck -p 8000:8000 -v $(pwd):/data -d --rm wolnosciowiec/infracheck

# now test it
curl http://localhost:8000

List of supported environment variables:

  • CHECK_INTERVAL="*/1 * * * *"
  • LAZY=false

Without Docker

git clone
cd infracheck
make install

# run checks in the shell
infracheck --directory=/your-project-directory-path-there

# run a webserver
infracheck --directory=/your-project-directory-path-there --server --server-port=7422 --lazy

# set up a scheduled checking
echo "*/1 * * * * infracheck --directory=/your-project-directory-path-there --force" >> /etc/crontabs/root

Using PIP

sudo pip install infracheck

# run checks in the shell
infracheck --directory=/your-project-directory-path-there

# run a webserver
infracheck --directory=/your-project-directory-path-there --server --server-port=7422

# set up a scheduled checking
echo "*/1 * * * * infracheck --directory=/your-project-directory-path-there --force" >> /etc/crontabs/root
You can’t perform that action at this time.