Host service verification
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
gomakefiles @ ea6c908

Host Checker

Build Status Docker Stars Docker Pulls Docker Automated build

What it's all about

This tiny CLI app is meant to verify state of services in multiple nodes. Properly used, it should be able to block execution of long-running Acceptance Tests on a cluster which wasn't properly set up (maybe Chef didn't restart services? Maybe there is not enough space on disk? ...)

To run it, you have to have a file called expectations.json beside the app.

expectations.json DSL

    "server": "<server_location>:22",
    "user": "<ssh username>",
    "password": "<ssh password>",
    "upstart": [
        "name": "<service_name>",
        "user": "<expected_service_app_executor>",
        "newerThanSeconds": 3600, // how old is service allowed to be 
        "ports": [
          1312 // which port should be occupied by the service?
      // ... other upstart services
    "custom": [
        "name": "Service name which is ignored in this case",
        "regex": "[s]ome process name", // how to identify process in PS listing
        "user": "<expected_service_app_executor>",
        "newerThanSeconds": 3600, // how old is service allowed to be 
        "ports": [
          9090// which port should be occupied by the service?
    // which URLs should be checked
    "responses": [
        "name": "Mongo response",
        "url": "http://mongo_site:27017/",
        // what codes are acceptable
        "codes": [
        // optionally, check what is the response from the server
        "response": "It looks like you are trying to access MongoDB over HTTP on the native driver port.\n"
    // freestyle shell commands: they have to return 0 to succeed
    "shell": [
        "name": "Is Mongo operational?",
        // which command do we want to execute remotely?
        "cli": "mongo localhost/temp --eval \"print('searchOnNonExistingId='+db.mycollection.find({'_id':-1}).length())\" | grep searchOnNonExistingId",
        // optionally, make sure string stdout output of the command is identical to sth we expect
        "expected": "searchOnNonExistingId=0"
 // ... other servers to be checked

How to run from Docker:

To run from within a docker container, you need to map local file into expectations.json inside the container, here is the magic:

docker run --rm \
    -v ${PWD}/expectations.json:/go/src/app/expectations.json