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 nagios monitors linux client hosts

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

Share

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

This article mainly introduces nagios how to monitor the linux client host, the article is very detailed, has a certain reference value, interested friends must read it!

Nagios monitors linux host

1. Plug-in for client custom monitoring service

Cat / usr/local/nagios/libexec/3.py

#! / usr/bin/env python

# coding=utf-8

Import os,sys

(D1, D2, D3) = os.getloadavg ()

If D1 > = 5.0:

Print "GETLOADAVG CRITICAL: Load average is% .2f"% (D1)

Sys.exit (2)

Elif D1 > = 2.0:

Print "GETLOADAVG WARNING: Load average is% .2f"% (D1)

Sys.exit (1)

Else:

# print "GETLOADAVG OK: Load average is% .2f"% (D1)

Print "load OK

two。 Edit vi / usr/local/nagios/etc/nrpe.cfg add at the bottom

The name in command [check _ py] = / usr/local/nagios/libexec/3.py [check_py] can be freely defined.

3. Then call the NRPE test on the server side

/ libexec/check_nrpe-H 124.193.179.154-c check_py # must be the same as the custom name of the client

4. Add external component nrpe in command.cfg

Vi / usr/local/nagios/etc/objects/commands.cfg

Add

# check nrpe

Define command {

Command_name check_nrpe

Command_line $USER1 $/ check_nrpe-H $HOSTADDRESS$-c $ARG1 $

}

5. Configure the monitored host:

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

Add:

Cfg_file=/usr/local/nagios/etc/objects/hosts.cfg

Cfg_file=/usr/local/nagios/etc/objects/services.cfg

6 Editing the profile

[root@kimsoo ~] # cat / usr/local/nagios/etc/objects/hosts.cfg

Define host {

Use linux-server

Host_name mylinux

Alias mylinux

Address 121.54.175.238

}

[root@kimsoo ~] # cat / usr/local/nagios/etc/objects/services.cfg

Define service {

Use generic-service

Host_name mylinux

Service_description check-load

Check_command check_nrpe!check_load

}

Define service {

Use generic-service

Host_name mylinux

Service_description check-users

Check_command check_nrpe!check_users

}

Define service {

Use generic-service

Host_name mylinux

Service_description check_total_procs

Check_command check_nrpe!check_total_procs

}

7 check the configuration file

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

8. Reload the nagios service

The above is all the contents of the article "how nagios monitors linux client hosts". Thank you for reading! Hope to share the content to help you, more related 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