Scenario: I built a zabbix, and when I monitored mysql8.0 through the agent script, an error occurred: awk: cmd. Line: 1: (FILENAME =-FNR = 1) fatal: division by zero attempted
The configuration of the corresponding SQL is as follows. The SQL is the serial number of the obtained binlog log file:
Execution results found an error
So I suspected that it was an abnormal result of the sql command itself, so I removed the awk command part and executed it again to find that the sql execution is normal, but why does this problem occur?
After calmly thinking, sql itself is definitely no problem, it is a problem when awk cutting, how to deal with it to get the result I want. .
At this moment, I suddenly thought that I used to cut from the front, then this time I cut the desired data from the back to see.
So the awk cutting process was readjusted, and finally the binlog log file serial number was successfully cut out.
Although the awk error was not resolved from the front this time, the problem was solved from the side and the result I achieved was achieved. The idea of solving the problem is still very important.