栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux下 node

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux下 node

node-exporter用于监控主机运行状态
本文档附件中提供的演示版本仅支持在 linux_amd64 下运行
文档附件中的0.14.0版本探针支持在redhat5.8下运行

一、上传文件

1、创建/home/jpsoft/exporter/目录用于存放所有需要安装的exporter

mkdir -p /home/jpsoft/exporter/

2、将 node_exporter-0.16.0.linux-amd64.tar.gz 上传到服器 /home/jpsoft/exporter/ 目录并解压,解压命令为:

tar zxvf node_exporter-0.16.0.linux-amd64.tar.gz

3 更改目录名为node_exporter

mv node_exporter-0.16.0.linux-amd64 node_exporter
二、启动

由于服务器系统版本的不同,启动方式也有所区别,请根据实际情况选择。

查询操作系统版本命令:

cat /etc/redhat-release
CentOS 6 下的安装

1、将安装包中的 node_exporter.conf 配置文件复制到 /etc/init 目录下:

mv node_exporter.conf /etc/init

2、修改 node_exporter.conf

vi /etc/init/node_exporter.conf

注:根据文件提示修改启动文件

3、启动node_exporter

initctl start node_exporter

4、如果出现 unknow job node_exporter可通过initctl reload-configuration重新加载配置后再启动。

CentOS 7

1、将安装包中的 node_exporter.service 启动文件复制到 /etc/systemd/system 目录下:

mv node_exporter.service /etc/systemd/system

2、修改 node_exporter.service

vi /etc/systemd/system/node_exporter.service

注:根据文件提示修改启动文件

3、添加到系统服务

systemctl enable node_exporter.service
systemctl daemon-reload

4 启动node_exporter

systemctl start node_exporter
三、验证

通过curl 命令访问 node_exporter curl http://localhost:9100/metrics。

四、开放防火墙端口

查看服务器是否开启防火墙,若服务器防火墙未开则不需要开放端口。
注意:如果防火墙未开启的情况下不得擅自开启防火墙,需咨询客户现场安全策略后再决定。

查看防火请类型,并根据防火墙类型开放端口:
iptables:
vi编辑器打开/etc/sysconfig/iptables文件

vi /etc/sysconfig/iptables
-A INPUT -p tcp -s 192.168.0.161 --dport 9100 -j ACCEPT #对192.168.0.161开启9100端口
service iptables restart #重启防火墙使配置生效

使用 iptables -nL 命令查看配置结果,验证配置。

firewalld 的配置:

#对192.168.0.166开放9100端口
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.0.166" port protocol="tcp" port="9100" accept"
#删除对192.168.0.166开放9100端口
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.0.166" port protocol="tcp" port="9100" accept"
systemctl restart firewalld #重启防火墙使配置生效

使用 iptables -nL 命令,或者使用 firewall-cmd --list-all 命令查看配置结果,验证配置。

在 node_export 的启动过程中,我们使用了 systemd 进行启动和看门狗,来保证即使发生运行期间错误,node_export 也能重新启动继续运行。

有关 systemd 的更多信息,可以点击查看下面的文章:
Systemd 入门教程 。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/831490.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号