Author: SRE operations blog

Blog: www.cnsre.cn

Zabbix monitors processes and ports through agent


Environment introduction

Operating system: centos 7.4

Zabbix Version: Zabbix Server 3.4.7

Client: Zabbix-Agent 3.4.7

Monitor process: mysqld

Monitoring port: 3306 TCP

Process monitoring

Ensure that the Agent is installed and running on the client

Check the process

Look at the processes that belong to that user

The mysql process has two processes: root

Adding monitoring Items

Let me just write my name

Type zabbix client

Key value Number of processes Returned

The application set selects the prosesses process

proc.num[<name>,<user>,<state>,<cmdline>]

The following is the configuration for monitoring mysql processes.


The first parameter is the name of the process. It is not necessary to fill in this parameter because it will make the monitoring less accurate (personal test only).


The second argument is the user name to run the process


The third parameter is the process status. Generally, all includes all (default), run, sleep, and zomb


The fourth parameter specifies the characters in the process name to filter the process.

Confirm the update

Create trigger

Select the monitor you just created

insert

Modify the {hgh3a01: proc. Num [, root, all, mysqld]. Last ()} = 0

for

{hgh3a01:proc.num[,root,all,mysqld].max(#2)}=2

Hgh3a01: indicates the host name

Proc. num[,root,all,mysqld] : monitoring item

Max (#2)}=2: indicates that the last two received values are two processes (ps -ef sees two processes in mysqld, so =2), indicating that mysqld process is running, and then alarm.

Since we want to test whether the alarm can be started, we should select =2. If the alarm is normal <1, it is not running.

Wait a few minutes and see if it triggers the trigger

Receive email alerts

Change the test process to normal (because mysql is running two processes)

Save the update and check whether it returns to normal

Monitor the port

Adding monitoring Items

Modify port save updates

Same as monitoring process (test first)

Receive trigger warning

I’m going to go back to 0

Tests returned to normal


Author: SRE operations blog

Blog: www.cnsre.cn

Zabbix monitors processes and ports through agent