当前位置:网站首页>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. - -
边栏推荐
- How to use JMeter function and mockjs function in metersphere interface test
- 剑指 Offer 20. 表示数值的字符串
- Source code of new campus errand / campus task platform on mutual station
- About selenium element positioning being overwritten
- Development cost of smart factory management system software platform
- Debiasing word embeddings | talking about word embedding and deviation removal # yyds dry goods inventory #
- Euler function: find the number of numbers less than or equal to N and coprime with n
- Is the software of futures pioneer formal and safe? Which futures company is safer to choose?
- 多线程使用不当导致的 OOM
- Is it reasonable and safe to open a securities account for 10000 shares free of charge? How to say
猜你喜欢
![[PHP foundation] realize the connection between PHP and SQL database](/img/eb/c8953eddfe3b19b0adb5529957d275.jpg)
[PHP foundation] realize the connection between PHP and SQL database

New 95 community system whole station source code

Penetration practice vulnhub range Tornado

Cassette helicopter and alternating electric field magnetic manometer DPC

Kia recalls some K3 new energy with potential safety hazards
![[splishsplash] about how to receive / display user parameters, MVC mode and genparam on GUI and JSON](/img/83/9bd9ce7608ebfe7207ac008b9e8ab1.png)
[splishsplash] about how to receive / display user parameters, MVC mode and genparam on GUI and JSON

Yyds dry inventory MySQL RC transaction isolation level implementation

Enter wechat applet

Mysql database - Advanced SQL statement (2)

Penetration practice vulnhub range Keyring
随机推荐
Depth first traversal and breadth first traversal [easy to understand]
SLO is increasingly used to achieve observability | Devops
Mysql database - Advanced SQL statement (2)
Apk signature process introduction [easy to understand]
Is online stock account opening safe? Is it reliable?
China metallocene polyethylene (MPE) Industry Research Report (2022 Edition)
[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)
Encryption and decryption of tinyurl in leetcode
vulnhub靶场-Hacker_Kid-v1.0.1
Report on research and investment prospects of China's silicon nitride ceramic substrate industry (2022 Edition)
PHP实现敏感词过滤系统「建议收藏」
开发那些事儿:EasyCVR集群设备管理页面功能展示优化
Blackwich: the roadmap of decarbonization is the first step to realize the equitable energy transformation in Asia
Replace UUID, nanoid is faster and safer!
From comedians to NBA Zhan Huang, check the encrypted advertisements during this super bowl
C language implementation of sum of two numbers [easy to understand]
Source code of new campus errand / campus task platform on mutual station
SPIE Western optoelectronics exhibition returned offline and successfully held a science and engineering event
Integer array merge [JS]
Can hero sports go public against the wind?