Ep. 7 (part 3): Managing Hosts in Folder in Checkmk
[0:00:00] | Welcome to this third part of our series on working with rules and service parameters. In this video, we're going to take a look at how you can structure your hosts using folders. |
[0:00:20] | Working with folders starts making sense when you have more than a handful of hosts so let's say 20 30 or 50 hosts. Many of our customers have thousands of hosts. And then it really becomes important that you have a well-designed structure. |
[0:00:35] | Working or building a structure is in principle very easy think of it as a file system in Linux or windows where you have folders and subfolders, but in the end, there is no files in these folders but rather hosts. We also have a very good article on this topic and you can find that in our documentation. Let's have a look. So if you go to docs.checkmk.com then under the configuration section there is an article called host administration so let's open that. |
[0:01:08] | And when you scroll down and here is an image that depicts pretty well how this works so you have this main directory which is automatically there and created by Checkmk and then for example you can create subdirectories for servers and network, and then you can simply add hosts to these folders. |
[0:01:29] | This not only allows me to have a better structure but it's also a powerful feature. You can, for example, attach attributes or host tags to these folders. And all the hosts within that folder would then inherit those attributes and you can then make exceptions on those attributes on the host itself and how that works you can see here in this diagram you have a folder called the main directory which is added by default by Checkmk and here it has a "Prod" tag and a 'TCP' tag, now if you look down at the network folder the TCP tag is overridden by the "no agent" tag. |
[0:02:10] | And on this host "F" the 'Prod' tag is overridden by a tag called 'test'. So now if you look at host "A" here, you'll see it has a 'Prod' and a 'TCP' tag both inherited by the folder Main Directory. |
[0:02:27] | Host D has a 'Prod' tag and a 'No agent' tag the 'Prod' tag was also inherited by the main directory and the no agent tag is inherited by the folder network. The host F has a 'test' tag which is directly set on the host itself and it has a 'no agent' tag inherited by the folder, 'Network'. |
[0:02:54] | And this is quite a powerful concept especially if you use it in combination with rules. So you could for example define host tags on a folder then configure rules that use those host tags then that rule will be applied to all the hosts within that folder. |
[0:03:11] | You can even attach rules directly to a folder and let me show you how that works. We're now back in a monitoring system that we've built throughout the series So let's go to setup and hosts. You see we have six hosts here. Let's now create a folder we do that by clicking this button 'add folder'. Immediately you can see that there are quite a lot of settings here and I will go over this later in this video. |
[0:03:36] | For now, let's stick to the basic settings and give this first folder a name called Network like in a diagram we saw in the documentation. That's it for now just press Save. And now you see here that there is a folder called Network. |
[0:03:58] | Let's quickly create another one called Servers. Again, save. |
[0:04:07] | So now we have two folders here the next thing we should do is move one of the hosts to these new folders. So for example let's move switch1 to the Network folder. And there are a few ways you can do this, the simplest way is to simply click on this folder icon, and pick the folder that you want to move it to. Now you see this is no longer empty but it has one host and also switch1 has disappeared from this main directory. |
[0:04:40] | Now let's say that we want to move the rest to the folder called Servers. We can do that all at once by selecting them all press this 'x' icon here, now all the rows have been selected and now we just go to 'Hosts' and 'Move to other folder'. Then from this drop-down we can select the folder we want to move to, Servers and press 'Move'. The main directory is now empty what we recommend is that you either add hosts or subfolders to a folder. You can also mix the two but you risk the chance that it all gets a bit confusing and cluttered. |
[0:05:26] | So unless it's really necessary I would advise to exclusively add hosts or subfolders to a folder. When you hover over a folder you see this pencil icon here. If you click on it, you can edit the properties of this folder. |
[0:05:39] | That would be the same as going into the folder and then under folder go to 'Properties'. And here you see all the properties of the folders and you should be able to recognize this because these are the same as you would see on a host. Let's close these sections and go to "My Custom Tags". |
[0:05:58] | Here you see a host deck which we created in the last episode and we could use this to say that every host within this folder gets the application tag called 'Web Server'. |
[0:06:13] | When I would now add a new host to this folder it should immediately get this tag called app:web only when I explicitly set another value for that tag directly on the host it will get that value instead. So let's save that now you see here DB_server3 still has the host tag application:db. If we edit this host you see that it's explicitly defined here so let's remove that. Now you see that it inherits 'Web server' from the folder called Servers. |
[0:06:51] | So we save that, now you see here it has the host-tag, 'application:web'. |
[0:06:59] | When you build this structure the right way then you're going to notice that you don't need many exceptions like this, you can simply let the host inherit the values from the folder. |
[0:07:10] | But of course, you can always override this value on the host itself. What we can do is remove all these attributes that we have explicitly set on all these hosts, of course we can do that by going into each host and uncheck all the boxes but we can also do that for multiple hosts at once. |
[0:07:31] | For example, if I select all of these hosts and then go to 'Hosts' and then 'Remove explicit attribute settings', You see here we can pick attributes that we want to unset on all these hosts. So let's do that for the application and the criticality now save and if we now go into DB_server3 again. |
[0:07:59] | You see here that like previously it's inherited from the servers folder, if I now go look at the criticality under custom attributes you see that now it's the default value and it's the default value because we did not explicitly define a criticality on the folder itself. |
[0:08:21] | The rest works the same as before I can still work with rules as before the only thing that has changed is that some of the values are now inherited from folders when I work with host tags. |
[0:08:33] | There is one new thing namely I can add rules directly to a folder. Let me show you how that works. Let's take a look at some of the rules we have previously created. So if we go to setup and then rule search, we can type in 'cpu util', and then here on our CPU utilization on Linux and Unix, we can find two of the rules that we have created in the previous video. Let's edit one of them. |
[0:09:04] | Here the second line under conditions, here you can specify to which folder this rule should apply. So we could say okay this rule will now only apply to the folder called Servers. |
[0:09:17] | And it will also be applied to all its subfolders if there would be any. And now you can see that this ruleset has been split into two sections. |
[0:09:30] | And here the same inheritance principle applies as to attributes which means that rules placed in subfolders will be applied over rules applied on higher-level folders. |
[0:09:45] | And that's basically how folders work it's a very easy yet very powerful concept when used correctly. It's also a very good way to structure a large number of hosts. And when you set up your rules and folders in an intelligent way, then whenever you add a new host and place it in a correct folder it will automatically inherit all the right attributes. And all the correct rules will be automatically applied to it. Now you might ask yourself what structure should I apply to my setup? |
[0:10:17] | All I can say is that there is no golden rule. But we have noticed that there are three general approaches to it. One would be to organize it per location, another one would be to organize it for technology and a third one would be to organize it for your organization or groups of people. |
[0:10:37] | Now let's say you have a data center in New York, one in London and one here in Munich. You could create a folder for each of them and that would have the advantage with distributed monitoring that you could set per folder from where it should be monitored. When you want to organize it per technology, you could for example create a folder called 'Network' and configure on the folder that all the hosts within should be monitored using SNMP. And if you want to organize it for your organization or groups of people you could for example create a folder called 'DevOps'. |
[0:11:14] | Then on that folder, you can configure the permissions that only that group of people can see and edit the folders or the hosts in that folder and that's it for this series on working with rules and service parameters. I hope this was helpful to you. If it was, please like the video and subscribe to the channel. And for now until the next episode. |
Want to know more about Checkmk? Join us for our Introduction to Checkmk Webinar