当前位置:网站首页>ZABBIX custom monitoring item (server monitoring)
ZABBIX custom monitoring item (server monitoring)
2022-06-23 21:24:00 【O & M small flame】
zabbix The monitoring system is generally used to monitor the server performance or project , The default monitoring template is sometimes difficult to use , Or I don't have what I want , Let's add custom monitoring items server End calls agent The key value parameter of the end configuration calls the script , The script parameters are then passed to server End ,server End write into database , Then get the new value, process it and display it to the user at the front end First of all , Write monitoring scripts second , modify zabbix_agent Configuration of Third , stay zabbix_web Add new Monitoring item trigger graphics Prerequisite zabbix Installed This time, the order is used KEY Value presentation , Easier to understand
First of all , Write monitoring scripts
Here we simply write a script , simulation nginx The state of ( Import random module Generate random number It's because you need to make the following graphics look trendy )
#!/usr/bin/python3 #TestNum.py Content
import random
number = random.randint(1,100) # Test import random number module generation 1-100 The random number
with open('/var/log/nginx_code.log','a') as f: # Write random numbers to the log Facilitate data validation
f.write(str(number) + '\n')
print(number) # Print values as required
# Script finished second , modify zabbix_agent Configuration of
# The operation is only on the client side ( Modify the following parameters of the configuration file ) UnsafeUserParameters=1 UserParameter=nginx.code,/usr/bin/python3 /usr/local/zabbix-3.4.11/script/TestNum.py # Restart after modification zabbix_agent client /etc/init.d/zabbix_agentd restart # Restart and take effect Skip the following 3 Step ( There will be no demonstration this time ): UserParameter You can also get multiple through scripts key Value ( The production environment has been used for a long time KEY value ): UserParameter=mysql.status[*],/usr/local/zabbix/scripts/check_mysql.sh $1 # The example will not be demonstrated this time UserParameter=check_port[*],/usr/local/zabbix/scripts/check_port.sh -H 127.0.0.1 -p $1 # The example will not be demonstrated this time
# Modify the permissions chown zabbix.zabbix /var/log/nginx_code.log #zabbix The user specified for the source installation chown zabbix.zabbix /usr/local/zabbix-3.4.11/script/TestNum.py chmod 766 /var/log/nginx_code.log chmod 766 /usr/local/zabbix-3.4.11/script/TestNum.py chmod +x /usr/local/zabbix-3.4.11/script/TestNum.py # Script add execute permission
Third , stay zabbix_web Add new Monitoring item trigger graphics
1 Add monitor ( After that, slide to the bottom to update ) To configure --> host --> Monitoring item --> Create monitor item
Add success ( as follows Status OK enabled ) abnormal : It will show that it doesn't support ( Red ), If it is normal, it shows enabled ( green )
Start adding graphics ( To configure --> host --> graphics --> Create graphics ) ps: Triggers and graphs are configured on the basis of monitoring items , Because monitoring items are used to obtain real-time data
After adding graphics , Update view ( as follows )
Check whether the status code output by the script corresponds to the graph , At present, they are consistent ( It should be output with a time , It looks clearer ha-ha )
Graphics added
Next, add a trigger ( The steps are as follows ) ps: Set according to your own requirements N Value trigger And then update
The next step is to verify ( For demonstration , The set value is easy to trigger , Trigger as follows :)
Triggered Verification completed Over ( as follows )
边栏推荐
- Bi-sql index
- 网上证券开户安全还是去营业部安全
- What is the role of computer auto audit audio? What content failed to pass the audit?
- Elegant asynchronous programming version answer async and await parsing
- Processing of purchase return in SAP mm preliminary transaction code Migo
- MySQL advanced development
- Thinking about distributed system consensus
- This article introduces you to the necessity of database connection pooling
- How do I view the server when I log in to the fortress machine? Operation guide for novice
- [5 minutes to play lighthouse] quickly use Chang'an chain
猜你喜欢

How to gradually improve PMO's own ability and management level
![Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text](/img/b1/71cc36c45102bdb9c06e099eb42267.jpg)
Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text

Four aspects of PMO Department value assessment

What are the main dimensions of PMO performance appraisal?

New SQL syntax quick manual!
Application of JDBC in performance test

How does PMO select and train project managers?

How to view the role of PMO in agile organizations?

How PMO uses two dimensions for performance appraisal

Beitong G3 game console unpacking experience. It turns out that mobile game experts have achieved this
随机推荐
Full instructions for databinding
Install bitgarden open source password manager
QPS fails to go up due to frequency limitation of public network CLB bandwidth
Is it safe to open an account with flush?
On line project LAN on-line software use ----phpstudy
上线项目之局域网上线软件使用-----phpStudy
What are the processing methods for PPT pictures
Global and Chinese markets for e-cigarettes and tobacco vapors 2022-2028: Research Report on technology, participants, trends, market size and share
Whether the offsetwidth includes scroll bars
Game security - call analysis - write code
. NET Core . NET Framework
[development skills] how to add "live broadcast" status display bar on easynvr platform
Elegant asynchronous programming version answer async and await parsing
There is a 1GB difference between truncatememory and removememory
How to build a personal cloud game server? How many games can the cloud game platform install?
Disaster recovery series (VII) -- hybrid cloud public network export disaster recovery construction
Gradle asked seven times. You should know that~
How to handle the prompt that DNS is incorrect when adding resolution to Tencent cloud?
What about the cloud disk service status error? How to format the cloud disk service?
How to build a cloud game platform? Disadvantages of traditional games