The Wayback Machine - https://web.archive.org/web/20240927124526/https://www.geeksforgeeks.org/monitor-linux-daemon-filesystem-cpu-network-and-files-using-monit/
Open In App

Monitor Linux Daemon, Filesystem, CPU, Network and Files Using Monit

Last Updated : 11 Feb, 2021
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Monit is a utility tool for monitoring & managing processes, files, directories, and filesystems on a Unix System. A superpower or a super ability to start a process if it’s not running, restart a process if it isn’t responding, and stop a process if it uses high resources, that’s what Monit(or) does in layman’s terms.

Monitoring is basically treated as an additional feature of Monit. Using it you can monitor files, directories, and filesystems for changes such as checksum changes also changes with file size or changes to the timestamp. This small Open Source utility for managing and monitoring Unix based systems. Monit can conduct various forms of automatic maintenance and create repair reports which can be helpful in executing meaningful causal actions in error situations.

Installation:

This open-source tool can be downloaded with the simple apt-get command. Open the terminal and write the following commands.

sudo apt-get install monit

monit installation

To check the version use this command. 

monit --version

monit version

We can start and enable the Monit service with the following command.

systemctl start monit
systemctl enable monit

Then check the status of the Monit with the following command.

systemctl status monit

monit status

Configuration for Web-Interface

Monit has it’s own user-friendly web-interface. By default, it is disabled to enable it to follow the following section. With it, you can view the system status & manage the properties through the web-browser.

We will start by editing it’s configuration file /etc/monit/monitrc

sudo nano /etc/monit/monitrc

Un-comment the following lines from monit. This will allow the interface to run on localhost port 2812.  

Configuration for Web-Interface

Save and restart the Monit service 

systemctl restart monit

Go to localhost:2812 and when prompted type Username as “admin” and password as “monit”. Without double quotes.

You should see a default dashboard like the one shown below.

Configuration for Web-Interface

Click on the example system shown (hazard) to view to the status of the server.

Configuration for Web-Interface

Monitrc can also be configured to change the timings daemon process in seconds to know how often it is going to view the status of the service.

With default settings, it checks immediately after we launch the monit. Simply remove or change the delay option to change the delay timings. TPolling frequency (This is the interval (in seconds) at which Monit runs its tests.)

Configuration for Web-Interface

To restart Monit use following command

sudo /etc/init.d/monit restart

To verify Monit logs

sudo tail -f /var/log/monit.log

Configure Monit for Additional Services

Apache, SSH and FTP

Install Apache and vsftpd to the system with the following command.

sudo apt-get install apache2 vsftpd

Now, create a configuration file for vsftpd.

sudo nano /etc/monit/conf-available/vsftpd

Add these line to vsftpd:

check process vsftpd with pidfile /var/run/vsftpd/vsftpd.pid
  start program = "/etc/init.d/vsftpd start"
  stop  program = "/etc/init.d/vsftpd stop"
if failed port 21 protocol ftp then restart

Save and close nano and enable the configuration file by creating a symbolic link.

sudo ln -s /etc/monit/conf-available/vsftpd /etc/monit/conf-enabled/

Also, enable Apache and SSH configuration file in similar way.

sudo ln -s /etc/monit/conf-available/apache2 /etc/monit/conf-enabled/
sudo ln -s /etc/monit/conf-available/openssh-server /etc/monit/conf-enabled/

and verify monit status

monit -t

then restart monit

systemctl reload monit

To check the status of services like CPU, File System and Network, use the following command

sudo monit status

monit status service



Similar Reads

