Prometheus 官网下载地址
包含Prometheus软件及各种exporter插件
node_exporter1.4.0安装包
tar -xvf node_exporter-1.4.0.linux-amd64.tar.gz
可参考
linux 自定义服务
vi /etc/init.d/promethues
#!/bin/bash
#Create by:zhangyongze
#为什么不问问神奇的海螺呢丶
# chkconfig: 2345 55 25
# description: Prometheus exporter for hardware and OS metrics
#RETVAL=0
PROG="node_exporter"
EXEC="/monitor/node_exporter-1.4.0.linux-amd64/node_exporter"
LOCKFILE="/var/lock/subsys/$PROG"
OPTIONS="--web.listen-address=:9100"# Source function library.
if [ -f /etc/rc.d/init.d/functions ]; then. /etc/rc.d/init.d/functions
elseecho "/etc/rc.d/init.d/functions does not exist"exit 0
fistart() {if [ -f $LOCKFILE ]thenecho "$PROG is already running!"elseecho -n "Starting $PROG: "nohup $EXEC $OPTIONS >/dev/null 2>&1 &RETVAL=$?[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failureechoreturn $RETVALfi
}stop() {echo -n "Stopping $PROG: "killproc $EXECRETVAL=$?[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failureecho
}restart ()
{stopsleep 1start
}case "$1" instart)start;;stop)stop;;status)status $PROG;;restart)restart;;*)echo "Usage: $0 {start|stop|restart|status}"exit 1
esac
exit $RETVAL
修改执行权限
chmod 775 /etc/init.d/node_exporter
设置chkconfig 管理服务
根据服务文件中 # chkconfig: 2345 55 25 设置启动级别
chkconfig --add node_exporter
检查现有服务启动级别
chkconfig --list
运行node_exporter服务
service node_exporterstart
浏览器访问 服务器地址+端口号(服务中配置的)
例如 http://192.168.1.21:9100/
Metrics可查看所有指标数据
上一篇:【知识梳理】Go语言核心编程
下一篇:webpack5从入门到精通