When debugging Zabbix, forget the password can be reset by the following method.
First SSH to the Zabbix database server, and then log on to the MySQL database.
Mysql-u root-p
The Zabbix password is stored in the database zabbix,table users and is encrypted in MD5.
Use MD5 to make a secret key.
Echo-n abc,123. | OpenSSL MD5
This makes a secret key with a password of abc,123, and next updates the password in the database table.
Update users set passwd= ' Af417080428aadc82c01e7002d649e92 ' where userid= ' 1 ';
One of the passwd "" is a string of MD5 generated by the secret key, ID 1 account default management account, update can use the new password login Zabbix.
About Zabbix Custom key:
First change the zabbix-agentd.conf to
Unsafeuserparameters=0
Delete the comment on that line and change the 0 to 1.
The name of the custom key and the method to get the value are written in Zabbix_agentd.d this directory of Conf, can rebuild a conf oneself also can use his own userparameter_mysql.conf
Insert a row by following the definition of key above in the file, where I use my own script.
Userparameter=net. Dns[*],/etc/zabbix/userkey/net. Dns.sh $
I use net. Dns.sh to obtain the service state of the target machine DNS, return 1 if the port is not closed, or 0, the bracket. Use to pass parameters.
I'll put this script on the. /userkey (the directory is built by itself), here is the script content
Nmap $1-st-p 53 | grep 53 | awk ' {if ($2== ' open ') {print 1} else {print 0}} '
A very simple script that returns 0 and 1.
Problems encountered while debugging:
All the above steps can be used after finishing
Zabbix_agentd-t Net. dns[192.168.1.1]
Testing whether a custom key is available or not is a problem if you do not return an error
Restart Client Agentd
Service Zabbix_agent Restart
and then use
Zabbix_get-s 127.0.0.1-k Net. dns[192.168.1.1]
The test calls the client key from the server side, and the test is ready to be used in Zabbix.
The above Reboot Service command is very important, otherwise it will prompt
zbx_notsupported:unsupported Item key.
The second problem that comes up when you restart the service prompts
Zabbix_agentd [21827]: Invalid entry [B0vim 7.2] (not following "Parameter=value" notation) in config file [<pre name=] Code "class=" plain ">rm/etc/zabbix/zabbix_agentd.d/.userparameter_mysql.conf.swp<span style=" font-family: Arial, Helvetica, Sans-serif; "], line 1</span>
Baidu did not find a lap of what this is a problem.
Then go in and delete the file.
/etc/zabbix/zabbix_agentd.d/.userparameter_mysql.conf.swp
Reboot ZABBIX_AGENTD or no hint
Starting Zabbix Agent:zabbix_agentd [22706]: Unknown parameter [nmap $1-st-p | grep | awk ' {if ($] in config file [/etc/zabbix/zabbix_agentd.d/net. DNS.SH], line 2
[FAILED]
Then I realized that I had put that script in that directory, and when the service started, Zabbix_agent would scan all the files in that directory, not just. conf
My script was not able to match the specification of the custom key when I scanned the error, and later moved the script out of the directory and modified the userparameter.conf.