Sertus is a service status monitoring tool written in rust that supports multiple checkers, including processes, scripts with metrics, APIs, and more.
- Supports Prometheus metrics
- Supports Prometheus metrics server
- Supports Prometheus push gateway
- Enables flows with concurrency
- Allows for setting intervals for flows
- Divides flows configuration into multiple flow config files
- Supports script checkers
- Supports custom metrics
- Supports API checkers
To get started with Sertus, follow these simple steps:
- Initialize the Sertus configuration by running the following command:
sertus init
// or interactively create config
sertus init -i
The default configuration file ~/.sertus/config.toml
will be generated.
-
Edit the configuration file to specify the task checkers for flows.
-
Start the Sertus daemon by running the following command:
sertus daemon
# use metrics server
[metrics.Server]
addr = "127.0.0.1:9296"
# or use prometheus push gateway
#[metrics.PushGateway]
#endpoint = "http://127.0.0.1:9091/metrics/job/sertus/instance/127.0.0.1"
#interval = Option<u64> default 10(s)
#idle_timeout = Option<u64> default 60(s)
[[flows]]
name = "flow 1"
interval = 3
[[flows.tasks]]
name = "check process"
checker.ProcessChecker = { prefix = "process prefix" }
[[flows.tasks]]
name = "check script"
checker.ScriptChecker = { path = "~/.sertus/scripts/script.sh" }
# the bin is option, default "bash", if use python:
[[flows.tasks]]
name = "check py script"
checker.ScriptChecker = { path = "~/.sertus/scripts/script.py" , bin = "python3"}
By default, Metrics has labels for flow and task. If you want to add custom labels in ScriptChecker, you should echo like #label {k=v, x=y}
in your script.
Example:
#!/bin/bash
# stdout
echo "#label {k=v, x=y}"
echo "ok msg"
# or stderr
echo "#label {k=v, x=y}" >&2
echo "err msg" >&2
exit 1
If you want to add custom metrics in ScriptChecker, you should echo like #metric key type {k=v, x=y} value
in your script. In addition, the key will be prefixed with sertus_
.
Example:
#!/bin/bash
# the real key is sertus_key_xxx
echo "#metric key_xxx gauge {k=v, x=y} 1.0"
echo "#metric key_xxx counter {k=v, x=y} 1"
- has stderr
- exit code != 0
sertus_flow_task_status
gauge:
1.0
task succeed0.0
task failed-1.0
task checker happened unknown error, please check the sertus log