You must to run mender-monitorctl
with root privileges
The log subsystem will look for a log pattern or a data stream.
Arguments:
The log monitoring subsystem saves the number of the last line of logs that it parsed and starts tailing the file skipping the already seen lines.
The log monitoring subsystem uses the grep
command to match lines to a given pattern
By default, and if supported by grep
we use the -P
option, which allows you to use
the Perl-compatible regular expressions.
If you have no support for -P
, it falls back to the -E
flag, and
eventually uses plain grep
.
The general syntax to enable a check for a pattern in a specific file is as follows:
# "Subsystem" "Check name" "Log Pattern" "Log file or data stream" "[Optional] Log pattern expiration"
mender-monitorctl create log crasher_app ERROR /root/crasher.log 5
Any command that produces data on standard output can be used as the data source in which to look for patterns.
The general syntax to enable the streamline logs extension is to use @
with the command that provides a stream of logs:
# "Subsystem" "Check name" "Log Pattern" "Log file or data stream" "[Optional] Log pattern expiration"
mender-monitorctl create log crasher_app ".*container kill.*name=scanner.*" "@docker events" 5
Every time a D-Bus signal matching the watch expression is received, it will trigger a check that will send an alert from the monitoring subsystem. You can adapt the configuration to any D-Bus signal and pattern based on your use case.
Let's assume you want to raise an alert every time u-power
raises a signal. To this end, you need to create the check as follows:
# "Subsystem" "Check name" "Dbus name" "Dbus pattern" "Dbus watch expression" "[Optional] Dbus alert expiration"
mender-monitorctl create dbus dbus_check u-power "" "type='signal',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',path=/org/freedesktop/UPower/devices/battery_BAT0" 5
Arguments:
DEFAULT_DBUS_ALERT_EXPIRATION_SECONDS
is used.The service subsystem is mostly useful for tracking systemd services. It will trigger an alert if detects the systemd service isn't running. It has a peculiarity compared to the other services where the check name is used as a parameter for the subsystem
# "Subsystem" "Check name" "Service type"
mender-monitorctl create service cron systemd
Arguments:
© 2024 Northern.tech AS