Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Install and Configure Monit on a Linux Server

Install Monit from your distribution package, build a secure monitrc, validate it with monit -t, define reliable process and health checks, and enable systemd recovery without creating restart loops.
Length11 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Monit from your Linux distribution’s package repository when a suitable package is available, then configure the monitrc control file, test it with monit -t, and run the daemon through systemd. A reliable setup depends on accurate PID files, executable recovery commands, realistic timeouts, and health tests that describe when the service is genuinely ready.

What Monit does on a Linux server

Monit is a lightweight supervisor and monitoring daemon. It repeatedly checks processes and can also inspect files, directories, filesystems, hosts, network protocols, and system resources. When a check fails, a rule can send an alert, restart the affected service, or invoke a custom program.

As an Amazon Associate I earn from qualifying purchases.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The control file is named monitrc. A normal deployment has three layers:

  • Polling: set daemon <seconds> defines how often Monit evaluates its checks.
  • Checks: service blocks identify what to inspect and which condition counts as failure.
  • Actions: each failure rule chooses alert, restart, or a custom program action.

Monit does not replace a service manager. On a systemd host, systemd starts Monit at boot, while Monit watches application health and performs the recovery actions you define.

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.

Choose a package installation or a source build

The distribution package is the practical default because it supplies an init integration, standard file locations, and updates through the operating system. Build from source only when the repository version lacks a required feature, is unsuitable for your release, or you need a specific Monit version.

Approach Best fit Maintenance impact
Distribution package Most production servers and standard monitoring requirements Updates, service integration, and file layout follow the operating system
Source build A repository package is unsuitable or a particular version is required You own compilation, installation paths, upgrades, and init integration
Prebuilt binary You need a vendor-provided binary and have verified its compatibility You must track binary provenance, placement, upgrades, and service startup

Package names and repository versions vary by distribution and release. Check the package manager’s candidate version before installing so you know which Monit syntax and unit files your server will receive.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Prepare the server

Before changing anything, collect the details that your checks will need:

  • The service name and the absolute path to its PID file, if you will use a process check.
  • Executable start and stop commands that work when run by the account that will execute them.
  • The port, protocol, URL, or local resource that proves the service is ready, rather than merely running.
  • The expected startup time, including migrations, cache warming, or dependency waits.
  • The location where your distribution’s Monit package stores its control file and included snippets.

Use absolute paths in Monit commands. For example, determine the systemd path with command -v systemctl and use the returned path rather than assuming every distribution places it identically.

Install Monit from a distribution package

Debian and Ubuntu

The official installation guidance documents the following package command:

sudo aptitude install monit

After installation, inspect the package’s files to find its unit, control-file location, and include directory. Ubuntu and Debian releases can package different Monit versions, so check the candidate version shown by the package manager before relying on a directive introduced in a newer release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fedora

The documented Fedora path uses:

sudo yum install monit

On a current Fedora system, the repository may expose a compatible package through a newer package-manager frontend. Confirm the available Monit package and version before installing, then inspect the installed files for the unit and configuration layout.

OpenSUSE, Arch, Gentoo, and FreeBSD

The official installation guide also describes package paths for OpenSUSE, Arch, Gentoo, and FreeBSD. Use the native package manager for the exact release, verify the package candidate, and confirm where that package places monitrc, included configuration files, and its service definition. Do not copy a Debian include path or unit file into another distribution without checking the package layout first.

Build Monit from source when the package is unsuitable

A source build gives you control over the version and installation prefix, but it also makes you responsible for the compiler toolchain, upgrades, and service integration. Obtain the source or a prebuilt binary from the official Monit distribution channel appropriate to your platform, and verify that the resulting executable runs on the target architecture.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
  1. Unpack the source tree and change into its top-level directory.
  2. Run the configure step:
./configure
  1. Compile and install:
make && make install

Record the installation prefix and the resulting executable path. If the source build does not install a systemd unit, create the integration deliberately rather than assuming the distribution package’s paths. Test the binary with its explicit control-file path, for example:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo /usr/local/bin/monit -c /etc/monitrc -t

Use the actual path produced by your build. A source installation should not silently coexist with a package installation, because systemd might start one binary while your shell invokes another.

Find and secure the monitrc control file

Monit searches for its control file in a defined order: ~/.monitrc, then /etc/monitrc, followed by other compiled-in or local locations. Use -c to select an explicit path whenever you want an unambiguous configuration.

