DEV Community

Cover image for Service Uptime Monitor using Github Actions
Fahmi Noor Fiqri
Fahmi Noor Fiqri

Posted on

Service Uptime Monitor using Github Actions

My Workflow

I've been working in a company for about 1 year now. We have a private cloud, but it's not very reliable. Sometimes our container will suddenly stopped or having our Gitlab EE unavailable, even in busy hour.

After today's daily stand up, one of my coworker said it will be fun to have a service to monitor our services, to tell when was the last time the DevOps team messed up the containers. Like in the "days without tricks meme."

So I think "why not?"

Here I have created a workflow to check for my service uptime, runs every 5 minutes on Github Actions. This action will execute a NodeJS app and updates a file to report latest up/downtime. This script will make a HTTP request to the service and save the HTTP status to a JSON file.

Submission Category:

Wacky Wildcards

Yaml File or Link to Code

name: Node.js CI

on:
  workflow_dispatch:
  schedule:
    - cron: "*/5 * * * *"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: 12.x
    - run: npm install
    - run: npm start
    - name: Commit and push if changed
      run: |
        git add .
        git diff
        git config --global user.email "github-action-bot@example.com"
        git config --global user.name "GitHub Action Bot"
        git commit -m "Updated incident" -a || echo "No changes to commit"
        git push
Enter fullscreen mode Exit fullscreen mode

GitHub logo fahminlb33 / statuspage-js

Monitor my squad container status

Additional Resources / Info

For the HTML I've used Matt Smith's countdown template from https://codepen.io/AllThingsSmitty/pen/JJavZN.

Top comments (0)