当前位置:网站首页>Using graylog alarm function to realize the regular work reminder of nail group robots
Using graylog alarm function to realize the regular work reminder of nail group robots
2022-07-05 16:10:00 【yuanfan2012】
utilize GrayLog The alarm function realizes the regular work reminder of the nail group robots
1、GrayLog Create a new Syslog Input
Used to receive Linux Server system log
( Click to enlarge the picture )
It is suggested to build a Indice
( Click to enlarge the picture )
And configure a separate Stream
( Click to enlarge the picture )
( Click to enlarge the picture )
( Click to enlarge the picture )
In the firewall Input Port discharge
[[email protected] opt]# firewall-cmd --permanent --zone=public --add-port=2514/udp
success
[[email protected] opt]# firewall-cmd --reload
success2、Linux The server system log is accessed to GrayLog
This is just for convenience , Direct use Graylog Act on your own Linux Server log source
[[email protected] opt]# echo "*.* @192.168.31.127:2514;RSYSLOG_SyslogProtocol23Format" >> /etc/rsyslog.conf
[[email protected] opt]#
[[email protected] opt]# tail -n 4 /etc/rsyslog.conf
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
#*.* @@remote-host:514
# ### end of the forwarding rule ###
*.* @192.168.31.127:2514;RSYSLOG_SyslogProtocol23Format
[[email protected] opt]#
[[email protected] opt]# systemctl restart rsyslog
( Click to enlarge the picture )
3、 Check whether the log queries normally
You can see that the log is normally accessed
( Click to enlarge the picture )
4、 Write scripts to write system logs regularly and Crontab Timing task
vi replace_username.sh
#!/bin/bash
temp_day=`date +%a`
case $temp_day in
Mon)
echo " Today's duty reminder @ Zhang San A" > /etc/work_alert.txt;
;;
Tue)
echo " Today's duty reminder @ Li Si B" > /etc/work_alert.txt;
;;
Wed)
echo " Today's duty reminder @ Wang Wu C" > /etc/work_alert.txt;
;;
Thu)
echo " Today's duty reminder @ Yuan fan ( Xingyun ) " > /etc/work_alert.txt;
;;
Fri)
echo " Today's duty reminder @ Yuan fan " > /etc/work_alert.txt;
;;
Sat)
echo " Today's duty reminder @ Zhang San F" > /etc/work_alert.txt;
;;
Sun)
echo " Today's duty reminder @ Zhang San G" > /etc/work_alert.txt;
;;
*)
exit;
esac
Configure scheduled tasks for this month
crontab -e
1 0 1,2,6,7,8,9,10,13,14,15,16,17,20,21,22,23,24,27,28,29,30 * * /opt/replace_username.sh
00 17 1,2,6,7,8,9,10,13,14,15,16,17,20,21,22,23,24,27,28,29,30 * * /usr/bin/logger -f /etc/work_alert.txt
That is to say 6 The working day of the month
1、 Every day 0 spot 1 Automatic replacement /etc/work_alert.txt In file @ Name of person , The relevant weekly and daily shifts are for different personnel
2、 Every day 17 Execute at point logger -f The command is written to the system log
( Click to enlarge the picture )
5、 To configure Alert Alarm template
( Click to enlarge the picture )
( Click to enlarge the picture )
( Click to enlarge the picture )
Search Query " Today's duty reminder " Search within the last You can write 5 Minutes or less 3 minute
Execute search every Suggestions follow Search within the last Set the same time
( Click to enlarge the picture )
( Click to enlarge the picture )
PrometheusAlert Please configure the alarm template on
The following screenshots
( Click to enlarge the picture )
6、 Manually trigger the log and test the alarm
[[email protected] opt]# /usr/bin/logger -f /etc/work_alert.txt
[[email protected] opt]# date
Thu Jun 9 23:21:51 CST 2022
[[email protected] opt]# cat /etc/work_alert.txt
( Click to enlarge the picture )
( Click to enlarge the picture )
( Click to enlarge the picture )
wait for 5 Minutes to observe whether the alarm can be received
( Click to enlarge the picture )
7、Tips
1) Theoretically crontab If there is no problem with the scheduled task script , The alarm will be sent normally
2)PrometheusAlert close @ All the people And alarm notification Title Modification
( Click to enlarge the picture )
( Click to enlarge the picture )
3) explain : Now find @ Someone's function failed
Still to be studied , Need to rewrite replace_username.sh Script
边栏推荐
- verilog实现计算最大公约数和最小公倍数
- Intelligent metal detector based on openharmony
- The database of the server is not connected to 200310060 "unknown error" [the service is up, the firewall is off, the port is on, and the netlent port is not connected]
- Cs231n notes (top) - applicable to 0 Foundation
- Five common negotiation strategies of consulting companies and how to safeguard their own interests
- SQL injection sqllabs (basic challenges) 1-10
- 20.[STM32]利用超声波模块和舵机实现智能垃圾桶功能
- Virtual base class (a little difficult)
- [graduation season] as a sophomore majoring in planning, I have something to say
- Codasip为RISC-V处理器系列增加Veridify安全启动功能
猜你喜欢

list去重并统计个数

Mistakes made when writing unit tests

vant tabbar遮挡内容的解决方式

Data communication foundation OSPF Foundation

sql中set标签的使用
![[Netease Yunxin] research and practice of super-resolution technology in the field of real-time audio and video](/img/69/3aedcdafb2b4e83087dc1ce593dc38.png)
[Netease Yunxin] research and practice of super-resolution technology in the field of real-time audio and video

Research and practice of super-resolution technology in the field of real-time audio and video

Data communication foundation - Ethernet port mirroring and link aggregation
![18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度](/img/e7/4f682814ae899917c8ee981c05edb8.jpg)
18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度

Codasip adds verify safe startup function to risc-v processor series
随机推荐
视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革
后台系统发送验证码功能
迁移/home分区
Six common transaction solutions, you sing, I come on stage (no best, only better)
I'm fat, huh
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
漫画:什么是服务熔断?
Data communication foundation - routing communication between VLANs
机械臂速成小指南(九):正运动学分析
list去重并统计个数
Query the latest record in SQL
The visual experience has been comprehensively upgraded, and Howell group and Intel Evo 3.0 have jointly accelerated the reform of the PC industry
The difference between abstract classes and interfaces
Intelligent metal detector based on openharmony
六种常用事务解决方案,你方唱罢,我登场(没有最好只有更好)
Codasip adds verify safe startup function to risc-v processor series
CODING DevSecOps 助力金融企业跑出数字加速度
EDI许可证和ICP经营性证有什么区别
Obj resolves to a set
20. [stm32] realize the function of intelligent garbage can by using ultrasonic module and steering gear