Member-only story

Rakan Khaled
4 min readAug 29, 2024

--

Have you ever wanted to set up a process monitor that alerts you when it’s offline without spending thousands of budget dollars to do so? Every system administrator has, and here’s how to do it.

Some system administrators love doing things themselves, while others must do so due to budget constraints. Enterprise monitoring and alerting suites are typically for companies with large budgets or those with mission-critical applications that require 100% uptime. Open-source alternatives exist, but they often need a dedicated system and significant setup time.

Most also require installing agents on monitored endpoints — a process that demands approval and deployment time. A quicker, easier solution is to create your own monitoring and alerting scripts and schedule them via cron. The main advantage of localized (per-server) monitoring and alerting is the ability to customize thresholds for each system and service, rather than relying on a one-size-fits-all global configuration.

This article takes you through the process of creating a script that checks every five minutes for the Apache web server process, attempts to restart it if it’s down, and then alerts you via email if it’s down for more than 30 seconds and cannot be restarted.

--

--

Rakan Khaled
Rakan Khaled

Responses (1)