Simple custom monitoring of Linux services, only to see if the PS process exists

Source: Internet
Author: User

Create a custom script:

[[email protected] zabbix_agentd.d]# cat crm-web.sh #!/bin/bashps-ef|grep crm-web|grep-v ' grep ' |grep-v ' sh ' |wc-l

Note Permissions and Users:

[email protected] zabbix_agentd.d]# ll crm-web.sh-rwxr-xr-x 1 Zabbix Zabbix the 14:55 crm-web.sh

Create a custom key:

[email protected] zabbix_agentd.d]# cat crm-web_status.conf userparameter=crm-web_status[*],/etc/zabbix/zabbix_ Agentd.d/crm-web.sh $

Attention to permissions and users: (should not be adjusted)

[email protected] zabbix_agentd.d]# ll crm-web_status.conf-rw-r--r--1 root root-13:03 crm-web_status.conf

Restart the Zabbix Agent service:

[[email protected] zabbix_agentd.d]# ps -ef|grep zabbixzabbix     5534     1  0 14:17 ?         00:00:00 zabbix_agentd -c /etc/zabbix/zabbix_agentd.confzabbix     5535  5534  0 14:17 ?        00:00:00  zabbix_agentd: collector [idle 1 sec]zabbix    5536   5534  0 14:17 ?        00:00:00 zabbix_agentd : listener  #1  [waiting for connection]zabbix    5537   5534  0 14:17 ?        00:00:00 zabbix_agentd : listener  #2  [waiting for connection]zabbix    5538   5534  0 14:17 ?        00:00:00 zabbix_agentd: listener  #3  [waiting for connection]zabbix    5539  5534  0  14:17 ?        00:00:00 zabbix_agentd: active  checks  #1  [idle 1 sec]root      9386 30370   0 14:59 pts/4    00:00:00 grep --color=auto zabbix[[email  protected] zabbix_agentd.d]# pkill -f /etc/zabbix/zabbix_agentd.conf[[email  protected] zabbix_agentd.d]# ps -ef|grep zabbixroot       9410 30370  0 14:59 pts/4    00:00:00 grep --color=auto  zabbix[[email protected] zabbix_agentd.d]# zabbix_agentd -c /etc/zabbix/zabbix_ Agentd.conf[[email protected] zabbix_agentd.d]# ps -ef|grep zabbixzabbix    9420      1  0 14:59 ?        00:00:00  zabbix_agentd -c /etc/zabbix/zabbix_agentd.confzabbix    9421   9420  0 14:59 ?        00:00:00 zabbix_agentd :  collector [idle 1 sec]zabbix    9422  9420  0  14:59 ?        00:00:00 zabbix_agentd: listener   #1  [waiting for connection]zabbix    9423  9420   0 14:59 ?        00:00:00 zabbix_agentd: listener   #2  [waiting for connection]zabbix    9424  9420   0 14:59 ?        00:00:00 zabbix_agentd: listener  #3  [waiting  for connection]zabbix    9425  9420  0 14:59 ?         00:00:00 zabbix_agentd: active checks  #1  [idle 1 sec]root      9434 30370  0 14:59  pts/4    00:00:00 grep --color=auto zabbix


Select "Configuration" → "Host"

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/8A/5F/wKiom1gurPfSNupyAABQvjZJ4mw745.jpg "title=" 1.jpg " alt= "Wkiom1gurpfsnupyaabqvjzj4mw745.jpg"/>



Locate the specified monitoring host and select "Items"

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/8A/5F/wKiom1gurZ_jHdTwAABI7kGclWw462.jpg "title=" 2.jpg " alt= "Wkiom1gurz_jhdtwaabi7kgclww462.jpg"/>

In the new screen that pops up, click "Create Item" button

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/8A/5B/wKioL1gurfOiFDniAACy1uFFodg314.jpg "title=" 3.jpg " alt= "Wkiol1gurfoifdniaacy1uffodg314.jpg"/>


Only the "Name" and "Key" values need to be modified

Name:crm-web Service Process

