当前位置:网站首页>ZABBIX alarm execute remote command
ZABBIX alarm execute remote command
2022-07-01 17:54:00 【Brother Xing plays with the clouds】
daily Zabbix Call the police In the case , Most of them send emails to the police , It's rare in a scene to execute a command after an alarm ( Start the service 、 Clear disk space 、 Shut down The server ); And today I'll talk about what we need to do recently : Execute remote command after alarm
First, let's talk about requirements , A distant day , My friends used mongodb, And it needs to be used vigorously , Some data will be stored in mongodb; Migrate data from the production environment into mongodb, So here comes the question , I often hear people say ,mongodb Hang up when the quantity is large .mongodb Some data is quoted in the program , I hung up sometime during the day , So users 、 Customer service 、 Operation is calling .. The team is also looking for problems , Find the reason , Ask the great God , Upgraded version , But I still hung up .. At present, if you hang up, you are starting .. Friends can't always be with computers , Sometimes I need to flirt with Mei Zhi 、 Go to the high ground . just zabbix There is a remote command function in the action , Then solve the problem through it ..
The whole process of remote command : items -> triggers -> action -> remote commands
The configuration process :
1. Create a mongodb items
Configuration -> Hosts > Items
2. To configure mongodb triggers
Configuration -> Hosts > Triggers
3. Configure remote command actions
Configuraction -> Actions
The condition selection trigger value is PROBLEM、 The trigger is the above mongodb trigger
Execution times are 5 Time , Each interval 60 second
The type of operation is : Remote command
The type is : Custom script
command : Specific instructions . The content will be posted below .
So far, the whole process is finished ,, But now mongodb Hang up ,actions Will execute startup mongodb Orders .? Surely not. .
Remote command prerequisites , You need to enable remote command parameters in the configuration file , And start the agentd.
echo 'EnableRemoteCommands=1' >> /usr/local/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix_agentd restart
# Be careful , Remote commands are not supported in zabbix agentd active Pattern .. Bear in mind ..
The script content :
cat /usr/local/mongodb/start_mongod.sh
#!/bin/bash
/usr/local/mongodb/mongod -f /usr/local/mongodb/mongod.conf >> /tmp/start.log
# Be careful ,zabbix Start the user , You need to be able to execute the above commands , That's what we need sudo Empowerment
So now , It's all done , Summarize the configuration process
1. stay agentd Open... In the configuration file EnableRemoteCommands Parameters
2. To configure actions Inside Remote Comand
3.Commands Script making in
Failure demonstration
kill mongodb
#killall mongod
After the collection time ,zabbix It will put triggers Set as problem, Trigger at the same time actions. The record shows the following
Administration -> Audit -> Actions
If the configuration is correct , that audit There must be a remote commnad Record .
Mistake 1,Audit No record , Check the configuration file 、actions To configure
Mistake 2,Audit Records , but mongodb But not started , There is a problem with the script , debugged ..
I hope this article can help you ,tks. - -
边栏推荐
- Is online stock account opening safe? Is it reliable?
- RadHat搭建内网YUM源服务器
- L'ouverture d'un compte d'actions en ligne est - elle sécurisée? Fiable?
- 提交review时ReviewBoard出现500错误解决方法
- Thinkphp6 - CMS multi wechat management system source code
- 徽商期货是正规期货平台吗?在徽商期货开户安全吗?
- In aks, use secret in CSI driver mount key vault
- New patent applications and transfers
- Vulnhub range hacker_ Kid-v1.0.1
- Vulnhub range hacksudo Thor
猜你喜欢
多线程使用不当导致的 OOM
New 95 community system whole station source code
Petrv2: a unified framework for 3D perception of multi camera images
An example of data analysis of an old swatch and an old hard disk disassembly and assembly combined with the sensor of an electromagnetic press
PETRv2:一个多摄像头图像3D感知的统一框架
In aks, use secret in CSI driver mount key vault
ISO 27001 Information Security Management System Certification
ACL 2022 | decomposed meta learning small sample named entity recognition
(16) ADC conversion experiment
Penetration practice vulnhub range Tornado
随机推荐
Is it reasonable and safe to open a securities account for 10000 shares free of charge? How to say
Detailed explanation of string's trim() and substring()
Technical secrets of ByteDance data platform: implementation and optimization of complex query based on Clickhouse
Research Report on China's enzyme Market Forecast and investment strategy (2022 Edition)
Thinkphp6 - CMS multi wechat management system source code
PHP实现敏感词过滤系统「建议收藏」
Htt [ripro network disk link detection plug-in] currently supports four common network disks
How to write good code - Defensive Programming Guide
js如何将带有分割符的字符串转化成一个n维数组
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes
Zabbix报警执行远程命令
Heavy disclosure! Hundreds of important information systems have been invaded, and the host has become a key attack target
Three dimensional anti-terrorism Simulation Drill deduction training system software
网上股票开户安全吗?是否可靠?
網上股票開戶安全嗎?是否可靠?
线上开通ETF基金账户安全吗?有哪些步骤?
Fresh, 2022 advanced Android interview must know 100 questions (interview questions + answer analysis)
MySQL -- explain performance optimization
Glidefast consulting was selected as the elite partner of servicenow in 2022
Penetration practice vulnhub range Tornado