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

How to install the client-side service in nagios

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

Share

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

This article is about how to install client-side services in nagios. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Client side service installation:

Monitoring methods are casual, but the common ones are as follows

1. Use nagios's own plug-in monitoring, that is, nrpe. The deficiency is that each client needs to be installed. It is recommended to rpmind the compiler package, build the yum source, and execute yum.

2. In snmp mode, the client only needs to open the snmp service. The disadvantage is that the oid of each vendor is different, which brings inconvenience to the development of monitoring scripts. It is recommended to develop an efficient universal agent.

3. Ssh mode, the benefit monitoring script is easy to write, and the lack of frequent execution will add unnecessary burden to the client.

The Client on my side is the same as the server system, and the ip is 192.168.100.186

Useradd-M-s / sbin/nologin nagiostar zxvf nagios-plugins-1.4.16.tar.gzcd nagios-plugins-1.4.16./configure-- with-nagios-user=nagios-- with-nagios-group=nagios-- with-openssl=/usr/bin/openssl-- enable-perl-modules make & & make installcd.. tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12./configure-enable-command-argsmake allmake install-pluginmake install-daemonmake install-daemon-config

First, delete the initial monitoring service. The screenshot below is the configuration during my test.

Centreon-Server host definition

Configuration-"Host -" Centreon-Server. The host inherits the generic-host template and does not need to be modified. It is fine by default.

View template configuration configuration-"Host -" template-"generic-host", which can be modified according to the situation.

Define the host service: first create a check_ping to check host survival command

Configuration-"Command -" added

Add check_ping service

Configuration-"Service -" add-"Service configuration

The defined service inherits the generic-service service template. Configure-"Service -" template-"generic-service"

Configure-"Service -" add-"relationship add Centreon-Server

Effective after saving

Check for correctness and generate configuration: manage-"nagios check all actions -" Export

After waiting for a few minutes, check to see if the service is normal: monitoring-"Services -" all services

Next, we will demonstrate how to monitor the status of the native machine through the nrpe plug-in, first testing whether the configuration is correct.

Test native command: / usr/local/nagios/libexec/check_nrpe-H127.0.0.1

Define the check_nrpe command:

Command name: check_nrpe

Command line: $USER1 $/ check_nrpe-H $HOSTADDRESS$-c $ARG1 $

Add the service templates commonly used in nrpe, demonstrate the monitoring items of nrpe.cfg in turn, modify the nrpe configuration and restart the service:

Vim/usr/local/nagios/etc/nrpe.cfg

Configuration-"Service -" template-"added"

Add check_load

The check_load; passed as a parameter above is actually the name specified by the client configuration file nrpe.conf; the process is that the server executes check_nrpe to make the client execute check_load and returns the result ~

Add check_users

Add check_ disk

Add check_zombie_procs

Add check_total_procs

Ps: why didn't you fill in the time or something on it?

Please look at:

The generic-service we inherited has already been set, and of course you can set it yourself, so that the time you set will take precedence over the inherited properties

Association template: since Centreon-Server inherits the generic-host host template, we associate all the previous service templates in the generic-host template

Next, enter the Centreon-Server host configuration, select "create a template-related service" as yes, and save it.

Check the Centreon-Serve service again, and it has been generated (remember to restart ~ see the previous screenshot)

The client checks the nrpe configuration and launches the server nrpe.cfg consistent with the server side above

Test nrpe on the server side (test whether the two can communicate properly)

Associate all the above nrpe service templates to the Servers-Linux host template to be inherited by the client:

Configuration-"Host -" template-"Servers-Linux"

Add client: configure-"Host -" add

The associated service will be created automatically after completion

Check the generated nagios configuration again:

And restart.

Client now has less monitoring of check_ping host survival than Centreon-Server, so we can directly associate client hosts in the check_ping service.

Reload the configuration:

The basic monitoring of the system is almost complete. If you want to add other monitoring, such as mysql,apache,nginx, there are corresponding monitoring plug-ins, according to the above steps, I believe they can be completed.

If all hosts are created based on templates, the most convenient way is to modify the host templates directly, so that there is no need to modify them one by one. The last experiment was to establish client through the Servers-Linux template. Check the Servers-Linux template:

Configuration-"Host -" template-"Servers-Linux"

After checking it, we find that this template inherits the generic-host template, so we can modify generic-host directly. These configurations are the default templates after installing Centreon, or you can create your own templates based on generic-host.

Configuration-"Host -" template-"generic-host"

This is by modifying the template to turn on the alarm, or you can modify the host you created separately.

The last nrpe service template created is inherited from the generic-service parent template.

Configuration-"Service -" template-"generic-servic"

As above, one or more service alarms for a host can also be modified separately.

The above configured contact I configured cc_cc, this user is installed to fill in, is the alias of admin.

Enter configuration-"user -" admin modification

Mailbox: fill in the receiving alarm mailbox

Page: fill in the mobile phone number, it will be used after configuring SMS alarm.

Email alarm is selected by default for both hosts and services.

Thank you for reading! This is the end of the article on "how to install client services in nagios". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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