Key:crm-web_status

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/8A/5F/wKiom1gurqGgKP1uAAC1kAIE6G0019.jpg "title=" 4.jpg " alt= "Wkiom1gurqggkp1uaac1kaie6g0019.jpg"/>


"Applications" is not a required option, can be based on their own actual situation to decide, here is mainly convenient classification.

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/8A/61/wKiom1guuLvSo-JbAABxDwRpFCA425.jpg "title=" 5.jpg " alt= "Wkiom1guulvso-jbaabxdwrpfca425.jpg"/>

Click "Triggers", you can click "Create Trigger" button

650) this.width=650; "src=" http://s4.51cto.com/wyfs02/M02/8A/5E/wKioL1guuUSz_9glAACYLDtEz9c950.jpg "title=" 6.jpg " alt= "Wkiol1guuusz_9glaacyldtez9c950.jpg"/>


In the new interface that pops up, fill in the following:

' Name ': Crm-web Service not available

"Expression": {10.253.40.86:crm-web_status.last ()}<>1

"Description": Crm-web Service Not available "is not required to fill in the content"

"Severity": Nor does it have to be this type

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/8A/5F/wKioL1guunejzqz5AACPhYQbp1A270.jpg "title=" 7.jpg " alt= "Wkiol1guunejzqz5aacphyqbp1a270.jpg"/>


"Expression" is the content, click on the "Add" button, in the Pop-up dialog box, and then click "Select" button

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/8A/5F/wKioL1guuymwUwuPAABgQu4tSfA600.jpg "title=" 8.jpg " alt= "Wkiol1guuymwuwupaabgqu4tsfa600.jpg"/>


In the popup dialog box, click on "Crm-web service process". The reason for this is that the item is created earlier, otherwise the custom monitoring item does not appear here. If not, you can also check to see if the "Group" and "Host" in the upper-right corner are positioned correctly.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/8A/63/wKiom1guvG-CwgYsAAF59zYYAHM270.jpg "title=" 9.jpg " alt= "Wkiom1guvg-cwgysaaf59zyyahm270.jpg"/>


The Function option uses the parameters in the diagram

"N" option: 1

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/8A/64/wKiom1guvtXxRTiZAABjPOkLTao082.jpg "title=" 10.jpg "alt=" Wkiom1guvtxxrtizaabjpokltao082.jpg "/>


Click "Graphs" and click "Create Graph" button.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/8A/61/wKioL1guwSGCo8wIAABeC7vHssw587.jpg "title=" 11.jpg "alt=" Wkiol1guwsgco8wiaabec7vhssw587.jpg "/>


"Name": Crm-web service process

650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/8A/63/wKioL1guxVTBfTNOAACSxMWShaM175.jpg "title=" 12.jpg "alt=" Wkiol1guxvtbftnoaacsxmwsham175.jpg "/>


Click "Add" button, in the Pop-up dialog box, select "Crm-web service Process" can

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/8A/64/wKioL1guxebAbFREAAFnKe31D_o700.jpg "title=" 13.jpg "alt=" Wkiol1guxebabfreaafnke31d_o700.jpg "/>

The basic configuration is in this context.


The following custom monitoring items are almost the same:

[[email protected] zabbix_agentd.d]# cat crm-notify.sh #!/bin/bashps-ef|grep crm-notify|grep-v ' grep ' |grep-v ' sh ' |wc-l [email protected] zabbix_agentd.d]# cat crm-notify_status.conf userparameter=crm-notify_status[*],/etc/zabbix/ Zabbix_agentd.d/crm-notify.sh $

Do not forget to restart the Zabbix agent service.


Execute the test command on the Zabbix server:

[Email protected] zabbix_agentd.d]# zabbix_get-s 10.253.40.86-k "Crm-web_status" 1[[email protected] zabbix_agentd.d] # zabbix_get-s 10.253.40.86-k "Crm-notify_status" 1


This article from "Dark-matter" blog, declined reprint!

Simple custom monitoring of Linux services, only to see if the PS process exists

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.