monzero/cmd/monfront
Gibheer 8919bafb3a fix broken SQL update
This fixes a bug in the generation of the SQL query, that was introduced
in 49dac92034.

There were two issues with the generation:
1. the check ids were sometimes not added to the arguments
2. the whereVals were not extracted as arguments

This lead to all arguments being treated as one, which caused all sorts
of errors in the frontend.
By extracting all whereVals and always building it with the check ids
first the update starts working correctly again.

Found-By: Parsa Yousefi <parsa.yousefi@ionos.com>
2024-09-05 19:14:20 +02:00
..
templates monfront - add basic interface to create some entities 2022-12-15 11:16:56 +01:00
authenticater.go switch from log to slog 2023-08-17 22:05:46 +02:00
authorizer.go cmd/monfront - import monfront from separate repository 2021-12-02 17:54:14 +01:00
checks.go switch from log to slog 2023-08-17 22:05:46 +02:00
create.go switch from log to slog 2023-08-17 22:05:46 +02:00
filter.go cmd/monfront - import monfront from separate repository 2021-12-02 17:54:14 +01:00
groups.go switch from log to slog 2023-08-17 22:05:46 +02:00
main.go fix broken SQL update 2024-09-05 19:14:20 +02:00
pw.go cmd/monfront - import monfront from separate repository 2021-12-02 17:54:14 +01:00
README.md cmd/monfront - import monfront from separate repository 2021-12-02 17:54:14 +01:00
server.go prepare switch to log/slog 2023-08-17 22:02:52 +02:00

monfront

Monfront is the frontend to manage monzero. Monzero consists of the other two components moncheck and monwork too.

requirements

runtime requirements:

  • PostgreSQL >= 10.0

build requirements:

  • Go >= 1.11

components

The following components exist:

monfront

Monfront is a webfrontend to view the current state of all checks, configure hosts, groups, checks and view current notifications. It is possible to run multiple instances.

configuration

To get the system working, first install the database. After that, create an alarm mapping:

insert into mappings(name, description) values ('default', 'The default mapping');
insert into mapping_level values (1, 0, 0, 'okay', 'green');
insert into mapping_level values (1, 1, 1, 'okay', 'orange');
insert into mapping_level values (1, 2, 2, 'okay', 'red');
insert into mapping_level values (1, 3, 3, 'okay', 'gray');

Next is to create a notifier. This feature doesn't work 100% yet and needs some work and may look different later:

insert into notifier(name) values ('default');

After that create a check command:

insert into commands(name, command, message) values ('ping', 'ping -n -c 1 {{ .ip }}', 'Ping a target');

This command can contain variables that are set in the check. It will be executed by moncheck and the result stored.

After that, create a node which will get the checks attached:

insert into nodes(name, message) values ('localhost', 'My localhost is my castle');

With that prepared, create the first check:

insert into checks(node_id, command_id, notifier_id, message, options)
values (1, 1, 1, 'This is my localhost ping check!', '{"ip": "127.0.0.1"}');

Now start the daemons moncheck, monfront and monwork.

monwork will transform the configured check into an active check, while moncheck will run the actual checks. Through monfront one can view the current status.