Skip to content

ACAP that monitor important processes on AXIS devices

License

Notifications You must be signed in to change notification settings

alexekdahl/sauron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sauron - The All-Seeing Process Monitor

License Contributions Welcome

Welcome to Sauron—the all-seeing process monitor acap for Axis cameras. With Sauron, you get a lightweight tool that keeps a watchful eye on your camera's processes, ensuring everything is running smoothly.

What Is Sauron?

Sauron is a minimalistic process monitor written in Nim. It reads system data directly from /proc on your Axis camera, logging essential details like CPU usage, memory stats, and uptime in a simple, human-readable format. I’ve stripped away bulky dependencies so that Sauron stays lean and fast.

Features

  • Lightweight & Minimal.
  • Process Monitoring: Keeps track of specific processes by name.
  • Simple Config & Logs: Uses an easy key–value config file and plain text logs.
  • Multi-Architecture Support: Build for aarch64, armv7, amd64, and mipsle.
  • Docker-Ready: Consistent builds via Docker are supported.
  • ACAP-Ready: Built to run on Axis cameras as an acap.

Configuration

Sauron uses a straightforward key–value config file located at localdata/config.cfg. A sample config might look like this:

check_interval = 300.0
processes = mdnsd,httpd
log_path = ./localdata/process.log
max_log_size = 1048576
max_log_files = 5

Output

Sauron logs process data in a simple, human-readable format. Here’s an example of what you might see in the logs:

PID: 8770 | Name: <name> | State: Sleeping (interruptible) | Threads: 11 | RSS (MB): 35.95 | VSZ (MB): 626.2 | CPU (%): 0.88 | Uptime (sec): 35430.99 | Last Checked: 2025-02-21T12:41:52.346Z
PID: 5998 | Name: <name> | State: Sleeping (interruptible) | Threads: 3 | RSS (MB): 4.54 | VSZ (MB): 9.34 | CPU (%): 0.0 | Uptime (sec): 8674.34 | Last Checked: 2025-02-21T12:41:52.346Z
PID: 2346 | Name: <name> | State: Running | Threads: 1 | RSS (MB): 1.26 | VSZ (MB): 1.71 | CPU (%): 0.06 | Uptime (sec): 3600.05 | Last Checked: 2025-02-21T12:41:52.346Z

SauronLens: Log Analysis Tool

SauronLens is a companion tool located at tools/sauronlens/, built for parsing and analyzing the process log files generated by Sauron. It reads logs either from a file or via standard input (stdin) and outputs formatted statistics—including average, minimum, and maximum CPU and memory usage, along with timestamps for peak values.

Usage

Use the just recipe to fetch logs from your remote camera where sauron is running:

just sauronlens <ip> <username> <password>
Process <name>:
  State:                  Sleeping (interruptible)
  Avg CPU Usage:          0.01%
  Min CPU Usage:          0.00%
  Max CPU Usage:          6.28%      (At: 2025-02-22 01:49:55)
  Latest CPU Usage:       4.55%      (At: 2025-02-23 11:54:36)
  Avg Memory Usage:       4.56 MB
  Min Memory Usage:       4.00 MB
  Max Memory Usage:       5.88 MB    (At: 2025-02-22 01:49:55)
  Latest Memory Usage:    4.00 MB    (At: 2025-02-23 11:54:36)