当前位置:网站首页>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
边栏推荐
- 力扣今日题-729. 我的日程安排表 I
- list集合根据对象某属性求和,最大值等
- 英特尔第13代Raptor Lake处理器信息曝光:更多核心 更大缓存
- 写单元测试的时候犯的错
- 18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
- Memo 00
- MySQL overview
- 17. [stm32] use only three wires to drive LCD1602 LCD
- Appium automation test foundation - appium basic operation API (I)
- The visual experience has been comprehensively upgraded, and Howell group and Intel Evo 3.0 have jointly accelerated the reform of the PC industry
猜你喜欢

Appium automation test foundation - appium basic operation API (I)

Write a go program with vscode in one article

项目中批量update
![19.[STM32]HC_SR04超声波测距_定时器方式(OLED显示)](/img/fe/8f59db28823290da8e9280df06673d.jpg)
19.[STM32]HC_SR04超声波测距_定时器方式(OLED显示)

降本40%!Redis多租户集群的容器化实践

基于OpenHarmony的智能金属探测器

CISP-PTE之PHP伪协议总结

verilog实现计算最大公约数和最小公倍数

超分辨率技术在实时音视频领域的研究与实践
![18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement](/img/e7/4f682814ae899917c8ee981c05edb8.jpg)
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
随机推荐
Query the latest record in SQL
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
CISP-PTE之SQL注入(二次注入的应用)
Boost the development of digital economy and consolidate the base of digital talents - the digital talent competition was successfully held in Kunming
【 note 】 résoudre l'erreur de code IDE golang
20.[STM32]利用超声波模块和舵机实现智能垃圾桶功能
移动办公时如何使用frp内网穿透+teamviewer方式快速连入家中内网主机
Li Kou today's question -729 My schedule I
Data communication foundation smart_ Link_&_ Monitor_ Link
17. [stm32] use only three wires to drive LCD1602 LCD
Data communication foundation - Ethernet port mirroring and link aggregation
异常com.alibaba.fastjson.JSONException: not match : - =
Data communication foundation NAT network address translation
国泰君安网上开户安全吗
20. [stm32] realize the function of intelligent garbage can by using ultrasonic module and steering gear
《MongoDB入门教程》第04篇 MongoDB客户端
Replknet: it's not that large convolution is bad, but that convolution is not large enough. 31x31 convolution. Let's have a look at | CVPR 2022
vant popup+其他组件的组合使用,及避坑指南
Dataarts studio data architecture - Introduction to data standards
Find the root of the following equation by chord cutting method, f (x) =x^3-5x^2+16x-80=0