• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

yxchun

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

CentOS 将node_exporter加入到开机自启

1、创建node_exporter.service文件,内容如下,ExecStart是node_exporter放置的路径

[Unit]
Description=Node Exporter
After=network.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/opt/node_exporter

[Install]
WantedBy=multi-user.target

2、将node_exporter.service文件放到/etc/systemd/system

3、重载 Systemd 并启动服务

# 重载 Systemd 配置
sudo systemctl daemon-reload

# 启动服务
sudo systemctl start node_exporter

# 设置开机自启
sudo systemctl enable node_exporter

# 验证服务状态
sudo systemctl status node_exporter

正常输出应显示 active (running);

 

posted on 2025-07-04 15:12  yxchun  阅读(74)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3