Free Service Monitoring With CircleCI

Free monitoring for your service! But you can't monitor the monitoring...

Free Service Monitoring With CircleCI

A small service can get by with a small monitoring solution. As the owner of SwiftIRC I want to keep an eye on the network status, but things often change in how the network may be configured from one day to the next (DNS round-robin can change frequently).

This is the open source monitoring solution I have available for SwiftIRC: https://circleci.com/gh/ryanwohara/monitoring

The configuration is explicit. I want to check the website, the web IRC client, and each server from connectivity and network functionality standpoint. Iterating through the dig response is the simplest way to automatically respect round-robin updating.

version: 2
jobs:
  ping_swiftirc:
    machine: true
    shell: bash
    steps:
    - run: mkdir -p logs/{curl,ping,netcat}
    - run:
        command: curl -iL swiftirc.net > logs/curl/swiftirc.net.log
        when: always
    - run:
        command: curl -iL www.swiftirc.net > logs/curl/www.swiftirc.net.log
        when: always
    - run:
        command: curl -iL qwebirc.swiftirc.net > logs/curl/qwebirc.swiftirc.net.log
        when: always
    - run:
        command: for a in $(dig A +short irc.swiftirc.net) ; do ping -c5 $a > logs/ping/$a.log
          ; done
        when: always
    - run:
        command: for a in $(dig A +short irc.swiftirc.net) ; do nc -w1 $a 6667 > logs/netcat/$a.log
          2>&1 ; done
        when: always
    - run:
        command: find logs/ -name *.log -type f -exec cat {} \;
        when: always
    - store_artifacts:
        path: logs
workflows:
  version: 2
  ping:
    jobs:
    - ping_swiftirc
    triggers:
    - schedule:
        cron: 0,10,20,30,40,50 * * * *
        filters:
          branches:
            only:
            - master

I only want to build the master branch and every 10 minutes.

The biggest short-coming of this method is you are limited at IPv4. At the time of writing this article CircleCI has no IPv6 support.