当前位置:网站首页>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
边栏推荐
- 记一次'非常诡异'的云安全组规则问题排查过程
- RepLKNet:不是大卷积不好,而是卷积不够大,31x31卷积了解一下 | CVPR 2022
- How difficult is it to pass the certification of Intel Evo 3.0? Yilian technology tells you
- MySQL overview
- vulnhub-FirstBlood
- vulnhub-Root_ this_ box
- Convert obj set to entity set
- wyt 。。
- SQL injection sqllabs (basic challenges) 11-20
- Is it safe for Guotai Junan to open an account online
猜你喜欢

Example project: simple hexapod Walker

obj集合转为实体集合

Convert obj set to entity set

ES6 drill down - Async functions and symbol types

Data communication foundation NAT network address translation

Information collection of penetration test

视觉体验全面升级,豪威集团与英特尔Evo 3.0共同加速PC产业变革

Mistakes made when writing unit tests

Data communication foundation smart_ Link_&_ Monitor_ Link

定义严苛标准,英特尔Evo 3.0正在加速PC产业升级
随机推荐
ES6深入—ES6 Generator 函数
项目sql中批量update的时候参数类型设置错误
写单元测试的时候犯的错
利用GrayLog告警功能实现钉钉群机器人定时工作提醒
《MongoDB入门教程》第04篇 MongoDB客户端
EDI许可证和ICP经营性证有什么区别
开发中Boolean类型使用遇到的坑
Quick completion guide for manipulator (IX): forward kinematics analysis
Boost the development of digital economy and consolidate the base of digital talents - the digital talent competition was successfully held in Kunming
【毕业季】作为一名大二计科在校生,我有话想说
Research and development efficiency measurement index composition and efficiency measurement methodology
通过的英特尔Evo 3.0整机认证到底有多难?忆联科技告诉你
16.[STM32]从原理开始带你了解DS18B20温度传感器-四位数码管显示温度
Basic JSON operations of MySQL 5.7
后台系统发送验证码功能
Intel 13th generation Raptor Lake processor information exposure: more cores, larger cache
Appium automation test foundation - appium basic operation API (I)
[graduation season] as a sophomore majoring in planning, I have something to say
Coding devsecops helps financial enterprises run out of digital acceleration
Research and practice of super-resolution technology in the field of real-time audio and video