Do you want to create a host group in Nagios? We can help you with it.
Adding servers to the host group helps us to group the servers and monitor with ease.
At Bobcares, we often receive requests regarding Nagios as a part of our Server Management Services.
Today, let’s explore more on this error and see how our Support Engineers fix it.
Nagios create a host group
Nagios is an open source monitoring system and we can monitor devices running on Linux and Windows. And, when you have a considerable number of servers, it will be difficult to track. That’s where host group is useful.
To set up a group, we at least need two server hosts.
We can define multiple hostnames as well. However, these should be separated by commas. We can also define the hosts separately.
Let’s discuss how our Support Engineers create a host group and add host servers to it.
How to create a host group?
Recently one of our customers contacted us to create a host group for his 2 servers and set the group name as dbservers.
Now let’s discuss how our Support Engineers create a host group for our customers.
First, we create a hostgroups.cfg using the below command,
vi /usr/local/nagios/etc/objects/hostgroups.cfg
Then we add the following to the hostgroups.cfg.
We give the name of the host in hostgroup_name.
Now we need to add the entry in the Nagios.cfg file. First, we open the file
vi /usr/local/nagios/etc/nagios.cfg
Then we add the below line at the end of the file.
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
Then we add the host to the group. We can add and define each host individually or in a single entry. Thus, we add the entry for both the host individually
define host {
host_name hostname1
alias hostnamealias1
address 1xx.2x.1x.1x
hostgroups dbservers
}
define host {
host_name hostname2
alias hostnamealias2
address 1xx.2x.1x.1x
hostgroups dbservers
}
After adding the service, we finally restart the Nagios using the command
service nagios restart
Once we restart the server, the web interface will display both the servers as a group.
[Need assistance with Nagios – We can help you with it.]
Conclusion
In short, we’ve discussed the host group option in Nagios. Also, we saw how our Support Engineers create a host group and add the host to a group in Nagios.
0 Comments