Ep. 23: Working with the event console in Checkmk
[0:00:00] | Welcome back to the Checkmk channel. Today, we are going to talk about the event console. |
[0:00:16] | The event console is used for all kind of event-based monitoring. As you know of now, all we did is in active monitoring. So, we querry systems and get a result. |
[0:00:28] | On event-based monitoring, it's that some other systems is sending on a civil event, that can be a syslog server, that can be, like, SNMP traps or basically every other protocol which you can use then to convert it to a real event console event. |
[0:00:46] | As you can see here, the event console is alongside with Checkmk but is using the same Setup. |
[0:00:54] | So, that means it's a completely different system but it's fully integrated inside from Checkmk not only for the setup part but also for the notification. |
[0:01:05] | This means from the event console you can even trigger like a normal email notification. The event console has even more features.So, you can even define your own actions inside the event console. |
[0:01:23] | And what I'm going to show you later, you can also define different outcomes with this action. So basically, you can not only open events, you also can automatically close them by a closing event by a time. |
[0:01:36] | You can also use events just to trigger an action and close them immediately. After that, you can also automatically close events by time. As you can see on diagram 2, the event console has different interfaces to receive events. |
[0:01:55] | For example, you can enable receivers for syslog UDP and TCP and for SNMP traps. Also, there is a local interface which you can use to build your own plugins, which enables you to receive any kind of event from every system you want. Then let's look into it. |
[0:02:18] | We start at the part Setup. The first thing you need to do is enable the full view of all options. Then you're going to find in the part, 'Events', the subpart: Event Console. |
[0:02:40] | On the next page then, you see the Event Simulator. You can use this then to test your rules. And on the second part, you see the Rule packs. Rule packs are basically a collection of rules. |
[0:02:58] | You can go with just one pack and use them to collect all of the rules. You can even export these packs if you want to. |
[0:03:08] | I would recommend to create a pack for every type of rule you want to have. For example, if you want to monitor the events of a, let's say, Cisco switch, I would create a pack for Cisco switch. |
[0:03:22] | If you have, like, a different system just create one pack for this different system. The next thing we need to do is to enter the rule pack. That works with this icon. |
[0:03:37] | And on the second page, now we still have our event simulator. I can hide it since we don't need it anyway now, and yet no rules. With the button Add rule, we can add our first rule. |
[0:03:54] | The first option we need to set all the time is the Rule ID. This is important because every created event will refer later on to this full ID so you always know which of your rules created which event. |
[0:04:12] | I'm really creative so I use test here as an event ID. Let's switch to the Matching Criteria. I just gonna use the important ones here. |
[0:04:23] | The most of them are related to syslog events but we can also do just a little text match. A event always needs a pattern. |
[0:04:37] | And it doesn't matter if you talking about syslog events here or even SNMP traps. |
[0:04:42] | The pattern can be that you have very simplified error at first, and after that an error text like Error: Something is wrong. |
[0:05:01] | Of course, you don't want to create one rule for every possible error. So, we're gonna need regular expression to match everything was behind error. It's like (.*). |
[0:05:22] | Yeah, but this is a really simple example. In practice the regex would be a bit more complicated. |
[0:05:34] | Then the next problem with this event is when we receive it, it's created but when should the event closed again? That can be automatically after time. |
[0:05:48] | That can be automatically, it can be automatically immediately because you can also assign actions. I show this later. Or you can also receive a clearing trap or a clear message. For that, you can use text to cancel events. |
[0:06:06] | And now it gets a bit complicated since usually it's, like, you get the OK notification. And after that, you normally have the original error message. So, you need to build the same match also inside this field. |
[0:06:33] | This background here is, if you get an error one and an errow two and then you get an OK, you would not know which one of the errors you want to close. Is it the first one or is it the second one? |
[0:06:46] | But if you get error one, error two, and then later OK two, you would know you need to close the second one, the one who had two as the error message. |
[0:06:57] | Therefore, these brackets need to match the original error message to close the correct event. And that is already enough that we can test it. |
[0:07:12] | I save now. I activate my changes. And now let's use the Event Simulator to test. So, we go back to Setup, Event Console. |
[0:07:38] | I open the event simulator and what I need is the message text. I said I have something with error. Let's say something wrong again. |
[0:07:56] | I can enter some more source information but that's not important for our test now. |
[0:08:01] | At first, I can go with Try out. With that I can show that my rule pack is matching even when I'm inside the rule pack. |
[0:08:12] | With this click here and I go Try out. I can see that my test rule is matching here. |
[0:08:22] | But when I go to Generate event, I see here my sidebar, that event is created. I click inside it. |
[0:08:33] | And see here, for myhost089, Foobar-Daemon, Error: Something wrong. Then we want to close it automatically. I use browser back in this case. |
[0:08:51] | I change to OK. I generate the event. And a second later here, the sidebar isn't refreshed yet but I can see it here in the overview, the event is gone. |
[0:09:10] | And then another example about our regular expressions. I'm gonna create two events. Error: Something wrong 1. Error: Something wrong 2. |
[0:09:28] | Now I have these two events here and I just want to close one of them. So, let's go with the first one, with 1 here. Generate. And we just have one left. |
[0:09:49] | The next thing we can do, we can make it look a bit more, let's say, clean. So, we can rewrite message field and some of the other fields. |
[0:09:58] | So that we go back to the configuration, we go back inside the rule. I'm here in the rule pack and here I have my test rule. So, I use the pencil. I scroll down. |
[0:10:15] | And at the very end of the page we have the rewriting part, where we can rewrite the message text or information like hostname and stuff like that. And it's basically really simple. |
[0:10:28] | You go with the matching patterns from before. Here we have one pattern. |
[0:10:33] | If I would have a bit more complicated text like error and something else and then a second of this, I would have two matching groups. |
[0:10:50] | So here, I would be able to refer to the first one and refer to a second one in another field. |
[0:11:00] | In our example, I keep it simple. So, just one. So, we don't have a number two and let's put something there. It's like, say, Hello World. |
[0:11:18] | Then we want to have the error. We save it again. I activate it. Then let's create the next event. Setup, Event Console. |
[0:11:34] | Instead of Error: Something wrong 1, now we're gonna have, wait for it, Hello World: Something wrong. So, the part error is gone because it wasn't part of the matching pattern, and we have the nice rewrited text here. |
[0:11:55] | Finally, I want to show some more of the options for our rules. Back to Setup. Back to the Event Console. I enter into my rule pack and I enter just in this rule. |
[0:12:12] | Besides the matching criteria, you can define the outcome. For example, one rule can be that the rule pack is skipped or that the event is just dropped. |
[0:12:29] | This makes sense if you have a lot of events in a short time and you don't want to have millions of events possessed by all of your rules, so you can sort out events at any time. |
[0:12:47] | Next point, you can change the State. So, normally it's set by syslog but especially, if you work with SNMP traps, you need to decide is it critical, is it okay, is it unknown, is it running. |
[0:13:03] | Also, you can assign contact groups if you want to use the right management in Checkmk. And finally, you can assign some actions. |
[0:13:14] | The simplest action is to send the monitoring notification that you can use the rule-based notification system of Checkmk. |
[0:13:22] | Otherwise, you can also define your custom actions inside the Event Console. But it's not the part I'm gonna show today. |
[0:13:35] | Then you have also two parts of actions. You can have an action the moment that the event appears, but you can also have an action the moment when the event is cancelled. |
[0:13:50] | If you don't have the cancelled event, you can also automatically delete the event after the action is done. For example, you send the monitoring notification and then you just delete the event. |
[0:14:07] | But sometimes you get a lot of messages. For this, you can use Counting & Timing. |
[0:14:13] | So, you can also decide count messages in an interval, and say, you want to wait for, let's say, 5 events before you create something. |
[0:14:26] | So, you would need, for example, 5 SNMP traps of the same type before you create the alert in the Event Console. And then you can also check for a heartbeat. |
[0:14:42] | So, you can, say, you want to have the event if you don't receive anything. So, if you don't get error every, what is the default here, every hour, you get the error message. Or what you can do is delay the event creation. |
[0:15:05] | So, you can, say, I want to delay it for 15 minutes. And if you get the cancelled event before these 15 minutes, there will not be an event in the Event Console. |
[0:15:16] | And one really really important option here is the limit event lifetime. Use this please every time when you test something so that events are automatically deleted. Because the Event Console is not an archive of some type. |
[0:15:40] | It's just there to give you notifications if you have any errors. So, if you would fill the Event Console at some point, it's going to break. |
[0:15:45] | One last thing, the Checkmk Event Console can also help you to receive events because the console has integrated receivers for syslog and SNMP traps. |
[0:16:03] | To set them up, you need to go to the site settings. So, we go to the Setup, the Global settings. Then we can search for Site Management, Event Console. Or I prefer putting Event Console to the filter and directly getting it here as a result. |
[0:16:38] | By default, it's only the local processing but you can enable, for my example here, the SNMP traps, and save that and activate that. After that, Checkmk will automatically listen on this port. |
[0:17:00] | The only thing you need to care about is that only one side can listen to one of the ports so it's not possible to have multiple sites receiving this kind of traps. |
[0:17:10] | I also often got the question: if we can handle SNMP MIB files here for the traps? Yes, it's possible. |
[0:17:21] | I'll show you how it's done. Here in Setup, then Event Console. Then in event console, you have a part SNMP MIBs. There you can upload new MIBs. |
[0:17:43] | And second of all, you need also to enable the handling on. Therefore, in settings you have the option to enable the drop translation. |
[0:18:04] | But I would not recommend to do that because there is not a real benefit out of it. |
[0:18:11] | You still need to do everything by hand, so you need to define your patterns, and it's easier to define a pattern out of numeric OID and real error messages than of just text. |
[0:18:30] | So, it's easier for you to catch, like, your pattern from a combination of OIDs and text. |
[0:18:36] | Also, of course, if you use the MIB files, it's going to be slower than without of them, because Checkmk would need to pass every incoming SNMP trap against all of the uploaded MIB files. |
[0:18:36] | I hope this little insight in this powerful system was helpful. Thanks for watching and please subscribe. |
Want to know more about Checkmk? Join us for our Introduction to Checkmk Webinar