mmwatch - Alternative Linux Watch Command which Print Rates

mmwatch tool

You should be conversant with the watch command, which allows you to repeat commands at certain intervals and monitor the changes. The mmwatch tool is an opensource command line tool from Cloudflare which lets you monitor a particular command and print out the results as rates. In this article we'll see how to install it on both Ubuntu and CentOS.

Installing mmwatch

With git installed on your Linux box, you can install mmwatch and it's additional utilities on Ubuntu, Cent OS and other distros on your computer. This mmwatch is written in python and does not require additional dependencies to run. To install mmwatch, we first  have to clone the utility from the github repo by entering this command:

$ git clone
$ cd cloudflare-blog/2017-06-29-ssdp/

Now, we will make the utility executable and then copy it to the bin folder so we can access it from any location in the terminal.

# chmod +x mmwatch
# cp mmwatch /bin/mmwatch

You can now run the mmwatch command from anywhere in the terminal. If you don't want to keep this in your /bin folder, you can run the command from the cloudflare folder using these commands.

$ git clone 
$ cd cloudflare-blog/2017-06-29-ssdp/
$ ./mmwatch 'parameters'

Using mmwatch

Using mmwatch is as simple as using the watch command. You invoke it using the following syntax, where you replace 'parameters' with the command you want to monitor.

nbsp;mmwatch 'parameters'

In this example, we will combine mmwatch and uptime to monitor server load and uptime at runtime.

$ mmwatch 'uptime'
mmwatch usage with uptime command

In the second example, we'll use the mmwatch command with df to monitor disk usage:

nbsp;mmwatch 'df -H'
using mmwatch with df command

It's good to note that mmwatch is part of two additional tools namely mmsum and mmhistogram. The mmsum tool simply sums a list of floating point numbers while the mmhistogram tool displays an ASCII histogram numerical values. All these utilities can be installed following the same process as used earlier.

Here are examples to show to use mmsum and mmhistogram:

$ echo -e "1\n2.4\n3.6" | mmsum 

$ echo -e "1\n2.4\n3.6" | mmhistogram 
Values min:1.00 avg:2.33 med=2.40 max:3.60 dev:1.06 count:3
 value |-------------------------------------------------- count
 0 | ************************* 1
 1 | 0
 2 |************************************************** 2

In this article, we learned how to use mmwatch to monitor changes with various Linux commands and then mmsum and mmhistogram to calculate sums in floating point and draw histograms.

Leave a Comment