当前位置:网站首页>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
边栏推荐
- The list set is summed up according to a certain attribute of the object, the maximum value, etc
- ES6深入—async 函数 与 Symbol 类型
- Clock switching with multiple relationship
- 《MongoDB入门教程》第04篇 MongoDB客户端
- CODING DevSecOps 助力金融企业跑出数字加速度
- Is it safe for Guotai Junan to open an account online
- Data communication foundation - routing communication between VLANs
- vulnhub-Root_ this_ box
- 我们为什么要学习数学建模?
- 漫画:什么是分布式事务?
猜你喜欢

Codasip adds verify safe startup function to risc-v processor series

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

研发效能度量指标构成及效能度量方法论

vant tabbar遮挡内容的解决方式
![16.[STM32]从原理开始带你了解DS18B20温度传感器-四位数码管显示温度](/img/9f/c91904b6b1d3a1e85c0b50e43972e5.jpg)
16.[STM32]从原理开始带你了解DS18B20温度传感器-四位数码管显示温度

六种常用事务解决方案,你方唱罢,我登场(没有最好只有更好)

定义严苛标准,英特尔Evo 3.0正在加速PC产业升级

ES6 drill down - Async functions and symbol types
![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

The visual experience has been comprehensively upgraded, and Howell group and Intel Evo 3.0 have jointly accelerated the reform of the PC industry
随机推荐
vant tabbar遮挡内容的解决方式
效果编辑器新版上线!3D渲染、加标注、设置动画,这次一个编辑器就够了
机械臂速成小指南(九):正运动学分析
数据湖(十四):Spark与Iceberg整合查询操作
The OBD deployment mode of oceanbase Community Edition is installed locally
vant popup+其他组件的组合使用,及避坑指南
定义严苛标准,英特尔Evo 3.0正在加速PC产业升级
Data communication foundation smart_ Link_&_ Monitor_ Link
利用GrayLog告警功能实现钉钉群机器人定时工作提醒
This article takes you through the addition, deletion, modification and query of JS processing tree structure data
Write a go program with vscode in one article
一键安装脚本实现快速部署GrayLog Server 4.2.10单机版
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]
Appium automation test foundation - appium basic operation API (II)
Verilog realizes the calculation of the maximum common divisor and the minimum common multiple
Six common transaction solutions, you sing, I come on stage (no best, only better)
18.[STM32]读取DS18B20温度传感器的ROM并实现多点测量温度
Vulnhub-Moneybox
漫画:什么是八皇后问题?
研发效能度量指标构成及效能度量方法论