A versatile command line tool for monitoring live systems to detect problems and generate alerts.
Opwatch is a Javascript interpreter with a built-in toolbox of functions dedicated to monitoring and alerting.
This toolbox includes Unix-like functions like tail
and grep
, statistical functions, and alerting functions.
Opwatch lets you perform a variety of tasks like monitoring website uptime, checking a log file for specific messages or exceptions, monitoring disk space and CPU trends, or invoking an application's healthcheck endpoint. Alerts can be published on Slack and Pushover.
Since Opwatch monitoring applications are plain Javascript programs, they can be modularized, versioned and reused across systems.
Opwatch does not aim at being a complete monitoring platform. It does not include a database, does not index log files, and does not have a graphical interface with charting. It is designed for alerting and can be used as a complement to other monitoring tools.
Here's an example of a small Opwatch program:
var processor = pipe(tail("application.log"), grep(/ERROR/), alert("An error occurred!"));
processor.run();
To try it, start the opwatch
Javascript shell and type the program:
$ opwatch
> processor = pipe(tail("application.log"), grep(/ERROR/), alert("An error occurred!"));
[object pipe]
> processor.run();
// Now try and append some lines to application.log
The Quick start guide takes you through this example in a little more details.
The Example list points to other Opwatch usage examples.
Opwatch requires the Java JDK at least version 8. To install Java, we recommend that you use Oracle’s installation documentation.
Download the archive opwatch-<version>-distrib
of the latest release,
and extract it. This creates a directory called opwatch-<version>
. You can then run opwatch from the bin
subdirectory:
$ cd opwatch-<version>/bin
$ ./opwatch