How to Monitor CPU and GPU temperature in Linux
This article will discuss How to Monitor CPU and GPU temperature in Linux. There are several ways to do this here in this article we will discuss a few of them. The utilization of currently running programs or applications has no bearing on the CPU or GPU temperature. Operating sensitive computer parts, such as CPUs, at temperatures over a predeter
4 min read
How to Monitor Processor, Memory, Network Performance using dstat in Linux?
Do you want to run a quick performance test on your Linux machine? You may want to check the dstat command. Dstat is a versatile and efficient command that combines the features of several older tools such as vmstat, netstat, iostat, and ifstat to provide useful insights into Linux system performance. You can analyze virtual memory, network connect
2 min read
How to Create Btrfs Filesystem in Linux and its Features
Btrfs was a project which was started back in 2007, it is a part of the Linux kernel. It is a copy-on-write filesystem that uses advanced features. It is highly scalable, and easy to maintain and repair. Since 2013 this file system is considered stable in the Linux kernel. The core and the most vital structure of btrfs was proposed by a researcher
5 min read
Exploring a Docker Container's Filesystem in Linux
There are times during our development process when we need an in-depth exploration of the filesystem of the docker container that we are using. But how to do that? In this article we are going to look at 6 ways that are used for the above purpose. If you are not familiar with the basic commands used in docker then you can refer to the below articl
5 min read
Autojump – An Advanced ‘cd’ Command to Quickly Navigate Linux Filesystem
The AutoJump is a command-line utility tool that helps us to navigate the file system more efficiently by quickly jumping to recently visited directories. AutoJump keeps a record of directories previously accessed by the user thus we will be able to switch between the directories swiftly instead of the traditional way of traversing it through the h
5 min read
Difference Between User-CPU-Time and System-CPU-Time in UNIX
There are two kinds of CPU time in any UNIX system: User CPU Time and System CPU Time. These metrics help in understanding the way in which the overall execution time is spent by any process using CPU resources. User CPU time is the total amount of time that the CPU spends executing both user processes and those parts of programs that run on behalf
8 min read
How to fix “cannot connect to the Docker daemon” Error
Docker is a powerful platform for building, shipping, and running distributed applications. However, when working with Docker, you may come across an error message that says “cannot connect to the Docker daemon”. This error typically occurs when the Docker daemon is not running or the user running the command does not have permission to connect to
5 min read
Monitor and Find Statistics for Linux Processes Using pidstat Tool
Pidstat is a command-line tool and part of sysstat suite to monitor the Linux system. It is used to monitor every individual task currently being managed by the Linux kernel on the Linux system. Features of pistat: It can monitor every task running on the systemIt can also monitor the child's task of any task.It shows the total CPU usage by every t
4 min read
Using htop to Monitor System Processes on Linux
htop a Linux tool that is used in process-managing and terminal-based system monitoring. It allows real-time monitoring of processes and performs every task to monitor the process in the Linux system. The tool is written in the C programming language by Hisham Muhammad. It displays a complete list of processes running on the system and gives inform
5 min read
How to Install and Use Scout_Realtime to Monitor Server and Process Metrics in Linux?
There are numerous free tools on Linux that are used to monitor the Linux system including hardware and software. We all may have already come across some command-line Linux performance monitoring tools such as top, htop, atop, etc. Alike that we come across another tool called Scout Realtime tool which is used for server monitoring, that you can s
2 min read
How to Install and Use bmon Real Time Bandwidth Monitor in Linux?
Bmon Stands is an open source tool for the bandwidth monitoring tool. bmon is a powerful CLI based network bandwidth monitoring and debugging tool for Unix / Linux systems to capture networking related statistics & present them visually on the command line in a human-friendly way. It captures the traffic usage over all the network interfaces on
4 min read
How to Monitor System Usage, Outages and Troubleshoot Linux Servers
As we know that Linux is very reliable and a great system administrator should always know the system's behavior and its utilization at every moment of time. So if an administrator or a user wants to monitor its complete system then they have to do the following Storage Space Utilization Linux provides two commands which are used to inspect storage
5 min read
How use Nmon and "Java Nmon Analyzer" for Monitor Linux Performance
Nmon or Nigel’s Performance Monitor is a tool that is used for the purpose of monitoring resources on Linux, x86_64, Mainframe, etc. With the help of Nmon, you can monitor CPUs, disks, memory, and a couple of other things. There are two modes of Nmon: Online mode: This is used for the purpose of real-time monitoring. Capture mode: In this, the outp
3 min read
Check and Monitor Active GPU in Linux
Monitoring the GPU(Graphics Processing Unit) on a Linux operating system is essential for performance testing, debugging, and ensuring usage. There are many tools for checking and monitoring the GPU activity of various GPUs like Nvidia, AMD, or Intel GPU. This article will teach us about multiple methods to check GPU monitors in the Linux Operating
4 min read
saidar Utility - Monitor the Linux Box
Saidar is a curses-based (Curses-based software is software whose user interface is implemented through the curses library) tool for viewing system statistics and monitors the Linux system. It is a command-line based tool as it is run on a terminal. To install saidar on Debian based Linux system run the following command on the terminal: sudo apt-g
3 min read
How to Monitor Linux Commands Executed by System Users in Real-time?
If you are a Linux system administrator then you would definitely want to monitor the interactive activity of all system users, like monitoring the Linux commands they execute in real-time. In this brief Linux system security article, we will be going to discuss how to monitor all Linux shell commands executed by system users in real-time. Let's se
1 min read
Installing atop Tool To Monitor the System Process in Linux
atop is an ASCII full-screen interactive performance monitor which is kind of similar to the top command to view the load over a Linux system. The job of the most critical hardware resources (from a performance point of view) at the system level, i.e. CPU, memory, disk, and network can be seen. atop enable us to identify which processes are actuall
7 min read
Sysmon – Graphical System Activity Monitor for Linux
Sysmon is a graphical system monitor for Linux. It shows the information about the CPU, GPU, Memory, HDD/SDD and network connections. It is similar to the Windows task manager. It is completely written into the python programming language. Sysmon shows the all information in the form of Graphical visualization. There are some features of these tool
2 min read
Progress - Tool to monitor progress of basic command in Linux
Progress is a command-line-based tiny tool which is formerly known as a Coreutils Progress Viewer. This tool is written in the C language. This command looks for the Coreutils basic command like cp, mv, dd, tar, gzip, cat, etc. which are currently running on the system and display the percentage of copied data. This tool can also show the estimated
2 min read
How to Monitor Linux Server Security with Osquery
An operating system is transformed into a massive database with tables that you may query using SQL-like commands using the open-source security application osquery. With the help of these queries, you can do security audits of the target server, monitor file integrity, and more. You can also examine the firewall's status and settings. It is a cros
3 min read
How to Monitor Access Point Signal Strength with wifi-linux
In today's interconnected world, Wi-Fi has become indispensable for both personal and professional connectivity. However, ensuring a stable and secure Wi-Fi connection requires diligent monitoring of access point signal strength. In this comprehensive guide, we'll explore why monitoring access point signal strength is crucial on Linux systems and h
6 min read
Logcheck Tool - Monitor Kali Linux System Log Activity
Logcheck is a package or tool to check system log files for security violations and unusual activity, it utilizes the program called logtail remembering the last position is read from the log file. Analyzes security or unusual activity from syslog to monitor Apache log files for errors caused by PHP Scripts. Logcheck is used to detect problems auto
4 min read
How to Use Glances to Monitor Remote Linux in Web Server Mode?
Glances is a system monitoring tool for Linux machines, it is used to monitor system resources in web server mode or through the web browser. It is an alternative to top and htop monitoring tools. This tool has various features and also provides bits of information on a single screen. Glances is a cross-platform, free and open-source tool for monit
3 min read
How to Monitor System Activity in Linux | top Command
top command is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel. As soon as you will run this command it will open an interactive command mode where the t
10 min read
SAR command in Linux to monitor system performance
sar (System Activity Report) It can be used to monitor Linux system's resources like CPU usage, Memory utilization, I/O devices consumption, Network monitoring, Disk usage, process and thread allocation, battery performance, Plug and play devices, Processor performance, file system and more. Linux system Monitoring and analyzing aids in understandi
6 min read
How to Put WiFi Interface into Monitor Mode in Linux?
Before looking into Monitor mode and how to switch your WiFi mode from Managed to Monitor, it’s important to understand how a basic WiFi connection is established. When your system connects to WiFi, it sends packets to the WiFi network, which in turn acknowledges these packets, establishing a connection. Once connected, data packets can be sent to
4 min read
Woof - Easily Exchange Files Over a Local Network in Linux
In order to easily share single files between Linux systems in a home network where we don't need to worry too much about security. Woof is an acronym for Web Offer One File. It is used to share files over a local area network. The recipient need not have any special software installed on his system, The shared file may be downloaded using curl, ge
3 min read
How to Impose High CPU Load and Stress Test on Linux Using ‘Stress-ng’ Tool
The system must have the capacity to handle a high workload regarding systems administration activities including performance testing. One such method used in testing the robustness of a system at its limit points is known as stress testing. Stress-ng is also a great versatile and strong tool for stress testing. This article is aimed at providing i
5 min read
How to Check and Patch Meltdown CPU Vulnerability in Linux?
Here we will check and Patch Meltdown CPU Vulnerability in Linux. CPU hardware implementations are found vulnerable to side-channel attacks, They are known as: MeltdownSpectre Meltdown: It is a security vulnerability found in hardware that is affecting Intel x86 microprocessors, IBM POWER processors, and some ARM-based microprocessors too. Security
3 min read
7 Ways to Check CPU Clock Speed in Linux
In general, a higher clock speed means a faster CPU. However, many other factors come into play. Your CPU processes many instructions (low-level calculations like arithmetic) from different programs every second. The clock speed measures the number of cycles your CPU executes per second, measured in GHz (gigahertz). A “cycle” is technically a pulse
2 min read