如何在OpenHPC xCAT无盘集群计算节点安装NRPE并持久生效?
在xCAT无盘集群镜像中预装NRPE的步骤
1. 定位计算节点的OS镜像chroot路径
xCAT的无盘节点镜像默认存放在/opt/xcat/images/目录下,找到对应计算节点的镜像目录,进入其rootfs路径,示例:
cd /opt/xcat/images/rhel8-compute/rootfs
若不确定镜像名称,可通过以下命令查询所有可用镜像:
lsdef -t osimage
2. 在chroot环境中安装NRPE
根据计算节点的操作系统类型,选择对应的安装流程:
针对RHEL/CentOS系列系统
先挂载必要的系统目录,避免chroot后命令执行异常:
mount -t proc proc ./proc mount -t sysfs sys ./sys mount -o bind /dev ./dev
进入chroot环境安装NRPE及配套监控插件:
chroot . /bin/bash yum install -y nrpe nagios-plugins-all
安装完成后退出chroot:
exit
卸载临时挂载的目录:
umount ./proc ./sys ./dev
针对Ubuntu/Debian系列系统
同样先挂载必要目录:
mount -t proc proc ./proc mount -t sysfs sys ./sys mount -o bind /dev ./dev mount -o bind /dev/pts ./dev/pts
进入chroot环境安装:
chroot . /bin/bash apt update && apt install -y nrpe nagios-plugins
退出后卸载挂载:
exit umount ./dev/pts ./proc ./sys ./dev
3. 配置NRPE(必要步骤)
直接编辑chroot路径下的NRPE配置文件./etc/nagios/nrpe.cfg:
- 修改
allowed_hosts参数,添加xCAT管理节点的IP地址,示例:allowed_hosts=127.0.0.1,192.168.1.100 - 根据监控需求添加自定义命令,示例:
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
4. 更新镜像并重启计算节点
将修改后的镜像重新同步(针对stateless镜像):
genimage -u <镜像名称>
重启计算节点,使其加载更新后的镜像:
rpower <计算节点名称/IP范围> restart
5. 验证安装结果
在管理节点上使用check_nrpe命令测试连接:
/usr/lib64/nagios/plugins/check_nrpe -H <计算节点IP>
若返回类似NRPE v4.0.3的版本信息,说明NRPE已成功预装并运行。
内容的提问来源于stack exchange,提问作者Gopi Krishna
相关产品推荐
相关产品推荐

