标签:exp follow -- conf 情况 chmod evel fun useradd
CentOS/Redhat安装node_exporter注:CentOS/Redhat 5会报kernel太老
node_exporter下载网址:
https://prometheus.io/download/
node_exporter-0.16.0.linux-amd64.tar.gz
我这边以/home示例,请根据实际情况具体调整
CentOS 7:
[Unit]
Description=Prometheus Node Exporter
After=network.target
[Service]
ExecStart=/home/node_exporter/node_exporter
User=nobody
[Install]
WantedBy=multi-user.target
:wq
CentOS 6:
#!/bin/bash
#
Comments to support chkconfig
chkconfig: 2345 98 02
description: prometheus service script
#
Source function library.
. /etc/init.d/functions
Default variables
prog_name="prometheus"
config_file="/space/${prog_name}/${prog_name}.yml"
prog_path="/space/${prog_name}/${prog_name}"
data_path="/space/${prog_name}/data"
pidfile="/var/run/${prog_name}.pid"
prog_logs="/var/log/${prog_name}.log"
options="--web.listen-address=10.29.60.62:9090 --config.file=${config_file} --web.enable-lifecycle --storage.tsdb.path=${data_path}"
DESC="Prometheus Server"
Check if requirements are met
[ -x "${prog_path}" ] || exit 1
RETVAL=0
start(){
action $"Starting $DESC..." su -s /bin/sh -c "nohup $prog_path $options >> $prog_logs 2>&1 &" 2> /dev/null
RETVAL=$?
PID=$(pidof ${prog_path})
[ ! -z "${PID}" ] && echo ${PID} > ${pidfile}
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog_name
return $RETVAL
}
stop(){
echo -n $"Shutting down $prog_name: "
killproc -p ${pidfile}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog_name
return $RETVAL
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status $prog_path
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
:wq
ARGS=""
:wq
标签:exp follow -- conf 情况 chmod evel fun useradd
原文地址:http://blog.51cto.com/yangzhiming/2315709