夜莺监控

安装

https://flashcat.cloud/download/nightingale/

1
2
3
4
https://download.flashcat.cloud/n9e-v7.0.0-beta.13-linux-amd64.tar.gz

mkdir -p /opt/tools/nightingale
tar -xzvf /home/cs/oss/k8s-1.26/n9e-v7.0.0-beta.13-linux-amd64.tar.gz -C /opt/tools/nightingale/

配置

config.toml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
❯ cat /opt/tools/nightingale/etc/config.toml | grep  -A 15 "\[Redis\]"
[Redis]
# address, ip:port or ip1:port,ip2:port for cluster and sentinel(SentinelAddrs)
Address = "127.0.0.1:6379"
# Username = ""
# Password = ""
# DB = 0
# UseTLS = false
# TLSMinVersion = "1.2"
# standalone cluster sentinel
RedisType = "standalone"
# Mastername for sentinel type
# MasterName = "mymaster"
# SentinelUsername = ""
# SentinelPassword = ""

[Alert]

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
2
3
4
5
6
7
8
9
10
11
12
13
mysql   -P 3305 -u root -p < /opt/tools/nightingale/n9e.sql


MySQL root@localhost:(none)> create user n9e@'%' identified by 'n9e123';
Query OK, 0 rows affected
Time: 0.014s
MySQL root@localhost:(none)> grant all privileges on `n9e_v6`.* to 'n9e'@'%';
Query OK, 0 rows affected
Time: 0.010s
MySQL root@localhost:(none)> flush privileges;
Query OK, 0 rows affected
Time: 0.005s

1
2
3
4
5
6
7
8
9
127.0.0.1:9736> ACL SETUSER cs +@read +@write on allkeys
OK
127.0.0.1:9736> acl setuser cs +ping on allkeys
OK
127.0.0.1:9736> acl list
1) "user cs on sanitize-payload #8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92 ~* resetchannels -@all +@read +@write +ping"
2) "user default on sanitize-payload #bbdac2e00dec531c592e9ee501cc64fde0a4a1795bb164f156982a50a4774170 ~* &* +@all"
3) "user logs on sanitize-payload #bbdac2e00dec531c592e9ee501cc64fde0a4a1795bb164f156982a50a4774170 ~* resetchannels +@all"
127.0.0.1:9736>

启动

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/

点击打赏
文章目录
  1. 1. 安装
  2. 2. 配置
    1. 2.1. config.toml
  3. 3. 启动
载入天数...载入时分秒... ,