sudo monit -c /etc/monitrc -t

When a control file contains passwords or other credentials, keep it owned by root and readable only by the intended administrator or service account. A typical hardening step is:

sudo chown root:root /etc/monitrc
sudo chmod 600 /etc/monitrc

Apply equivalent ownership and permissions to included files. Check the permissions after package upgrades or configuration-management runs, since a newly created snippet can otherwise expose credentials.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a minimal baseline configuration

Start with the smallest configuration that establishes polling, logging, and includes:

set daemon 60
set logfile syslog
include /etc/monit/conf.d/*

set daemon 60 makes Monit poll every 60 seconds. The interval is a trade-off: a shorter interval detects failures sooner but causes more checks and can trigger recovery before a slow service has settled. The include directory in the example is common on Debian-family systems, but it is distribution-dependent; confirm the path installed by your package before using it.

Without daemon configuration, Monit can perform a single pass and exit instead of remaining a recurring supervisor. This is useful for controlled tests, but a production daemon needs an explicit polling interval.

Validate syntax before starting anything

Run the syntax check before enabling or starting the service:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
sudo monit -t

The documented successful result is Control file syntax OK. Treat every parse error as a blocking issue. Read the reported line, then check quotation marks, directive spelling, braces, file paths, and indentation around the affected rule. A syntactically valid file can still contain an incorrect PID path or an unusable command, so continue with functional testing after the parser accepts it.

Add a process check with a controlled recovery action

A process rule normally identifies the process through a PID file and supplies executable start and stop programs. Replace every example path and name below with values from the target server:

check process myapp with pidfile /run/myapp.pid
  start program = "/usr/bin/systemctl start myapp"
  stop program  = "/usr/bin/systemctl stop myapp"
  if failed host 127.0.0.1 port 8080 protocol http
     then restart

Verify the PID file

The PID file must contain the process ID of the service you intend to monitor. Confirm that it is created during a normal start, remains current after a restart, and is readable by Monit. A stale file can make Monit watch the wrong process or conclude that a healthy service is absent.

Make start and stop commands executable

Run the exact commands manually with the same privileges Monit will use. If you call a script, begin the script with a shebang such as #!/bin/sh and mark it executable:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo chmod 750 /usr/local/sbin/myapp-start

Use absolute command paths and include any required environment setup in the script itself. An interactive shell’s PATH, working directory, and variables are not guaranteed when Monit launches a program.

Set a realistic action timeout

The Debian manual documents a default 30-second wait for process start and stop actions. If the service routinely needs more or less time, use Monit’s WITH TIMEOUT form on the relevant action, for example:

start program = "/usr/bin/systemctl start myapp" with timeout 90 seconds
stop program  = "/usr/bin/systemctl stop myapp" with timeout 60 seconds

Choose a limit from observed startup and shutdown behavior. A timeout that is too short can create false failures; one that is too long delays recovery from a genuinely stuck process.

Test readiness, not only process existence

The example checks an HTTP endpoint on port 8080. That is stronger than checking only whether a PID exists: the process may be alive while its listener is unavailable or its application is not ready. Select a host, port, and protocol that represent the real dependency your users need. If a service has a health endpoint, use that endpoint or an equivalent protocol test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the right monitoring target and action

Monit supports several target types. Select the narrowest check that captures the failure you need to recover:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Target What it can reveal Typical response choices
Process Missing process, incorrect PID identity, or failed service health test Alert, restart, or a custom recovery program
File or directory Missing path, unexpected state, or a change that should be reported Alert or a custom program action
Filesystem Capacity or filesystem condition that threatens service operation Alert or a carefully tested custom action
Host Reachability of a remote or local host Alert or a custom action
Network protocol Whether a service answers the protocol on its expected port Alert or restart of the responsible service
System resource Resource conditions such as load or memory pressure Alert or a bounded custom action

Use alerts when an operator should decide

alert is appropriate when a restart could hide an underlying fault, when the condition is informational, or when an operator must coordinate recovery with another system. Make sure the alert destination and message policy are configured separately according to your deployment’s requirements.

Use restart only for recoverable failures

restart is suitable when the service can be safely restarted and the health test is specific enough to avoid false positives. Keep the condition narrow and test it under failure. A broad resource rule combined with an unconditional restart can create a restart loop that increases downtime.

Use a custom program for bounded remediation

A custom program can perform an action that is not a simple service restart, such as clearing a safe temporary state or notifying another local component. Treat the program like production code: give it a shebang, executable permissions, absolute paths, logging, and a bounded runtime. Ensure it cannot repeatedly trigger the same destructive action on every polling cycle.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run Monit with systemd

After the configuration passes validation and the first checks are ready, enable and start the systemd service:

sudo systemctl enable monit.service
sudo systemctl start monit.service
sudo systemctl status monit.service

The official systemd template orders startup after network-online.target, runs Monit with monit -I, and maps reload and stop operations to monit reload and monit quit. A Debian-sourced unit follows the same general structure and installs into the normal multi-user target.

Confirm that systemd enabled the unit rather than assuming a successful start also enabled boot-time launch:

systemctl is-enabled monit

Use the status output and the system journal to confirm that Monit parsed the intended file, stayed running, and began polling. If you installed from source, verify that the unit invokes the same Monit binary you tested from the shell.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reload changes and inspect live status

After editing monitrc or an included file, validate first and then reload the running daemon:

sudo monit -t
sudo systemctl reload monit
sudo monit status

The Monit client contacts a running daemon through its local control endpoint. The documented default is 127.0.0.1:2812. Monit also provides a lightweight HTTP(S) status interface for browsing the server and checking monitored services.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Do not expose that interface casually. If remote access is required, configure authentication and enforce a firewall policy that limits source addresses and ports. Keep the endpoint bound to localhost when local status is sufficient.

Test recovery before adding more checks

Introduce one service rule at a time. For each rule:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Confirm the service starts and stops manually with the exact commands in the rule.
  2. Confirm the PID file and readiness test represent the intended service.
  3. Run sudo monit -t and correct every parser error.
  4. Reload Monit and inspect sudo monit status.
  5. Perform a controlled failure, such as stopping the test service, and observe whether the expected alert or restart occurs.
  6. Review the system journal and service logs for the complete recovery sequence.

Do not test by repeatedly killing a production process without an approved maintenance window. A recovery rule should be proven in a safe environment first, then enabled on the production host with an operator aware of the expected behavior.

Troubleshoot common failures

monit -t reports an error

Read the line number in the error and inspect the surrounding block. Check quotation marks around commands, directive spelling, braces, wildcard paths, and whether the included file exists. Re-run the test after each correction until Monit reports Control file syntax OK.

The service never starts

Run the start command manually, then verify the executable path, permissions, user identity, and environment. Confirm that the PID file is created at the exact path in the rule and that the process ID belongs to the intended service. If the command is a script, verify its shebang and executable bit.

Monit repeatedly restarts a healthy-looking service

Test the service outside Monit and inspect its startup logs. Increase the action timeout if startup is legitimately slow. Then review the health test: a port can open before an application is ready, or a health endpoint can require a host header or authentication that the rule does not provide. Adjust the test to match the service’s actual readiness condition and add sensible thresholds before allowing another restart.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Monit is absent after a reboot

Check whether the unit is enabled, whether it failed during boot, and whether the journal records a configuration or dependency error:

systemctl is-enabled monit
systemctl status monit
journalctl -u monit

If the unit is enabled but fails immediately, run the same binary and control-file path outside systemd to distinguish a configuration problem from a unit-path problem.

Checks appear delayed

Review set daemon and any scheduling qualifiers such as EVERY ... CYCLES. A 60-second daemon interval means a condition may wait for the next polling pass; a rule that requires several cycles necessarily waits longer. Choose intervals and cycle counts that fit the failure’s urgency.

Operational practices that keep Monit predictable

  • Keep the main control file small and place service-specific rules in the package’s verified include directory.
  • Use version control for configuration, but protect credentials and restrictive file permissions on the server.
  • Prefer one clear readiness test over several overlapping tests that can trigger competing restarts.
  • Document each PID path, command path, timeout, and expected recovery behavior next to the rule.
  • Review Monit status and logs after package upgrades, service migrations, and changes to systemd units.
  • Use alerts for conditions that need human judgment and reserve automatic restarts for failures with a tested, bounded recovery.

With the package or binary verified, a secured monitrc, a successful syntax test, and a systemd unit that remains active after reboot, Monit provides a focused layer of health checks and recovery without obscuring the underlying service logs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.