安装
https://flashcat.cloud/download/nightingale/
1 | https://download.flashcat.cloud/n9e-v7.0.0-beta.13-linux-amd64.tar.gz |
配置
config.toml
1 | ❯ cat /opt/tools/nightingale/etc/config.toml | grep -A 15 "\[Redis\]" |
sed -i ‘/^Address /s/127.0.0.1:6379/k8s.org:9736/‘ /opt/tools/nightingale/etc/config.toml
sed -n ‘/^DSN /s/1234/123456/;s/3306/3305/‘p /opt/tools/nightingale/etc/config.toml
sed -i ‘/^DSN /s/1234/n9e123/;s/root/n9e/;s/127.0.0.1:3306/k8s.org:3305/‘ /opt/tools/nightingale/etc/config.toml
sed -n ‘/^# Username /s/^.*$/Username = cs/‘p /opt/tools/nightingale/etc/config.toml
#等价上面替换
sed -i ‘/^# Username /i \Username = cs\nPassword = 123456’ /opt/tools/nightingale/etc/config.toml
1 | mysql -P 3305 -u root -p < /opt/tools/nightingale/n9e.sql |
1 | 127.0.0.1:9736> ACL SETUSER cs +@read +@write on allkeys |
启动
start.sh
start.sh
#!/bin/bash
[ -n "$(command -v nc)" ] || { echo "需要安装nc" && exit 1 ;}
HOST=
PORT=
vars(){
toml=/opt/tools/nightingale/etc/config.toml
cmd="cat $toml | sed -n '$1'p | tr ':' '\n'"
echo "$cmd"
url=$(eval $cmd)
echo "$url"
HOST=${url[0]}
PORT=${url[1]}
}
check(){
[ -n $2 ] || { echo "没有[prot:$2]参数,检查config.toml文件" && exit 1; }
if nc -zv $1 $2; then
echo "[$3] 服务在端口 $2 上运行正常。"
else
echo "[$3] 服务在端口 $2 上没有响应,退出"
exit 1
fi
}
vars "/^DSN/s/.*(\(.*\)).*/\1/g"
check $HOST $PORT "mysql"
vars '/^Address/s/.*"\(.*\)"$/\1/g'
check $HOST $PORT "redis"
no(){
pid=`ps -ef | grep n9e | grep -v grep | awk '{print $2}'`
echo $pid
}
echo ">>>>n9e<<<<"
case $1 in
start|s)
pid=`no`
[ -z "$pid" ] || { echo "running status $pid。。。" && exit 0; }
echo "start running."
nohup ./n9e &> ./logs/INFO.log &
echo "url: http://localhost:17000/dashboards"
echo "用户是 root,密码是 root.2020"
;;
stop|down|d)
pid=`no`
[ -n "$pid" ] || { echo "没有启动,无需关闭。。。" && exit 0; }
echo "downing ...$pid"
kill -9 $pid
echo "ok ..."
;;
*)
echo "sh $0 [s|sart|d|stop]"
;;
esac
https://flashcat.cloud/docs/content/flashcat-monitor/nightingale-v7/install/binary/