🚀 Simple yet powerful way to monitor your server's health using GitHub Actions and Gmail!

In the fast-paced world of tech, server downtime can be more than just an inconvenience. It can lead to lost revenue and a tarnished reputation. That's why proactive monitoring is a cornerstone of any robust DevOps strategy. Today, I'm excited to share a simple practical guide on setting up an automated server monitoring utility using GitHub Actions. This tool will not only keep an eye on your server health but also send timely alerts, ensuring you're always in the loop 🔁


🛠️ Gmail and GitHub Configuration

Gmail Settings:

  • Enable 2FA Auth: Visit this link to enable Two-Factor Authentication (2FA) on your Gmail account.
  • Create App Passwords: For GitHub Actions to send emails on your behalf, you'll need an app password. Generate one at myaccount.google.com/apppasswords.

GitHub Settings:

  • Create a New Repository: Start by creating a new repository on GitHub to house your monitoring workflow.
  • Repository Secrets: Navigate to your repo settings(the one created in the above step), then to 'Secrets & variables' under 'Actions'. Here, you'll create new repo secrets and create descriptive secrets variables to store below data

a. Variable for "from: gmail address" - the one used to enable the 2FA auth
b. Variable for "from gmail address's app password" - the one used to enable the 2FA auth
c. Variable for server URL in which the monitoring needs to be enabled
d. Variable for "to: email address" to receive the alerts.
Article content


📝 GitHub Actions Workflow

Now that we've set up our environment, it's time to write the yml file that will orchestrate the monitoring actions. This file, typically named main.yml or workflow.yml, will define the triggers, jobs, and steps that GitHub Actions will execute.

Here's what the yml code might look like:

This will run every hour. It can be configurable by adjusting the cron definition. https://crontab.guru/#0_*_*_*_*


Article content



👀 Real-Time Monitoring and Alerts

With your GitHub Actions workflow set up, you'll be able to monitor your server's health in real-time.

And, the email sent by the Actions looks like this

Article content

The alert can be sent to the development channels by integrating the Actions with Slack or Discord ✌🏼

To view or add a comment, sign in

More articles by Vivek S.

  • Property Price Register Analyser Tool

    I've been house hunting recently and got tired of going into viewings with no solid data. Estate agents quote prices…

    1 Comment
  • 🚀 From Raw Data to Actionable Insights

    Over the long weekend, I decided to dive into a personal data project. Transforming my 2024 AIB bank statements into…

    2 Comments
  • The Reality of Fragmented Customer Data - A Personal Experience

    Ever had that moment when a company treats you like a complete stranger, even though you've been their customer for…

    3 Comments
  • 1BRC in Postgres 🐘

    🚀 Just completed the One Billion Row Challenge with Postgres! At Showoff , we're no strangers to working with massive…

    1 Comment

Explore content categories