linux

    mkdir -p /usr/local/node_exporter
    cd /usr/local/node_exporter
    wget https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-amd64.tar.gz
    tar zxvf node_exporter-0.18.1.linux-amd64.tar.gz
    cd node_exporter-0.18.1.linux-amd64
    cp node_exporter /usr/local/node_exporter/node_exporter

    创建systemd服务

    cat > /usr/lib/systemd/system/node_exporter.service <<EOF
    [Unit]
    Description=node_exporter
    After=network.target

    [Service]
    Type=simple
    User=root
    ExecStart=/usr/local/node_exporter/node_exporter
    Restart=on-failure

    [Install]
    WantedBy=multi-user.target
    EOF

    启动node_exporter

    systemctl daemon-reload
    systemctl start node_exporter
    systemctl status node_exporter
    systemctl enable node_exporter

    Dependencies: