当前位置:网站首页>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
边栏推荐
- Data communication foundation - route republication
- 《MongoDB入门教程》第04篇 MongoDB客户端
- Coding devsecops helps financial enterprises run out of digital acceleration
- 超分辨率技术在实时音视频领域的研究与实践
- Arduino控制微小的六足3D打印机器人
- 项目sql中批量update的时候参数类型设置错误
- Cartoon: what is the eight queens problem?
- 漫画:什么是MapReduce?
- Noi / 1.5 06: element maximum span value of integer sequence
- Vulnhub-Moneybox
猜你喜欢

Write a go program with vscode in one article
![17.[STM32]仅用三根线带你驱动LCD1602液晶](/img/c6/b56c54da2553a451b526179f8b5867.png)
17.[STM32]仅用三根线带你驱动LCD1602液晶

抽象类和接口的区别

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

【 note 】 résoudre l'erreur de code IDE golang

Convert obj set to entity set
![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

vlunhub- BoredHackerBlog Social Network

Batch update in the project

【簡記】解决IDE golang 代碼飄紅報錯
随机推荐
Arduino controls a tiny hexapod 3D printing robot
18.[stm32] read the ROM of DS18B20 temperature sensor and realize multi-point temperature measurement
求解汉诺塔问题【修改版】
写单元测试的时候犯的错
16. [stm32] starting from the principle, I will show you the DS18B20 temperature sensor - four digit digital tube displays the temperature
一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度
Intelligent metal detector based on openharmony
漫画:什么是MapReduce?
The difference between abstract classes and interfaces
Obj resolves to a set
[brief notes] solve the problem of IDE golang code red and error reporting
五种常见的咨询公司谈判策略以及如何维护自己的利益
Go language programming specification combing summary
Fundamentals of data communication - Principles of IP routing
DataArts Studio数据架构——数据标准介绍
vulnhub-FirstBlood
Noi / 1.4 07: collect bottle caps to win awards
具有倍数关系的时钟切换
The computer is busy, and the update is a little slow