监控软件nagios之添加Linux主机

简介:

nagios监控windows和linux主机示意图:

wKiom1YweoTDy8pZAAH2FnORSwA486.jpg

1.首先要确定nagios监控软件在服务器端安装

wKiom1UbsOzjKJeBAAR2k-QP5TY349.jpg

 

2.在监控端要安装nrpe插件

[root@tong1 ~]# yum install xinetd openssl openssl-devel -y

[root@tong1 ~]# wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

[root@tong1 ~]# tar xvf nrpe-2.15.tar.gz

[root@tong1 ~]# cd /root/nrpe-2.15

[root@tong1 nrpe-2.15]# ./configure  --prefix=/usr/local/nagios-plugins-2.0.3/

[root@tong1 nrpe-2.15]# make all

[root@tong1 nrpe-2.15]# make install-plugin

[root@tong1 nrpe-2.15]# ll /usr/local/nagios-4.0.8/libexec/check_nrpe 
-rwxrwxr-x. 1 nagios nagios 76769 Apr  1 17:35 /usr/local/nagios-4.0.8/libexec/check_nrpe
[root@tong1 nrpe-2.15]#

 

3.在Linux被控端安装客户端软件(nagios-plugins和nrpe)

[root@tong2 ~]# yum install openssl openssl-devel xinetd -y

[root@tong2 ~]# groupadd  -g 500 nagios

[root@tong2 ~]# useradd  -r -s /sbin/nologin -u 500 -g nagios nagios

[root@tong2 ~]# wget http://nagios-plugins.org/download/nagios-plugins-2.0.3.tar.gz

[root@tong2 ~]# wget http://liquidtelecom.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz

[root@tong2 ~]# tar xvf nagios-plugins-2.0.3.tar.gz

[root@tong2 ~]# tar xvf nrpe-2.15.tar.gz

[root@tong2 ~]# cd nagios-plugins-2.0.3

[root@tong2 nagios-plugins-2.0.3]# ./configure --prefix=/usr/local/nagios-plugins-2.0.3 --with-nagios-user=nagios --with-nagios-group=nagios

[root@tong2 nagios-plugins-2.0.3]# make && make install

[root@tong2 nagios-plugins-2.0.3]# cd /usr/local/

[root@tong2 local]# chown  -R nagios:nagios nagios-plugins-2.0.3/

[root@tong2 local]# cd /root/nrpe-2.15

[root@tong2 nrpe-2.15]# ./configure  --prefix=/usr/local/nagios-plugins-2.0.3/

[root@tong2 nrpe-2.15]# make all

[root@tong2 nrpe-2.15]# make install-plugin

[root@tong2 nrpe-2.15]# make install-daemon

[root@tong2 nrpe-2.15]# make install-daemon-config

[root@tong2 nrpe-2.15]# make install-xinetd

[root@tong2 nrpe-2.15]# ll /usr/local/nagios-plugins-2.0.3/
total 20
drwxrwxr-x. 2 nagios nagios 4096 Apr  1 17:18 bin
drwxrwxr-x. 2 nagios nagios 4096 Apr  1 17:18 etc
drwxr-xr-x. 2 nagios nagios 4096 Apr  1 17:10 include
drwxrwxr-x. 2 nagios nagios 4096 Apr  1 17:18 libexec
drwxr-xr-x. 3 nagios nagios 4096 Apr  1 17:10 share

[root@tong2 nrpe-2.15]# vim /etc/xinetd.d/nrpe

only_from       = 127.0.0.1 192.168.1.247             --添加监控服务器端地址

[root@tong2 nrpe-2.15]# vim /usr/local/nagios-plugins-2.0.3/etc/nrpe.cfg

allowed_hosts=127.0.0.1,192.168.1.247              --添加监控服务器主机的IP地址

[root@tong2 nrpe-2.15]# vim /etc/services

nrpe            5666/tcp                # nrpe            --添加服务器监听端口

