Using ZABBIX’s own key to monitor process and port
Every company has its own program, its own process name and port monitoring. For Nagios, it often needs to write plug-ins, but ZABBIX does not. It has its own key to monitor the process and port.
Before using ZABBIX’s key to monitor the process and port, I also wrote a plug-in myself, but it’s very uncomfortable to use, because it needs to be configured and maintained on all agents. If you use ZABBIX’s own function, you only need to maintain it on the server side. It’s just the difference between being very attentive and being distracted. Why didn’t I find this function earlier.
Let’s get down to business
1, monitoring port
2The monitoring port uses the following key:
key: net.tcp.listen [port]
Checks if this port is in LISTEN state. 0 – it is not, 1 – it is inLISTEN state.
Listening to the port status, if the return result is 1, it will run; if the return result is 0, it will not run.
For example, monitoring port 443, net.tcp.listen [443]
2, monitoring process
2If a process does not have a listening port, the following key can be used.
key: proc.num [<name&>,<user&>,<state&>,<cmdline&>]
Number of processes. <name&> and <user&> same as inproc.mem item. <state&> all (default), run, sleep, zomb. <cmdline&>filter by command line (supports regex).
Name: is the process name
User: the user who runs the process
State: the process state includes run, sleep and zomb
CmdLine: the content of this item is a fuzzy match, that is, if the last column seen with PS aux contains this field, it will be matched.
Note: the name matching may not be very accurate. Generally, the process is matched according to the CmdLine
For example, monitoring cond, proc.num [,root,all,crond]
The configuration is as follows:
3, trigger configuration
3For port monitoring, if it is normal, the return value is 1; for process monitoring, if it is normal, the return value is &> = 1; if the return result is 0, the process is down.
For example, the trigger configuration for port 443 is as follows:
If the last two results are equal to 0, the alarm will be given. The trigger configuration for a process is the same.
ZABBIX is very convenient for monitoring the process and port survival status. Recently, I’m learning ZABBIX by myself. I’m exploring more useful functions. Welcome to leave a message.