Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Define A Host Group

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you the "sample analysis of Define A Host Group", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "sample Analysis of Define A Host Group".

View existing configuration:

# cd / etc/nagios/objects/

# ls

Analog_system.cfg contacts.cfg localhost.cfg OpenKM.cfg switch.cfg

Commands.cfg printer.cfg templates.cfg windows.cfg timeperiods.cfg

# cat Analog_system.cfg | grep-A 5 host {

Define host {

Use linux-server,host-pnp

Host_name Analog_system

Alias Analog_system

Address 192.168.60.11

}

# cat OpenKM.cfg | grep-A 5 host {

Define host {

Use linux-server,host-pnp

Host_name OpenKM

Alias OpenKM

Address 192.168.60.5

}

# cat localhost.cfg | grep-A 9 host {

Define host {

Use linux-server,host-pnp

Host_name Monitor

Alias Monitor

Address 127.0.0.1

}

Built Category and mobile file:

# cd / etc/nagios/

# mkdir Linuxhosts

# mkdir Switches

# mv objects/switch.cfg Switches/

# mv objects/Analog_system.cfg Linuxhosts/

# mv objects/OpenKM.cfg Linuxhosts/

# mv objects/localhost.cfg Linuxhosts/

# chown-R nagios:nagios Switches/

# chown-R nagios:nagios Linuxhosts/

Configuring Host Groups file:

# cd hostgroups/

# vi hostgroup.cfg

Define hostgroup {

Hostgroup_name linux-hosts; The name of the hostgroup

Alias Linux-hosts; Long name of the group

Members Monitor,OpenKM,Analog_system; Comma separated list of hosts that belong to this group

}

# chown-R nagios:nagios.. / hostgroups/

View the main configuration file:

# cat.. / nagios.cfg | grep-v'#'| grep cfg_file

Cfg_file=/etc/nagios/objects/commands.cfg

Cfg_file=/etc/nagios/objects/contacts.cfg

Cfg_file=/etc/nagios/objects/timeperiods.cfg

Cfg_file=/etc/nagios/objects/templates.cfg

Cfg_file=/etc/nagios/objects/localhost.cfg

Cfg_file=/etc/nagios/objects/OpenKM.cfg

Cfg_file=/etc/nagios/objects/Analog_system.cfg

Cfg_file=/etc/nagios/objects/switch.cfg

Modify the main configuration file:

# vi.. / nagios.cfg

# cfg_file=/etc/nagios/objects/localhost.cfg

# cfg_file=/etc/nagios/objects/OpenKM.cfg

# cfg_file=/etc/nagios/objects/Analog_system.cfg

# cfg_file=/etc/nagios/objects/switch.cfg

# Add by Kingcraft

Cfg_dir=/etc/nagios/hostgroups

Cfg_dir=/etc/nagios/Linuxhosts

Cfg_dir=/etc/nagios/Switches

Check the syntax and restart:

# / usr/local/nagios/bin/nagios-v / etc/nagios/nagios.cfg

# service nagios restart

The above is all the content of this article "sample Analysis of Define A Host Group". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report