...
Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Getting Started
Background information regarding this subject is available on our:
Checkmk Rules needed
Configuring the Checkmk Agent
...
- Create a Rulepack with a suitable name:
- Go to the rules of this Rulepack
- There, create a rule to handle all events that do not match any other rules yet
...
Setup → Events → Event Console rule packs → Add Rule
Matching Criteria
Here, we need two regular expressions:
The first one is applied to the message text and defines three matching groups using the brackets:
Code Block language bash theme RDark .{3} [0-9]+ [0-9:]{8} [0-9]+\.([0-9]{4}) ([^ ]+) (.*)
The website https://regex101.com helps you to understand how the regex matches the message text and which groups are created:
These groups can later be accessed using the placeholders \1, \2, and \3 in the message text rewriting. They might also become important when automatic duplicate detection is used. We'll come to that later on.- The second regular expression "^(.*)$" simply matches on any Application text (in our case, it's always "Security", though) and puts it into a matching group. Later, we can access this group using the macro "$MATCH_GROUPS_SYSLOG_APPLICATION_1$".
...
The "Outcome & Action" section can remain unchanged, but in the Counting & Timing, we have two definitions:
The counting is done based on the hostname and the application. Forcing separate events for different match groups makes no sense here because the message text is stored in group 3, and as we all know, these texts sometimes contain IDs, timestamps, and similar unique strings.
...
In the Rewriting section, we can adjust the message text, application, and other variables that will be shown in the event views:
The message text will be replaced using the groups from above:
...
Clone the "unknown" rule and modify the following fields:
The Regex
Using the long message text, we pick out the important information (colored) and create a regular expression pattern, starting with the one we already used in the "unknown" rule:
...
Fill in the new pattern in the "Text to match" field:
Counting & Timing
The counting and timing also will be changed a bit:
For this kind of event, we want separate events if the match groups ("executing user name" and "affected user name") are different.
...
In the rewriting section, the texts are also adjusted to the newly defined event:
Further Rules and Performance Considerations
...
After that, your rule pack should look similar to this:
Testing these rules by creating and deleting a user on the monitored host results in the following events:
To get rid of the "unknown" events in-between, we can do two things:
...