工作记录
今天是2021年8月6日,星期五,线上办公第四天
今天刚刚做完第二轮核酸检测,疫情当下,大家还是要带好口罩😷
任务清单
今天咋说呢,任务不多,但是绝对有难度,而且后面的几天肯定会围着这个问题转了,这任务是我接手监控系统后的又一个公司项目:
- 本地shell脚本实现远程节点的监控
- 结合飞书群聊机器人实现Prometheus+Webhook的报警系统
任务记录
任务一:本地shell脚本实现远程节点的监控
任务一很简单,会写shell脚本的同学都能实现,在这记录一下我的脚本:
#!/bin/bash
cd /opt/homebrew/etc
nohup prometheus --config.file prometheus.yml > monitor_log &
echo "localhost prometheus is running!"
cd ~/grafana-8.0.6/bin
nohup ./grafana-server web > grafana_log &
echo "localhost grafana is running"
cd ~
ssh -Tq root@xx.xx.xx.xx << remotessh
cd ~
cd mashnet-node-develop/target/release/
nohup ./mashnet-node --dev --tmp > node_log 2>&1 &
echo "target node is running!"
cd ~
cd prometheus-2.28.1.linux-amd64/
nohup ./prometheus --config.file prometheus.yml > prometheus_log 2>&1 &
echo "target prometheus is running!"
cd ~
exit
remotessh
echo "exit from the remote server!"
记录一下今天发现的几个好文章:
这篇文章讲到了重定向,特别是
2>&1
与/dev/null
:Linux shell 命令中nohup 、&、重定向的使用
有关ssh命令的文章:ssh Linux命令 在线中文手册
结合飞书群聊机器人实现Prometheus+Webhook的报警系统
这才是今天的重点呀!!
公司的新项目,让我这个从头学起的运维实习生多少有点懵逼🌚🌝
找了一下午与一晚上的配置方法,官方文档也看了很长时间,到现在也就只有一个思路,先简单记录一下:
对于飞书而言,其实和钉钉一样,都是基于Prometheus与webhook开发的,不如明天先把配置钉钉的方法搞明白,再慢慢研究飞书的报警系统
总结
今天日志内容不多,下午刚刚接手新项目,先给明天插个小旗,明天从这个思路开干👊🏼
今天先到这里,眼实在是疼😭
明天加油,奥利给🤠✊🏼