Simple monitoring solution
Go to file
2024-07-04 16:54:23 +02:00
notification Deletion of notification services. 2024-06-28 17:18:08 +02:00
screenshots Added screenshots 2024-06-30 12:39:24 +02:00
sql Added SQL for problem 2024-07-04 16:06:11 +02:00
static Immediate value presentation when adding datapoint to trigger 2024-07-04 16:48:57 +02:00
views UI adjustments for problems view 2024-07-04 16:29:53 +02:00
.gitignore Initial commit 2024-04-29 08:36:13 +02:00
area.go Added area deletion 2024-06-02 09:17:50 +02:00
config.go Clarified file configuration naming 2024-06-27 09:09:47 +02:00
configuration.go Stricter datetime input 2024-06-27 13:14:37 +02:00
datapoint.go Present times in configured timezone 2024-07-04 16:54:23 +02:00
go.mod Removed session daysvalid 2024-06-30 11:42:00 +02:00
go.sum nodata ui changes 2024-05-25 15:00:01 +02:00
helper.go Refactored time filter. 2024-07-04 13:29:39 +02:00
main.go Immediate value presentation when adding datapoint to trigger 2024-07-04 16:48:57 +02:00
nodata.go Clarified file configuration naming 2024-06-27 09:09:47 +02:00
notification_log.go Refactored time selecting 2024-06-29 20:50:57 +02:00
notification_manager.go Deletion of notification services. 2024-06-28 17:18:08 +02:00
page.go Added page layout errors 2024-06-27 09:51:52 +02:00
problem.go Save name of trigger in problem 2024-07-04 15:59:29 +02:00
README.md Update README.md 2024-06-30 12:58:27 +02:00
section.go Added area deletion 2024-06-02 09:17:50 +02:00
timefilter.go Refactored time filter. 2024-07-04 13:29:39 +02:00
trigger.go Store datapoint values with the problems 2024-07-04 09:21:46 +02:00

Table of Contents

Smon

Smon (Simple Monitoring) is a small and easy to maintain single user monitoring system.
It is developed for the developer's personal need for monitoring a small number of datapoints and get notifications, without having to maintain a huge system like Zabbix.
It is also possible to troubleshoot with historial data and graphs.

There is no concept of users or passwords.
If a requirement, authentiation and authorization can be handled by a HTTP reverse proxy.

All data is sent to the system via an HTTP request to /entry/datapoint_name.
Smon can't poll data.

Screenshots

Problems Datapoints Graphs Triggers

Quick start

  1. Create an empty database (smon only supports PostgreSQL).
  2. Create the configuration file (default ~/.config/smon.yaml).
  3. Run ./smon (will create the database schema).

Configuration

network:
  address: "[::]"
  port: 9000

websocket:
  domains:
    - localhost
    - smon.example.com

database:
  host: localhost
  port: 5432
  name: smon
  username: smon
  password: you_wish

application:
  logfile: /var/log/smon.log
  nodata_interval: 60

Sending data to datapoints

curl -d 200 http://localhost:9000/entry/datapoint_name

Use date '+%FT%T%z' to get a value from systems in correct format.

Concepts

Core concepts in Smon are:

  • datapoints.
  • triggers.
  • problems.
  • notifications.
  • areas.

Datapoints

A datapoint has a unique name. Recommended is to use only a-z, A-Z, 0-9, dots, dashes and underscores for easier handling in URLs and trigger conditions.

There are three data types:

  • INT.
  • STRING.
  • DATETIME.

INT accepts values like -100, 0, 137 and 29561298561 and is stored in the int8 postgresql type.

STRING is text data and stored by an unlimited varchar.

DATETIME is a date with time and timezone in the format of 2006-01-02T15:04:05+02:00 or 2006-01-02T15:04:05+0200. Stored in a field of timestamptz.

Recommended is to provide from where (machine, system or script location...) the data is being pushed to Smon in the comment field.

Triggers

Triggers have datapoints the expression is being able to use.

Expressions are written with the Expr language. See the language reference for available functions and syntax.

The trigger is evaluating the expression when data is entered through the /entry/datapoint_name URL and a problem is issued when the expression returns true.

Examples

The disk usage (reported in percent) for server01 has exceeded 90%:

server01_disk_usage_root > 90

It was more than 48 hours since Borg finished on server01:

(now() - borg_server01_finished).Hours() > 48

Problems

One or more datapoints that trips a trigger issues a problem.

Problems are archived in the database and can be looked up historically.

A page of current problems is available to see the current problem state, either as a list or categorised.

Problems can be acknowledged if they are known problems that will not be currently fixed.

Notifications

Smon has a couple of notification services (currently NTFY and script).

Services are added with a prio. The service with the lowest prio is tried first.
If sending through the service fails, the next service is tried and so on until one succeeds.

What is sent isn't configurable (for now). What is sent is:

  • PROBLEM (when a problem is created) or OK (when a trigger evaluates to false).
  • Trigger name

NTFY

An URL is provided to the topic which should receive the notifications.

Script

The script service is defined with a filename.

The script is called with three parameters:

  1. Problem ID
  2. Acknowledge URL
  3. Message

Areas

Go to the Config icon to add areas. These are available to categorize triggers and problems for easier troubleshooting.

Each area has sections to further group problems and triggers.

Development

A couple of small notes on development.

Theming

  • Add theme to select tag in /views/pages/configuration.gotmpl.
  • Create /static/less/theme-<theme-name>.less.
  • Create /static/less/<theme-name>.less.
  • Copy a theme directory under /static/images/ to the new name.