zabbix3.0.4 using shell scripts and Zabbix with templates two ways to add monitoring for a specified process and port

Source: Internet
Author: User
zabbix3.0.4 add monitoring of the process:

method One: Monitor with custom commands

Main idea: Through Ps-ef|grep sdk-push-1.0.0.jar |grep-v grep|wc-l This command to determine whether the process Sdk-push is running, if not equal to 1 means the process hangs, triggering the alarm

Monitored zabbix-agent side:
To add monitoring parameters:
# vim/etc/zabbix/zabbix_agentd.conf

Userparameter=sdk_push,ps-ef|grep Sdk-push-1.0.0.jar |grep-v grep|wc-l


Restart Zabbix-agent make configuration effective

Service Zabbix-agent Restart


Zabbix-server test is OK, when the port is not the default 10050, you need to add-p to specify the port:
Zabbix_get-s 1.1.1.1-p 20050-k Sdk_push

Add the appropriate monitoring to the Zabbix Web page:

Add Monitoring Item Item
Confuguration--Hosts--find the corresponding host, point to Items--Create item


Create a trigger on this monitoring item
Confuguration--Hosts--find the corresponding host, tap Triggers---Create Trigger



Of course, you can also define action actions to restart your app, which is not recommended if the application is more complex.


Finally do not forget the test, you can stop the process to see if the alarm



method Two: The specified process is monitored by the Zabbix's own template

The following is the monitoring configuration of the elasticsearch process, the parameter description in key, the first parameter is the process name, no need to fill in, it will make the monitoring is not accurate, the second parameter is the user name of the running process, the third is the status of the process, including: all (default), run, Sleep, Zomb, the fourth parameter is used to specify the characters contained in the process name and to filter the process.

Items--Create item
Name:amount of ES
Type:zabbix Agent
Key:proc.num[,yunva,all,elasticsearch]
Application:process Monitor


Key:proc.num[,yunva,all,elasticsearch] Value Yunva to be filled in according to the actual situation (user running Elasticsearch program)

Note Type to select the Type:zabbix agent because the Type:zabbix agent (Active) mode cannot execute remote commands

3. After configuring the monitoring item, add the trigger, the following trigger indicates that the last two times the value is 0, indicating that no elasticsearch process is running, then the alarm is set.
Trggiers--Create Trigger

Name:process of ES is down
Expression: {Hostname:proc.num[,yunva,all,elasticsearch].max (#2)}=0




Monitoring ports with your own templates
add Item:name:yuyin file port 9999
Type:zabbix Agent
KEY:NET.TCP.LISTEN[9999]



Trigger

Name:yuyin Port 9999 is down
Expression: {Template OS Linux_yuyin_file_aiwaya:net.tcp.listen[9999].max (#2)}=0



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.