当前位置:网站首页>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. - -
边栏推荐
- DNS
- 期货先锋这个软件正规吗安全吗?选择哪家期货公司更安全?
- Intelligent operation and maintenance practice: banking business process and single transaction tracking
- PETRv2:一个多摄像头图像3D感知的统一框架
- 目前炒期货在哪里开户最正规安全?怎么期货开户?
- 手机开户股票开户安全吗?那么开户需要带些什么?
- At present, where is the most formal and safe account opening for futures speculation? How to open a futures account?
- 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
- Openlayers 自定义气泡框以及定位到气泡框
- Report on research and investment prospects of China's silicon nitride ceramic substrate industry (2022 Edition)
猜你喜欢

Length of learning and changing

剑指 Offer 20. 表示数值的字符串

Oom caused by improper use of multithreading

New 95 community system whole station source code

Detailed explanation of string's trim() and substring()

The new server is packaged with the source code of H5 mall with an operation level value of several thousand

The difference and relationship between iteratible objects, iterators and generators

Data warehouse (3) star model and dimension modeling of data warehouse modeling

Intel's open source deep learning tool library openvino will increase cooperation with local software and hardware parties and continue to open
![[PHP foundation] realize the connection between PHP and SQL database](/img/eb/c8953eddfe3b19b0adb5529957d275.jpg)
[PHP foundation] realize the connection between PHP and SQL database
随机推荐
(16) ADC conversion experiment
[C supplement] [string] display the schedule of a month by date
People help ant help task platform repair source code
Euler function: find the number of numbers less than or equal to N and coprime with n
MES production equipment manufacturing execution system software
Redis -- data type and operation
String的trim()和substring()详解
DNS
Key points on February 15, 2022
[beauty detection artifact] come on, please show your unique skill (is this beauty worthy of the audience?)
網上股票開戶安全嗎?是否可靠?
The reviewboard has 500 errors when submitting a review. Solutions
PETRv2:一个多摄像头图像3D感知的统一框架
(17) DAC conversion experiment
Code example of libcurl download file
C language implementation of sum of two numbers [easy to understand]
Radhat builds intranet Yum source server
Cassette helicopter and alternating electric field magnetic manometer DPC
In aks, use secret in CSI driver mount key vault
Penetration practice vulnhub range Nemesis