[root@tong2 nrpe-2.15]# /etc/init.d/xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
[root@tong2 nrpe-2.15]# netstat -antup | grep 5666
tcp        0      0 :::5666                     :::*                        LISTEN      32747/xinetd        
[root@tong2 nrpe-2.15]# /usr/local/nagios-plugins-2.0.3/libexec/check_nrpe -H localhost
NRPE v2.15
[root@tong2 nrpe-2.15]#

 

3.在监控端测试连接被控端,添加被控端主机

[root@tong1 nrpe-2.15]# /usr/local/nagios-4.0.8/libexec/check_nrpe -H 192.168.1.248
NRPE v2.15

[root@tong1 etc]# cd /usr/local/nagios-4.0.8/etc/objects/

[root@tong1 objects]# cp -a templates.cfg  tong2.cfg
[root@tong1 objects]# vim tong2.cfg

 










本文转自 z597011036 51CTO博客,原文链接:http://blog.51cto.com/tongcheng/1627424,如需转载请自行联系原作者
目录
相关文章
|
3月前
|
安全 Ubuntu Linux
Linux系统中的软件管理工具主
Linux系统中的软件管理工具主
67 7
|
27天前
|
Prometheus 监控 Cloud Native
Prometheus+Grafana监控Linux主机
通过本文的步骤,我们成功地在 Linux 主机上使用 Prometheus 和 Grafana 进行了监控配置。具体包括安装 Prometheus 和 Node Exporter,配置 Grafana 数据源,并导入预设的仪表盘来展示监控数据。通过这种方式,可以轻松实现对 Linux 主机的系统指标监控,帮助及时发现和处理潜在问题。
139 7
|
1月前
|
Prometheus 运维 监控
Prometheus+Grafana+NodeExporter:构建出色的Linux监控解决方案,让你的运维更轻松
本文介绍如何使用 Prometheus + Grafana + Node Exporter 搭建 Linux 主机监控系统。Prometheus 负责收集和存储指标数据,Grafana 用于可视化展示,Node Exporter 则采集主机的性能数据。通过 Docker 容器化部署,简化安装配置过程。完成安装后,配置 Prometheus 抓取节点数据,并在 Grafana 中添加数据源及导入仪表盘模板,实现对 Linux 主机的全面监控。整个过程简单易行,帮助运维人员轻松掌握系统状态。
224 3
|
3月前
|
Web App开发 监控 Linux
在Linux上,有许多软件可以下载和安装
在Linux上,有许多软件可以下载和安装
150 67
|
3月前
|
存储 关系型数据库 Linux
2024 年 16 个适用于 Linux 的开源云存储软件 (上)
2024 年 16 个适用于 Linux 的开源云存储软件 (上)
215 2
2024 年 16 个适用于 Linux 的开源云存储软件 (上)
|
3月前
|
存储 安全 Unix
2024 年 16 个适用于 Linux 的开源云存储软件 (下)
2024 年 16 个适用于 Linux 的开源云存储软件 (下)
90 0
2024 年 16 个适用于 Linux 的开源云存储软件 (下)
|
3月前
|
Linux 网络安全
Linux虚拟机与主机和Xshell的连接问题解决
Linux虚拟机与主机和Xshell的连接问题解决
136 1
|
2月前
|
Linux
Linux - 如何编译源码安装软件
源码编译安装通常包括三个步骤:1) `./configure` 检测平台特征和依赖项,生成 Makefile;2) `make` 编译源码,生成可执行文件;3) `make install` 将可执行文件安装到指定目录并配置环境变量。
92 0
|
3月前
|
监控 安全 Linux
使用NRPE和Nagios监控Linux系统资源的方法
通过遵循以上步骤,可以有效地使用NRPE和Nagios监控Linux系统资源,确保系统运行稳定,并及时响应任何潜在的问题。这种方法提供了高度的可定制性和灵活性,适用于从小型环境到大型分布式系统的各种监控需求。
74 2
|
监控 Linux 开发工具